+ + + + + + + 一键收款 + + + 待收款 {{pendingConfirmList.length}} 笔 · 合计 ¥{{pendingConfirmAmount}} + + + + {{receivingAll ? '收款中...' : '立即收款'}} + + + + 将依次调起微信收款页完成领取 + 查看提现记录 › + + + diff --git a/miniprogram/pages/my/my.wxss b/miniprogram/pages/my/my.wxss index 62a7c175..6d43a7da 100644 --- a/miniprogram/pages/my/my.wxss +++ b/miniprogram/pages/my/my.wxss @@ -84,7 +84,7 @@ .profile-stat-label { display: block; font-size: 22rpx; color: #6B7280; margin-top: 8rpx; } /* ===== 主内容区 ===== */ -.main-content { } +.main-content { padding: 0 0 0 0; } /* 卡片通用 */ .card { @@ -97,6 +97,24 @@ .card-icon-img { width: 40rpx; height: 40rpx; flex-shrink: 0; } .card-title { font-size: 32rpx; font-weight: bold; color: #fff; } +/* ===== 一键收款卡片 ===== */ +.receive-card { padding: 28rpx 32rpx; } +.receive-top { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; } +.receive-left { flex: 1; min-width: 0; } +.receive-title-row { display: flex; align-items: center; gap: 16rpx; margin-bottom: 12rpx; } +.receive-sub { display: block; font-size: 24rpx; color: rgba(255,255,255,0.65); } +.receive-btn { + flex-shrink: 0; + padding: 16rpx 28rpx; + border-radius: 999rpx; + background: linear-gradient(135deg, #4FD1C5 0%, #20B2AA 100%); +} +.receive-btn-text { font-size: 26rpx; font-weight: 700; color: #000; } +.receive-btn-disabled { opacity: 0.55; } +.receive-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; margin-top: 18rpx; } +.receive-tip { font-size: 22rpx; color: rgba(255,255,255,0.45); } +.receive-link { font-size: 24rpx; color: #4FD1C5; } + /* 分享收益 */ .earnings-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; diff --git a/soul-admin/dist/assets/index-CAf6YeOV.js b/soul-admin/dist/assets/index-CAf6YeOV.js deleted file mode 100644 index 68bca864..00000000 --- a/soul-admin/dist/assets/index-CAf6YeOV.js +++ /dev/null @@ -1,470 +0,0 @@ -function ty(r,a){for(var l=0;lo[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"]'))o(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"&&o(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 o(c){if(c.ep)return;c.ep=!0;const u=l(c);fetch(c.href,u)}})();function cp(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Bc={exports:{}},Ma={},Uc={exports:{}},ze={};/** - * @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 Zh;function ny(){if(Zh)return ze;Zh=1;var r=Symbol.for("react.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.iterator;function E(D){return D===null||typeof D!="object"?null:(D=y&&D[y]||D["@@iterator"],typeof D=="function"?D:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,w={};function j(D,P,W){this.props=D,this.context=P,this.refs=w,this.updater=W||_}j.prototype.isReactComponent={},j.prototype.setState=function(D,P){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,P,"setState")},j.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function b(){}b.prototype=j.prototype;function C(D,P,W){this.props=D,this.context=P,this.refs=w,this.updater=W||_}var N=C.prototype=new b;N.constructor=C,k(N,j.prototype),N.isPureReactComponent=!0;var A=Array.isArray,$=Object.prototype.hasOwnProperty,V={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function T(D,P,W){var re,he={},me=null,se=null;if(P!=null)for(re in P.ref!==void 0&&(se=P.ref),P.key!==void 0&&(me=""+P.key),P)$.call(P,re)&&!R.hasOwnProperty(re)&&(he[re]=P[re]);var pe=arguments.length-2;if(pe===1)he.children=W;else if(1>>1,P=I[D];if(0>>1;Dc(he,B))mec(se,he)?(I[D]=se,I[me]=B,D=me):(I[D]=he,I[re]=B,D=re);else if(mec(se,B))I[D]=se,I[me]=B,D=me;else break e}}return Q}function c(I,Q){var B=I.sortIndex-Q.sortIndex;return B!==0?B:I.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;r.unstable_now=function(){return u.now()}}else{var f=Date,p=f.now();r.unstable_now=function(){return f.now()-p}}var x=[],g=[],v=1,y=null,E=3,_=!1,k=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(I){for(var Q=l(g);Q!==null;){if(Q.callback===null)o(g);else if(Q.startTime<=I)o(g),Q.sortIndex=Q.expirationTime,a(x,Q);else break;Q=l(g)}}function A(I){if(w=!1,N(I),!k)if(l(x)!==null)k=!0,ee($);else{var Q=l(g);Q!==null&&q(A,Q.startTime-I)}}function $(I,Q){k=!1,w&&(w=!1,b(T),T=-1),_=!0;var B=E;try{for(N(Q),y=l(x);y!==null&&(!(y.expirationTime>Q)||I&&!K());){var D=y.callback;if(typeof D=="function"){y.callback=null,E=y.priorityLevel;var P=D(y.expirationTime<=Q);Q=r.unstable_now(),typeof P=="function"?y.callback=P:y===l(x)&&o(x),N(Q)}else o(x);y=l(x)}if(y!==null)var W=!0;else{var re=l(g);re!==null&&q(A,re.startTime-Q),W=!1}return W}finally{y=null,E=B,_=!1}}var V=!1,R=null,T=-1,F=5,Y=-1;function K(){return!(r.unstable_now()-YI||125D?(I.sortIndex=B,a(g,I),l(x)===null&&I===l(g)&&(w?(b(T),T=-1):w=!0,q(A,B-D))):(I.sortIndex=P,a(x,I),k||_||(k=!0,ee($))),I},r.unstable_shouldYield=K,r.unstable_wrapCallback=function(I){var Q=E;return function(){var B=E;E=Q;try{return I.apply(this,arguments)}finally{E=B}}}})(Hc)),Hc}var sm;function ly(){return sm||(sm=1,Wc.exports=ay()),Wc.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 am;function iy(){if(am)return $t;am=1;var r=Ad(),a=ly();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,g=/^[: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]*$/,v={},y={};function E(e){return x.call(y,e)?!0:x.call(v,e)?!1:g.test(e)?y[e]=!0:(v[e]=!0,!1)}function _(e,n,s,i){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return i?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function k(e,n,s,i){if(n===null||typeof n>"u"||_(e,n,s,i))return!0;if(i)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 w(e,n,s,i,d,m,S){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=i,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=m,this.removeEmptyString=S}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){j[e]=new w(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];j[n]=new w(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){j[e]=new w(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){j[e]=new w(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){j[e]=new w(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){j[e]=new w(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){j[e]=new w(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){j[e]=new w(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){j[e]=new w(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function C(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(b,C);j[n]=new w(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(b,C);j[n]=new w(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(b,C);j[n]=new w(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){j[e]=new w(e,1,!1,e.toLowerCase(),null,!1,!1)}),j.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){j[e]=new w(e,1,!1,e.toLowerCase(),null,!0,!0)});function N(e,n,s,i){var d=j.hasOwnProperty(n)?j[n]:null;(d!==null?d.type!==0:i||!(2M||d[S]!==m[M]){var O=` -`+d[S].replace(" at new "," at ");return e.displayName&&O.includes("")&&(O=O.replace("",e.displayName)),O}while(1<=S&&0<=M);break}}}finally{W=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?P(e):""}function he(e){switch(e.tag){case 5:return P(e.type);case 16:return P("Lazy");case 13:return P("Suspense");case 19:return P("SuspenseList");case 0:case 2:case 15:return e=re(e.type,!1),e;case 11:return e=re(e.type.render,!1),e;case 1:return e=re(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 R:return"Fragment";case V:return"Portal";case F:return"Profiler";case T:return"StrictMode";case ce:return"Suspense";case X:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case K:return(e.displayName||"Context")+".Consumer";case Y:return(e._context.displayName||"Context")+".Provider";case J:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case le:return n=e.displayName||null,n!==null?n:me(e.type)||"Memo";case ee:n=e._payload,e=e._init;try{return me(e(n))}catch{}}return null}function se(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===T?"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 pe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function L(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function ue(e){var n=L(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),i=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,m=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(S){i=""+S,m.call(this,S)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(S){i=""+S},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function xe(e){e._valueTracker||(e._valueTracker=ue(e))}function Re(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),i="";return e&&(i=L(e)?e.checked?"true":"false":e.value),e=i,e!==s?(n.setValue(e),!0):!1}function De(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 Fe(e,n){var s=n.checked;return B({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Qe(e,n){var s=n.defaultValue==null?"":n.defaultValue,i=n.checked!=null?n.checked:n.defaultChecked;s=pe(n.value!=null?n.value:s),e._wrapperState={initialChecked:i,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function st(e,n){n=n.checked,n!=null&&N(e,"checked",n,!1)}function et(e,n){st(e,n);var s=pe(n.value),i=n.type;if(s!=null)i==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Mt(e,n.type,s):n.hasOwnProperty("defaultValue")&&Mt(e,n.type,pe(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function At(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var i=n.type;if(!(i!=="submit"&&i!=="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 Mt(e,n,s){(n!=="number"||De(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ir=Array.isArray;function Xn(e,n,s,i){if(e=e.options,n){n={};for(var d=0;d"+n.valueOf().toString()+"",n=Ue.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function cn(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Ar={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},a0=["Webkit","ms","Moz","O"];Object.keys(Ar).forEach(function(e){a0.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Ar[n]=Ar[e]})});function hu(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Ar.hasOwnProperty(e)&&Ar[e]?(""+n).trim():n+"px"}function mu(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var i=s.indexOf("--")===0,d=hu(s,n[s],i);s==="float"&&(s="cssFloat"),i?e.setProperty(s,d):e[s]=d}}var l0=B({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 Ji(e,n){if(n){if(l0[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 Zi(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 eo=null;function to(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var no=null,as=null,ls=null;function pu(e){if(e=ya(e)){if(typeof no!="function")throw Error(l(280));var n=e.stateNode;n&&(n=xl(n),no(e.stateNode,e.type,n))}}function xu(e){as?ls?ls.push(e):ls=[e]:as=e}function gu(){if(as){var e=as,n=ls;if(ls=as=null,pu(e),n)for(e=0;e>>=0,e===0?32:31-(g0(e)/v0|0)|0}var Ja=64,Za=4194304;function ta(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 el(e,n){var s=e.pendingLanes;if(s===0)return 0;var i=0,d=e.suspendedLanes,m=e.pingedLanes,S=s&268435455;if(S!==0){var M=S&~d;M!==0?i=ta(M):(m&=S,m!==0&&(i=ta(m)))}else S=s&~d,S!==0?i=ta(S):m!==0&&(i=ta(m));if(i===0)return 0;if(n!==0&&n!==i&&(n&d)===0&&(d=i&-i,m=n&-n,d>=m||d===16&&(m&4194240)!==0))return n;if((i&4)!==0&&(i|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=i;0s;s++)n.push(e);return n}function na(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-dn(n),e[n]=s}function b0(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 i=e.eventTimes;for(e=e.expirationTimes;0=da),Hu=" ",Ku=!1;function Gu(e,n){switch(e){case"keyup":return q0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cs=!1;function J0(e,n){switch(e){case"compositionend":return Yu(n);case"keypress":return n.which!==32?null:(Ku=!0,Hu);case"textInput":return e=n.data,e===Hu&&Ku?null:e;default:return null}}function Z0(e,n){if(cs)return e==="compositionend"||!No&&Gu(e,n)?(e=zu(),al=po=nr=null,cs=!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=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=tf(s)}}function rf(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?rf(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function sf(){for(var e=window,n=De();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=De(e.document)}return n}function So(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 ov(e){var n=sf(),s=e.focusedElem,i=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&rf(s.ownerDocument.documentElement,s)){if(i!==null&&So(s)){if(n=i.start,e=i.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,m=Math.min(i.start,d);i=i.end===void 0?m:Math.min(i.end,d),!e.extend&&m>i&&(d=i,i=m,m=d),d=nf(s,m);var S=nf(s,i);d&&S&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==S.node||e.focusOffset!==S.offset)&&(n=n.createRange(),n.setStart(d.node,d.offset),e.removeAllRanges(),m>i?(e.addRange(n),e.extend(S.node,S.offset)):(n.setEnd(S.node,S.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,ds=null,Co=null,ma=null,ko=!1;function af(e,n,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;ko||ds==null||ds!==De(i)||(i=ds,"selectionStart"in i&&So(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),ma&&ha(ma,i)||(ma=i,i=hl(Co,"onSelect"),0ps||(e.current=Fo[ps],Fo[ps]=null,ps--)}function qe(e,n){ps++,Fo[ps]=e.current,e.current=n}var lr={},St=ar(lr),Dt=ar(!1),Lr=lr;function xs(e,n){var s=e.type.contextTypes;if(!s)return lr;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===n)return i.__reactInternalMemoizedMaskedChildContext;var d={},m;for(m in s)d[m]=n[m];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=d),d}function Lt(e){return e=e.childContextTypes,e!=null}function gl(){Je(Dt),Je(St)}function Nf(e,n,s){if(St.current!==lr)throw Error(l(168));qe(St,n),qe(Dt,s)}function bf(e,n,s){var i=e.stateNode;if(n=n.childContextTypes,typeof i.getChildContext!="function")return s;i=i.getChildContext();for(var d in i)if(!(d in n))throw Error(l(108,se(e)||"Unknown",d));return B({},s,i)}function vl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||lr,Lr=St.current,qe(St,e),qe(Dt,Dt.current),!0}function wf(e,n,s){var i=e.stateNode;if(!i)throw Error(l(169));s?(e=bf(e,n,Lr),i.__reactInternalMemoizedMergedChildContext=e,Je(Dt),Je(St),qe(St,e)):Je(Dt),qe(Dt,s)}var Mn=null,yl=!1,zo=!1;function Sf(e){Mn===null?Mn=[e]:Mn.push(e)}function jv(e){yl=!0,Sf(e)}function ir(){if(!zo&&Mn!==null){zo=!0;var e=0,n=Ye;try{var s=Mn;for(Ye=1;e>=S,d-=S,Dn=1<<32-dn(n)+d|s<Ie?(yt=Te,Te=null):yt=Te.sibling;var He=ae(U,Te,H[Ie],fe);if(He===null){Te===null&&(Te=yt);break}e&&Te&&He.alternate===null&&n(U,Te),z=m(He,z,Ie),_e===null?Ce=He:_e.sibling=He,_e=He,Te=yt}if(Ie===H.length)return s(U,Te),tt&&Fr(U,Ie),Ce;if(Te===null){for(;IeIe?(yt=Te,Te=null):yt=Te.sibling;var xr=ae(U,Te,He.value,fe);if(xr===null){Te===null&&(Te=yt);break}e&&Te&&xr.alternate===null&&n(U,Te),z=m(xr,z,Ie),_e===null?Ce=xr:_e.sibling=xr,_e=xr,Te=yt}if(He.done)return s(U,Te),tt&&Fr(U,Ie),Ce;if(Te===null){for(;!He.done;Ie++,He=H.next())He=de(U,He.value,fe),He!==null&&(z=m(He,z,Ie),_e===null?Ce=He:_e.sibling=He,_e=He);return tt&&Fr(U,Ie),Ce}for(Te=i(U,Te);!He.done;Ie++,He=H.next())He=ge(Te,U,Ie,He.value,fe),He!==null&&(e&&He.alternate!==null&&Te.delete(He.key===null?Ie:He.key),z=m(He,z,Ie),_e===null?Ce=He:_e.sibling=He,_e=He);return e&&Te.forEach(function(ey){return n(U,ey)}),tt&&Fr(U,Ie),Ce}function dt(U,z,H,fe){if(typeof H=="object"&&H!==null&&H.type===R&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case $:e:{for(var Ce=H.key,_e=z;_e!==null;){if(_e.key===Ce){if(Ce=H.type,Ce===R){if(_e.tag===7){s(U,_e.sibling),z=d(_e,H.props.children),z.return=U,U=z;break e}}else if(_e.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===ee&&_f(Ce)===_e.type){s(U,_e.sibling),z=d(_e,H.props),z.ref=ja(U,_e,H),z.return=U,U=z;break e}s(U,_e);break}else n(U,_e);_e=_e.sibling}H.type===R?(z=Kr(H.props.children,U.mode,fe,H.key),z.return=U,U=z):(fe=Gl(H.type,H.key,H.props,null,U.mode,fe),fe.ref=ja(U,z,H),fe.return=U,U=fe)}return S(U);case V:e:{for(_e=H.key;z!==null;){if(z.key===_e)if(z.tag===4&&z.stateNode.containerInfo===H.containerInfo&&z.stateNode.implementation===H.implementation){s(U,z.sibling),z=d(z,H.children||[]),z.return=U,U=z;break e}else{s(U,z);break}else n(U,z);z=z.sibling}z=Lc(H,U.mode,fe),z.return=U,U=z}return S(U);case ee:return _e=H._init,dt(U,z,_e(H._payload),fe)}if(Ir(H))return je(U,z,H,fe);if(Q(H))return Se(U,z,H,fe);wl(U,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,z!==null&&z.tag===6?(s(U,z.sibling),z=d(z,H),z.return=U,U=z):(s(U,z),z=Dc(H,U.mode,fe),z.return=U,U=z),S(U)):s(U,z)}return dt}var js=Tf(!0),If=Tf(!1),Sl=ar(null),Cl=null,Ns=null,Ho=null;function Ko(){Ho=Ns=Cl=null}function Go(e){var n=Sl.current;Je(Sl),e._currentValue=n}function Yo(e,n,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,i!==null&&(i.childLanes|=n)):i!==null&&(i.childLanes&n)!==n&&(i.childLanes|=n),e===s)break;e=e.return}}function bs(e,n){Cl=e,Ho=Ns=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(Ot=!0),e.firstContext=null)}function en(e){var n=e._currentValue;if(Ho!==e)if(e={context:e,memoizedValue:n,next:null},Ns===null){if(Cl===null)throw Error(l(308));Ns=e,Cl.dependencies={lanes:0,firstContext:e}}else Ns=Ns.next=e;return n}var zr=null;function Qo(e){zr===null?zr=[e]:zr.push(e)}function Af(e,n,s,i){var d=n.interleaved;return d===null?(s.next=s,Qo(n)):(s.next=d.next,d.next=s),n.interleaved=s,On(e,i)}function On(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 or=!1;function qo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(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 Fn(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function cr(e,n,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Ve&2)!==0){var d=i.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),i.pending=n,On(e,s)}return d=i.interleaved,d===null?(n.next=n,Qo(i)):(n.next=d.next,d.next=n),i.interleaved=n,On(e,s)}function kl(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var i=n.lanes;i&=e.pendingLanes,s|=i,n.lanes=s,co(e,s)}}function Df(e,n){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var d=null,m=null;if(s=s.firstBaseUpdate,s!==null){do{var S={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};m===null?d=m=S:m=m.next=S,s=s.next}while(s!==null);m===null?d=m=n:m=m.next=n}else d=m=n;s={baseState:i.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:i.shared,effects:i.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function El(e,n,s,i){var d=e.updateQueue;or=!1;var m=d.firstBaseUpdate,S=d.lastBaseUpdate,M=d.shared.pending;if(M!==null){d.shared.pending=null;var O=M,G=O.next;O.next=null,S===null?m=G:S.next=G,S=O;var ie=e.alternate;ie!==null&&(ie=ie.updateQueue,M=ie.lastBaseUpdate,M!==S&&(M===null?ie.firstBaseUpdate=G:M.next=G,ie.lastBaseUpdate=O))}if(m!==null){var de=d.baseState;S=0,ie=G=O=null,M=m;do{var ae=M.lane,ge=M.eventTime;if((i&ae)===ae){ie!==null&&(ie=ie.next={eventTime:ge,lane:0,tag:M.tag,payload:M.payload,callback:M.callback,next:null});e:{var je=e,Se=M;switch(ae=n,ge=s,Se.tag){case 1:if(je=Se.payload,typeof je=="function"){de=je.call(ge,de,ae);break e}de=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Se.payload,ae=typeof je=="function"?je.call(ge,de,ae):je,ae==null)break e;de=B({},de,ae);break e;case 2:or=!0}}M.callback!==null&&M.lane!==0&&(e.flags|=64,ae=d.effects,ae===null?d.effects=[M]:ae.push(M))}else ge={eventTime:ge,lane:ae,tag:M.tag,payload:M.payload,callback:M.callback,next:null},ie===null?(G=ie=ge,O=de):ie=ie.next=ge,S|=ae;if(M=M.next,M===null){if(M=d.shared.pending,M===null)break;ae=M,M=ae.next,ae.next=null,d.lastBaseUpdate=ae,d.shared.pending=null}}while(!0);if(ie===null&&(O=de),d.baseState=O,d.firstBaseUpdate=G,d.lastBaseUpdate=ie,n=d.shared.interleaved,n!==null){d=n;do S|=d.lane,d=d.next;while(d!==n)}else m===null&&(d.shared.lanes=0);Ur|=S,e.lanes=S,e.memoizedState=de}}function Lf(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var i=tc.transition;tc.transition={};try{e(!1),n()}finally{Ye=s,tc.transition=i}}function th(){return tn().memoizedState}function Sv(e,n,s){var i=hr(e);if(s={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null},nh(e))rh(n,s);else if(s=Af(e,n,s,i),s!==null){var d=Tt();xn(s,e,i,d),sh(s,n,i)}}function Cv(e,n,s){var i=hr(e),d={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null};if(nh(e))rh(n,d);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var S=n.lastRenderedState,M=m(S,s);if(d.hasEagerState=!0,d.eagerState=M,un(M,S)){var O=n.interleaved;O===null?(d.next=d,Qo(n)):(d.next=O.next,O.next=d),n.interleaved=d;return}}catch{}finally{}s=Af(e,n,d,i),s!==null&&(d=Tt(),xn(s,e,i,d),sh(s,n,i))}}function nh(e){var n=e.alternate;return e===lt||n!==null&&n===lt}function rh(e,n){Sa=_l=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function sh(e,n,s){if((s&4194240)!==0){var i=n.lanes;i&=e.pendingLanes,s|=i,n.lanes=s,co(e,s)}}var Al={readContext:en,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useInsertionEffect:Ct,useLayoutEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useMutableSource:Ct,useSyncExternalStore:Ct,useId:Ct,unstable_isNewReconciler:!1},kv={readContext:en,useCallback:function(e,n){return Cn().memoizedState=[e,n===void 0?null:n],e},useContext:en,useEffect:Gf,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Tl(4194308,4,qf.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Tl(4194308,4,e,n)},useInsertionEffect:function(e,n){return Tl(4,2,e,n)},useMemo:function(e,n){var s=Cn();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var i=Cn();return n=s!==void 0?s(n):n,i.memoizedState=i.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},i.queue=e,e=e.dispatch=Sv.bind(null,lt,e),[i.memoizedState,e]},useRef:function(e){var n=Cn();return e={current:e},n.memoizedState=e},useState:Hf,useDebugValue:oc,useDeferredValue:function(e){return Cn().memoizedState=e},useTransition:function(){var e=Hf(!1),n=e[0];return e=wv.bind(null,e[1]),Cn().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var i=lt,d=Cn();if(tt){if(s===void 0)throw Error(l(407));s=s()}else{if(s=n(),vt===null)throw Error(l(349));(Br&30)!==0||$f(i,n,s)}d.memoizedState=s;var m={value:s,getSnapshot:n};return d.queue=m,Gf(Uf.bind(null,i,m,e),[e]),i.flags|=2048,Ea(9,Bf.bind(null,i,m,s,n),void 0,null),s},useId:function(){var e=Cn(),n=vt.identifierPrefix;if(tt){var s=Ln,i=Dn;s=(i&~(1<<32-dn(i)-1)).toString(32)+s,n=":"+n+"R"+s,s=Ca++,0<\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=S.createElement(s,{is:i.is}):(e=S.createElement(s),s==="select"&&(S=e,i.multiple?S.multiple=!0:i.size&&(S.size=i.size))):e=S.createElementNS(e,s),e[wn]=n,e[va]=i,Sh(e,n,!1,!1),n.stateNode=e;e:{switch(S=Zi(s,i),s){case"dialog":Xe("cancel",e),Xe("close",e),d=i;break;case"iframe":case"object":case"embed":Xe("load",e),d=i;break;case"video":case"audio":for(d=0;dEs&&(n.flags|=128,i=!0,Pa(m,!1),n.lanes=4194304)}else{if(!i)if(e=Pl(S),e!==null){if(n.flags|=128,i=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),Pa(m,!0),m.tail===null&&m.tailMode==="hidden"&&!S.alternate&&!tt)return kt(n),null}else 2*ct()-m.renderingStartTime>Es&&s!==1073741824&&(n.flags|=128,i=!0,Pa(m,!1),n.lanes=4194304);m.isBackwards?(S.sibling=n.child,n.child=S):(s=m.last,s!==null?s.sibling=S:n.child=S,m.last=S)}return m.tail!==null?(n=m.tail,m.rendering=n,m.tail=n.sibling,m.renderingStartTime=ct(),n.sibling=null,s=at.current,qe(at,i?s&1|2:s&1),n):(kt(n),null);case 22:case 23:return Ic(),i=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(n.flags|=8192),i&&(n.mode&1)!==0?(Yt&1073741824)!==0&&(kt(n),n.subtreeFlags&6&&(n.flags|=8192)):kt(n),null;case 24:return null;case 25:return null}throw Error(l(156,n.tag))}function Mv(e,n){switch(Bo(n),n.tag){case 1:return Lt(n.type)&&gl(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ws(),Je(Dt),Je(St),ec(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Jo(n),null;case 13:if(Je(at),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));ys()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Je(at),null;case 4:return ws(),null;case 10:return Go(n.type._context),null;case 22:case 23:return Ic(),null;case 24:return null;default:return null}}var Ol=!1,Et=!1,Dv=typeof WeakSet=="function"?WeakSet:Set,ve=null;function Cs(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(i){it(e,n,i)}else s.current=null}function jc(e,n,s){try{s()}catch(i){it(e,n,i)}}var Eh=!1;function Lv(e,n){if(Io=rl,e=sf(),So(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var i=s.getSelection&&s.getSelection();if(i&&i.rangeCount!==0){s=i.anchorNode;var d=i.anchorOffset,m=i.focusNode;i=i.focusOffset;try{s.nodeType,m.nodeType}catch{s=null;break e}var S=0,M=-1,O=-1,G=0,ie=0,de=e,ae=null;t:for(;;){for(var ge;de!==s||d!==0&&de.nodeType!==3||(M=S+d),de!==m||i!==0&&de.nodeType!==3||(O=S+i),de.nodeType===3&&(S+=de.nodeValue.length),(ge=de.firstChild)!==null;)ae=de,de=ge;for(;;){if(de===e)break t;if(ae===s&&++G===d&&(M=S),ae===m&&++ie===i&&(O=S),(ge=de.nextSibling)!==null)break;de=ae,ae=de.parentNode}de=ge}s=M===-1||O===-1?null:{start:M,end:O}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ao={focusedElem:e,selectionRange:s},rl=!1,ve=n;ve!==null;)if(n=ve,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ve=e;else for(;ve!==null;){n=ve;try{var je=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(je!==null){var Se=je.memoizedProps,dt=je.memoizedState,U=n.stateNode,z=U.getSnapshotBeforeUpdate(n.elementType===n.type?Se:hn(n.type,Se),dt);U.__reactInternalSnapshotBeforeUpdate=z}break;case 3:var H=n.stateNode.containerInfo;H.nodeType===1?H.textContent="":H.nodeType===9&&H.documentElement&&H.removeChild(H.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(fe){it(n,n.return,fe)}if(e=n.sibling,e!==null){e.return=n.return,ve=e;break}ve=n.return}return je=Eh,Eh=!1,je}function Ra(e,n,s){var i=n.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&e)===e){var m=d.destroy;d.destroy=void 0,m!==void 0&&jc(n,s,m)}d=d.next}while(d!==i)}}function Fl(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 i=s.create;s.destroy=i()}s=s.next}while(s!==n)}}function Nc(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 Ph(e){var n=e.alternate;n!==null&&(e.alternate=null,Ph(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[wn],delete n[va],delete n[Oo],delete n[vv],delete n[yv])),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 Rh(e){return e.tag===5||e.tag===3||e.tag===4}function _h(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rh(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 bc(e,n,s){var i=e.tag;if(i===5||i===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=pl));else if(i!==4&&(e=e.child,e!==null))for(bc(e,n,s),e=e.sibling;e!==null;)bc(e,n,s),e=e.sibling}function wc(e,n,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(wc(e,n,s),e=e.sibling;e!==null;)wc(e,n,s),e=e.sibling}var bt=null,mn=!1;function dr(e,n,s){for(s=s.child;s!==null;)Th(e,n,s),s=s.sibling}function Th(e,n,s){if(bn&&typeof bn.onCommitFiberUnmount=="function")try{bn.onCommitFiberUnmount(Xa,s)}catch{}switch(s.tag){case 5:Et||Cs(s,n);case 6:var i=bt,d=mn;bt=null,dr(e,n,s),bt=i,mn=d,bt!==null&&(mn?(e=bt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):bt.removeChild(s.stateNode));break;case 18:bt!==null&&(mn?(e=bt,s=s.stateNode,e.nodeType===8?Lo(e.parentNode,s):e.nodeType===1&&Lo(e,s),ia(e)):Lo(bt,s.stateNode));break;case 4:i=bt,d=mn,bt=s.stateNode.containerInfo,mn=!0,dr(e,n,s),bt=i,mn=d;break;case 0:case 11:case 14:case 15:if(!Et&&(i=s.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){d=i=i.next;do{var m=d,S=m.destroy;m=m.tag,S!==void 0&&((m&2)!==0||(m&4)!==0)&&jc(s,n,S),d=d.next}while(d!==i)}dr(e,n,s);break;case 1:if(!Et&&(Cs(s,n),i=s.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=s.memoizedProps,i.state=s.memoizedState,i.componentWillUnmount()}catch(M){it(s,n,M)}dr(e,n,s);break;case 21:dr(e,n,s);break;case 22:s.mode&1?(Et=(i=Et)||s.memoizedState!==null,dr(e,n,s),Et=i):dr(e,n,s);break;default:dr(e,n,s)}}function Ih(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Dv),n.forEach(function(i){var d=Hv.bind(null,e,i);s.has(i)||(s.add(i),i.then(d,d))})}}function pn(e,n){var s=n.deletions;if(s!==null)for(var i=0;id&&(d=S),i&=~m}if(i=d,i=ct()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Fv(i/1960))-i,10e?16:e,fr===null)var i=!1;else{if(e=fr,fr=null,Vl=0,(Ve&6)!==0)throw Error(l(331));var d=Ve;for(Ve|=4,ve=e.current;ve!==null;){var m=ve,S=m.child;if((ve.flags&16)!==0){var M=m.deletions;if(M!==null){for(var O=0;Oct()-kc?Wr(e,0):Cc|=s),zt(e,n)}function Hh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Za,Za<<=1,(Za&130023424)===0&&(Za=4194304)));var s=Tt();e=On(e,n),e!==null&&(na(e,n,s),zt(e,s))}function Wv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Hh(e,s)}function Hv(e,n){var s=0;switch(e.tag){case 13:var i=e.stateNode,d=e.memoizedState;d!==null&&(s=d.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(l(314))}i!==null&&i.delete(n),Hh(e,s)}var Kh;Kh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||Dt.current)Ot=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return Ot=!1,Iv(e,n,s);Ot=(e.flags&131072)!==0}else Ot=!1,tt&&(n.flags&1048576)!==0&&Cf(n,Nl,n.index);switch(n.lanes=0,n.tag){case 2:var i=n.type;Ll(e,n),e=n.pendingProps;var d=xs(n,St.current);bs(n,s),d=rc(null,n,i,e,d,s);var m=sc();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,Lt(i)?(m=!0,vl(n)):m=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,qo(n),d.updater=Ml,n.stateNode=d,d._reactInternals=n,dc(n,i,e,s),n=mc(null,n,i,!0,m,s)):(n.tag=0,tt&&m&&$o(n),_t(null,n,d,s),n=n.child),n;case 16:i=n.elementType;e:{switch(Ll(e,n),e=n.pendingProps,d=i._init,i=d(i._payload),n.type=i,d=n.tag=Gv(i),e=hn(i,e),d){case 0:n=hc(null,n,i,e,s);break e;case 1:n=vh(null,n,i,e,s);break e;case 11:n=hh(null,n,i,e,s);break e;case 14:n=mh(null,n,i,hn(i.type,e),s);break e}throw Error(l(306,i,""))}return n;case 0:return i=n.type,d=n.pendingProps,d=n.elementType===i?d:hn(i,d),hc(e,n,i,d,s);case 1:return i=n.type,d=n.pendingProps,d=n.elementType===i?d:hn(i,d),vh(e,n,i,d,s);case 3:e:{if(yh(n),e===null)throw Error(l(387));i=n.pendingProps,m=n.memoizedState,d=m.element,Mf(e,n),El(n,i,null,s);var S=n.memoizedState;if(i=S.element,m.isDehydrated)if(m={element:i,isDehydrated:!1,cache:S.cache,pendingSuspenseBoundaries:S.pendingSuspenseBoundaries,transitions:S.transitions},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){d=Ss(Error(l(423)),n),n=jh(e,n,i,s,d);break e}else if(i!==d){d=Ss(Error(l(424)),n),n=jh(e,n,i,s,d);break e}else for(Gt=sr(n.stateNode.containerInfo.firstChild),Kt=n,tt=!0,fn=null,s=If(n,null,i,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ys(),i===d){n=zn(e,n,s);break e}_t(e,n,i,s)}n=n.child}return n;case 5:return Of(n),e===null&&Vo(n),i=n.type,d=n.pendingProps,m=e!==null?e.memoizedProps:null,S=d.children,Mo(i,d)?S=null:m!==null&&Mo(i,m)&&(n.flags|=32),gh(e,n),_t(e,n,S,s),n.child;case 6:return e===null&&Vo(n),null;case 13:return Nh(e,n,s);case 4:return Xo(n,n.stateNode.containerInfo),i=n.pendingProps,e===null?n.child=js(n,null,i,s):_t(e,n,i,s),n.child;case 11:return i=n.type,d=n.pendingProps,d=n.elementType===i?d:hn(i,d),hh(e,n,i,d,s);case 7:return _t(e,n,n.pendingProps,s),n.child;case 8:return _t(e,n,n.pendingProps.children,s),n.child;case 12:return _t(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(i=n.type._context,d=n.pendingProps,m=n.memoizedProps,S=d.value,qe(Sl,i._currentValue),i._currentValue=S,m!==null)if(un(m.value,S)){if(m.children===d.children&&!Dt.current){n=zn(e,n,s);break e}}else for(m=n.child,m!==null&&(m.return=n);m!==null;){var M=m.dependencies;if(M!==null){S=m.child;for(var O=M.firstContext;O!==null;){if(O.context===i){if(m.tag===1){O=Fn(-1,s&-s),O.tag=2;var G=m.updateQueue;if(G!==null){G=G.shared;var ie=G.pending;ie===null?O.next=O:(O.next=ie.next,ie.next=O),G.pending=O}}m.lanes|=s,O=m.alternate,O!==null&&(O.lanes|=s),Yo(m.return,s,n),M.lanes|=s;break}O=O.next}}else if(m.tag===10)S=m.type===n.type?null:m.child;else if(m.tag===18){if(S=m.return,S===null)throw Error(l(341));S.lanes|=s,M=S.alternate,M!==null&&(M.lanes|=s),Yo(S,s,n),S=m.sibling}else S=m.child;if(S!==null)S.return=m;else for(S=m;S!==null;){if(S===n){S=null;break}if(m=S.sibling,m!==null){m.return=S.return,S=m;break}S=S.return}m=S}_t(e,n,d.children,s),n=n.child}return n;case 9:return d=n.type,i=n.pendingProps.children,bs(n,s),d=en(d),i=i(d),n.flags|=1,_t(e,n,i,s),n.child;case 14:return i=n.type,d=hn(i,n.pendingProps),d=hn(i.type,d),mh(e,n,i,d,s);case 15:return ph(e,n,n.type,n.pendingProps,s);case 17:return i=n.type,d=n.pendingProps,d=n.elementType===i?d:hn(i,d),Ll(e,n),n.tag=1,Lt(i)?(e=!0,vl(n)):e=!1,bs(n,s),lh(n,i,d),dc(n,i,d,s),mc(null,n,i,!0,e,s);case 19:return wh(e,n,s);case 22:return xh(e,n,s)}throw Error(l(156,n.tag))};function Gh(e,n){return Cu(e,n)}function Kv(e,n,s,i){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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rn(e,n,s,i){return new Kv(e,n,s,i)}function Mc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gv(e){if(typeof e=="function")return Mc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===J)return 11;if(e===le)return 14}return 2}function pr(e,n){var s=e.alternate;return s===null?(s=rn(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 Gl(e,n,s,i,d,m){var S=2;if(i=e,typeof e=="function")Mc(e)&&(S=1);else if(typeof e=="string")S=5;else e:switch(e){case R:return Kr(s.children,d,m,n);case T:S=8,d|=8;break;case F:return e=rn(12,s,n,d|2),e.elementType=F,e.lanes=m,e;case ce:return e=rn(13,s,n,d),e.elementType=ce,e.lanes=m,e;case X:return e=rn(19,s,n,d),e.elementType=X,e.lanes=m,e;case q:return Yl(s,d,m,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Y:S=10;break e;case K:S=9;break e;case J:S=11;break e;case le:S=14;break e;case ee:S=16,i=null;break e}throw Error(l(130,e==null?e:typeof e,""))}return n=rn(S,s,n,d),n.elementType=e,n.type=i,n.lanes=m,n}function Kr(e,n,s,i){return e=rn(7,e,i,n),e.lanes=s,e}function Yl(e,n,s,i){return e=rn(22,e,i,n),e.elementType=q,e.lanes=s,e.stateNode={isHidden:!1},e}function Dc(e,n,s){return e=rn(6,e,null,n),e.lanes=s,e}function Lc(e,n,s){return n=rn(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Yv(e,n,s,i,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=oo(0),this.expirationTimes=oo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=oo(0),this.identifierPrefix=i,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Oc(e,n,s,i,d,m,S,M,O){return e=new Yv(e,n,s,M,O),n===1?(n=1,m===!0&&(n|=8)):n=0,m=rn(3,null,null,n),e.current=m,m.stateNode=e,m.memoizedState={element:i,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},qo(m),e}function Qv(e,n,s){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(a){console.error(a)}}return r(),Vc.exports=iy(),Vc.exports}var im;function oy(){if(im)return ti;im=1;var r=dp();return ti.createRoot=r.createRoot,ti.hydrateRoot=r.hydrateRoot,ti}var cy=oy(),Ua=dp();const dy=cp(Ua);/** - * @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 Oa(){return Oa=Object.assign?Object.assign.bind():function(r){for(var a=1;a"u")throw new Error(a)}function Md(r,a){if(!r){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function fy(){return Math.random().toString(36).substr(2,8)}function cm(r,a){return{usr:r.state,key:r.key,idx:a}}function dd(r,a,l,o){return l===void 0&&(l=null),Oa({pathname:typeof r=="string"?r:r.pathname,search:"",hash:""},typeof a=="string"?$s(a):a,{state:l,key:a&&a.key||o||fy()})}function vi(r){let{pathname:a="/",search:l="",hash:o=""}=r;return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(a+=o.charAt(0)==="#"?o:"#"+o),a}function $s(r){let a={};if(r){let l=r.indexOf("#");l>=0&&(a.hash=r.substr(l),r=r.substr(0,l));let o=r.indexOf("?");o>=0&&(a.search=r.substr(o),r=r.substr(0,o)),r&&(a.pathname=r)}return a}function hy(r,a,l,o){o===void 0&&(o={});let{window:c=document.defaultView,v5Compat:u=!1}=o,f=c.history,p=Nr.Pop,x=null,g=v();g==null&&(g=0,f.replaceState(Oa({},f.state,{idx:g}),""));function v(){return(f.state||{idx:null}).idx}function y(){p=Nr.Pop;let j=v(),b=j==null?null:j-g;g=j,x&&x({action:p,location:w.location,delta:b})}function E(j,b){p=Nr.Push;let C=dd(w.location,j,b);g=v()+1;let N=cm(C,g),A=w.createHref(C);try{f.pushState(N,"",A)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;c.location.assign(A)}u&&x&&x({action:p,location:w.location,delta:1})}function _(j,b){p=Nr.Replace;let C=dd(w.location,j,b);g=v();let N=cm(C,g),A=w.createHref(C);f.replaceState(N,"",A),u&&x&&x({action:p,location:w.location,delta:0})}function k(j){let b=c.location.origin!=="null"?c.location.origin:c.location.href,C=typeof j=="string"?j:vi(j);return C=C.replace(/ $/,"%20"),ut(b,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,b)}let w={get action(){return p},get location(){return r(c,f)},listen(j){if(x)throw new Error("A history only accepts one active listener");return c.addEventListener(om,y),x=j,()=>{c.removeEventListener(om,y),x=null}},createHref(j){return a(c,j)},createURL:k,encodeLocation(j){let b=k(j);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:E,replace:_,go(j){return f.go(j)}};return w}var dm;(function(r){r.data="data",r.deferred="deferred",r.redirect="redirect",r.error="error"})(dm||(dm={}));function my(r,a,l){return l===void 0&&(l="/"),py(r,a,l)}function py(r,a,l,o){let c=typeof a=="string"?$s(a):a,u=Dd(c.pathname||"/",l);if(u==null)return null;let f=up(r);xy(f);let p=null;for(let x=0;p==null&&x{let x={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};x.relativePath.startsWith("/")&&(ut(x.relativePath.startsWith(o),'Absolute route path "'+x.relativePath+'" nested under path '+('"'+o+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),x.relativePath=x.relativePath.slice(o.length));let g=br([o,x.relativePath]),v=l.concat(x);u.children&&u.children.length>0&&(ut(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),up(u.children,a,v,g)),!(u.path==null&&!u.index)&&a.push({path:g,score:wy(g,u.index),routesMeta:v})};return r.forEach((u,f)=>{var p;if(u.path===""||!((p=u.path)!=null&&p.includes("?")))c(u,f);else for(let x of fp(u.path))c(u,f,x)}),a}function fp(r){let a=r.split("/");if(a.length===0)return[];let[l,...o]=a,c=l.endsWith("?"),u=l.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let f=fp(o.join("/")),p=[];return p.push(...f.map(x=>x===""?u:[u,x].join("/"))),c&&p.push(...f),p.map(x=>r.startsWith("/")&&x===""?"/":x)}function xy(r){r.sort((a,l)=>a.score!==l.score?l.score-a.score:Sy(a.routesMeta.map(o=>o.childrenIndex),l.routesMeta.map(o=>o.childrenIndex)))}const gy=/^:[\w-]+$/,vy=3,yy=2,jy=1,Ny=10,by=-2,um=r=>r==="*";function wy(r,a){let l=r.split("/"),o=l.length;return l.some(um)&&(o+=by),a&&(o+=yy),l.filter(c=>!um(c)).reduce((c,u)=>c+(gy.test(u)?vy:u===""?jy:Ny),o)}function Sy(r,a){return r.length===a.length&&r.slice(0,-1).every((o,c)=>o===a[c])?r[r.length-1]-a[a.length-1]:0}function Cy(r,a,l){let{routesMeta:o}=r,c={},u="/",f=[];for(let p=0;p{let{paramName:E,isOptional:_}=v;if(E==="*"){let w=p[y]||"";f=u.slice(0,u.length-w.length).replace(/(.)\/+$/,"$1")}const k=p[y];return _&&!k?g[E]=void 0:g[E]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:f,pattern:r}}function Ey(r,a,l){a===void 0&&(a=!1),l===void 0&&(l=!0),Md(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 o=[],c="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,p,x)=>(o.push({paramName:p,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)"));return r.endsWith("*")?(o.push({paramName:"*"}),c+=r==="*"||r==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?c+="\\/*$":r!==""&&r!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),o]}function Py(r){try{return r.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Md(!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 Dd(r,a){if(a==="/")return r;if(!r.toLowerCase().startsWith(a.toLowerCase()))return null;let l=a.endsWith("/")?a.length-1:a.length,o=r.charAt(l);return o&&o!=="/"?null:r.slice(l)||"/"}const Ry=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_y=r=>Ry.test(r);function Ty(r,a){a===void 0&&(a="/");let{pathname:l,search:o="",hash:c=""}=typeof r=="string"?$s(r):r,u;if(l)if(_y(l))u=l;else{if(l.includes("//")){let f=l;l=l.replace(/\/\/+/g,"/"),Md(!1,"Pathnames cannot have embedded double slashes - normalizing "+(f+" -> "+l))}l.startsWith("/")?u=fm(l.substring(1),"/"):u=fm(l,a)}else u=a;return{pathname:u,search:My(o),hash:Dy(c)}}function fm(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 Kc(r,a,l,o){return"Cannot include a '"+r+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(o)+"]. 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 Iy(r){return r.filter((a,l)=>l===0||a.route.path&&a.route.path.length>0)}function Ld(r,a){let l=Iy(r);return a?l.map((o,c)=>c===l.length-1?o.pathname:o.pathnameBase):l.map(o=>o.pathnameBase)}function Od(r,a,l,o){o===void 0&&(o=!1);let c;typeof r=="string"?c=$s(r):(c=Oa({},r),ut(!c.pathname||!c.pathname.includes("?"),Kc("?","pathname","search",c)),ut(!c.pathname||!c.pathname.includes("#"),Kc("#","pathname","hash",c)),ut(!c.search||!c.search.includes("#"),Kc("#","search","hash",c)));let u=r===""||c.pathname==="",f=u?"/":c.pathname,p;if(f==null)p=l;else{let y=a.length-1;if(!o&&f.startsWith("..")){let E=f.split("/");for(;E[0]==="..";)E.shift(),y-=1;c.pathname=E.join("/")}p=y>=0?a[y]:"/"}let x=Ty(c,p),g=f&&f!=="/"&&f.endsWith("/"),v=(u||f===".")&&l.endsWith("/");return!x.pathname.endsWith("/")&&(g||v)&&(x.pathname+="/"),x}const br=r=>r.join("/").replace(/\/\/+/g,"/"),Ay=r=>r.replace(/\/+$/,"").replace(/^\/*/,"/"),My=r=>!r||r==="?"?"":r.startsWith("?")?r:"?"+r,Dy=r=>!r||r==="#"?"":r.startsWith("#")?r:"#"+r;function Ly(r){return r!=null&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.internal=="boolean"&&"data"in r}const hp=["post","put","patch","delete"];new Set(hp);const Oy=["get",...hp];new Set(Oy);/** - * 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 Fa(){return Fa=Object.assign?Object.assign.bind():function(r){for(var a=1;a{p.current=!0}),h.useCallback(function(g,v){if(v===void 0&&(v={}),!p.current)return;if(typeof g=="number"){o.go(g);return}let y=Od(g,JSON.parse(f),u,v.relative==="path");r==null&&a!=="/"&&(y.pathname=y.pathname==="/"?a:br([a,y.pathname])),(v.replace?o.replace:o.push)(y,v.state,v)},[a,o,f,u,r])}const By=h.createContext(null);function Uy(r){let a=h.useContext(Gn).outlet;return a&&h.createElement(By.Provider,{value:r},a)}function xp(r,a){let{relative:l}=a===void 0?{}:a,{future:o}=h.useContext(Pr),{matches:c}=h.useContext(Gn),{pathname:u}=rs(),f=JSON.stringify(Ld(c,o.v7_relativeSplatPath));return h.useMemo(()=>Od(r,JSON.parse(f),u,l==="path"),[r,f,u,l])}function Vy(r,a){return Wy(r,a)}function Wy(r,a,l,o){Bs()||ut(!1);let{navigator:c}=h.useContext(Pr),{matches:u}=h.useContext(Gn),f=u[u.length-1],p=f?f.params:{};f&&f.pathname;let x=f?f.pathnameBase:"/";f&&f.route;let g=rs(),v;if(a){var y;let j=typeof a=="string"?$s(a):a;x==="/"||(y=j.pathname)!=null&&y.startsWith(x)||ut(!1),v=j}else v=g;let E=v.pathname||"/",_=E;if(x!=="/"){let j=x.replace(/^\//,"").split("/");_="/"+E.replace(/^\//,"").split("/").slice(j.length).join("/")}let k=my(r,{pathname:_}),w=Qy(k&&k.map(j=>Object.assign({},j,{params:Object.assign({},p,j.params),pathname:br([x,c.encodeLocation?c.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?x:br([x,c.encodeLocation?c.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),u,l,o);return a&&w?h.createElement(Ai.Provider,{value:{location:Fa({pathname:"/",search:"",hash:"",state:null,key:"default"},v),navigationType:Nr.Pop}},w):w}function Hy(){let r=Zy(),a=Ly(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 h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},a),l?h.createElement("pre",{style:c},l):null,null)}const Ky=h.createElement(Hy,null);class Gy extends h.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?h.createElement(Gn.Provider,{value:this.props.routeContext},h.createElement(mp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Yy(r){let{routeContext:a,match:l,children:o}=r,c=h.useContext(Fd);return c&&c.static&&c.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=l.route.id),h.createElement(Gn.Provider,{value:a},o)}function Qy(r,a,l,o){var c;if(a===void 0&&(a=[]),l===void 0&&(l=null),o===void 0&&(o=null),r==null){var u;if(!l)return null;if(l.errors)r=l.matches;else if((u=o)!=null&&u.v7_partialHydration&&a.length===0&&!l.initialized&&l.matches.length>0)r=l.matches;else return null}let f=r,p=(c=l)==null?void 0:c.errors;if(p!=null){let v=f.findIndex(y=>y.route.id&&(p==null?void 0:p[y.route.id])!==void 0);v>=0||ut(!1),f=f.slice(0,Math.min(f.length,v+1))}let x=!1,g=-1;if(l&&o&&o.v7_partialHydration)for(let v=0;v=0?f=f.slice(0,g+1):f=[f[0]];break}}}return f.reduceRight((v,y,E)=>{let _,k=!1,w=null,j=null;l&&(_=p&&y.route.id?p[y.route.id]:void 0,w=y.route.errorElement||Ky,x&&(g<0&&E===0?(tj("route-fallback"),k=!0,j=null):g===E&&(k=!0,j=y.route.hydrateFallbackElement||null)));let b=a.concat(f.slice(0,E+1)),C=()=>{let N;return _?N=w:k?N=j:y.route.Component?N=h.createElement(y.route.Component,null):y.route.element?N=y.route.element:N=v,h.createElement(Yy,{match:y,routeContext:{outlet:v,matches:b,isDataRoute:l!=null},children:N})};return l&&(y.route.ErrorBoundary||y.route.errorElement||E===0)?h.createElement(Gy,{location:l.location,revalidation:l.revalidation,component:w,error:_,children:C(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):C()},null)}var gp=(function(r){return r.UseBlocker="useBlocker",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r})(gp||{}),vp=(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})(vp||{});function qy(r){let a=h.useContext(Fd);return a||ut(!1),a}function Xy(r){let a=h.useContext(Fy);return a||ut(!1),a}function Jy(r){let a=h.useContext(Gn);return a||ut(!1),a}function yp(r){let a=Jy(),l=a.matches[a.matches.length-1];return l.route.id||ut(!1),l.route.id}function Zy(){var r;let a=h.useContext(mp),l=Xy(),o=yp();return a!==void 0?a:(r=l.errors)==null?void 0:r[o]}function ej(){let{router:r}=qy(gp.UseNavigateStable),a=yp(vp.UseNavigateStable),l=h.useRef(!1);return pp(()=>{l.current=!0}),h.useCallback(function(c,u){u===void 0&&(u={}),l.current&&(typeof c=="number"?r.navigate(c):r.navigate(c,Fa({fromRouteId:a},u)))},[r,a])}const hm={};function tj(r,a,l){hm[r]||(hm[r]=!0)}function nj(r,a){r==null||r.v7_startTransition,r==null||r.v7_relativeSplatPath}function rj(r){let{to:a,replace:l,state:o,relative:c}=r;Bs()||ut(!1);let{future:u,static:f}=h.useContext(Pr),{matches:p}=h.useContext(Gn),{pathname:x}=rs(),g=Va(),v=Od(a,Ld(p,u.v7_relativeSplatPath),x,c==="path"),y=JSON.stringify(v);return h.useEffect(()=>g(JSON.parse(y),{replace:l,state:o,relative:c}),[g,y,c,l,o]),null}function sj(r){return Uy(r.context)}function nt(r){ut(!1)}function aj(r){let{basename:a="/",children:l=null,location:o,navigationType:c=Nr.Pop,navigator:u,static:f=!1,future:p}=r;Bs()&&ut(!1);let x=a.replace(/^\/*/,"/"),g=h.useMemo(()=>({basename:x,navigator:u,static:f,future:Fa({v7_relativeSplatPath:!1},p)}),[x,p,u,f]);typeof o=="string"&&(o=$s(o));let{pathname:v="/",search:y="",hash:E="",state:_=null,key:k="default"}=o,w=h.useMemo(()=>{let j=Dd(v,x);return j==null?null:{location:{pathname:j,search:y,hash:E,state:_,key:k},navigationType:c}},[x,v,y,E,_,k,c]);return w==null?null:h.createElement(Pr.Provider,{value:g},h.createElement(Ai.Provider,{children:l,value:w}))}function lj(r){let{children:a,location:l}=r;return Vy(ud(a),l)}new Promise(()=>{});function ud(r,a){a===void 0&&(a=[]);let l=[];return h.Children.forEach(r,(o,c)=>{if(!h.isValidElement(o))return;let u=[...a,c];if(o.type===h.Fragment){l.push.apply(l,ud(o.props.children,u));return}o.type!==nt&&ut(!1),!o.props.index||!o.props.children||ut(!1);let f={id:o.props.id||u.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,loader:o.props.loader,action:o.props.action,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(f.children=ud(o.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 fd(){return fd=Object.assign?Object.assign.bind():function(r){for(var a=1;a=0)&&(l[c]=r[c]);return l}function oj(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function cj(r,a){return r.button===0&&(!a||a==="_self")&&!oj(r)}const dj=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],uj="6";try{window.__reactRouterVersion=uj}catch{}const fj="startTransition",mm=Ii[fj];function hj(r){let{basename:a,children:l,future:o,window:c}=r,u=h.useRef();u.current==null&&(u.current=uy({window:c,v5Compat:!0}));let f=u.current,[p,x]=h.useState({action:f.action,location:f.location}),{v7_startTransition:g}=o||{},v=h.useCallback(y=>{g&&mm?mm(()=>x(y)):x(y)},[x,g]);return h.useLayoutEffect(()=>f.listen(v),[f,v]),h.useEffect(()=>nj(o),[o]),h.createElement(aj,{basename:a,children:l,location:p.location,navigationType:p.action,navigator:f,future:o})}const mj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fi=h.forwardRef(function(a,l){let{onClick:o,relative:c,reloadDocument:u,replace:f,state:p,target:x,to:g,preventScrollReset:v,viewTransition:y}=a,E=ij(a,dj),{basename:_}=h.useContext(Pr),k,w=!1;if(typeof g=="string"&&pj.test(g)&&(k=g,mj))try{let N=new URL(window.location.href),A=g.startsWith("//")?new URL(N.protocol+g):new URL(g),$=Dd(A.pathname,_);A.origin===N.origin&&$!=null?g=$+A.search+A.hash:w=!0}catch{}let j=zy(g,{relative:c}),b=xj(g,{replace:f,state:p,target:x,preventScrollReset:v,relative:c,viewTransition:y});function C(N){o&&o(N),N.defaultPrevented||b(N)}return h.createElement("a",fd({},E,{href:k||j,onClick:w||u?o:C,ref:l,target:x}))});var pm;(function(r){r.UseScrollRestoration="useScrollRestoration",r.UseSubmit="useSubmit",r.UseSubmitFetcher="useSubmitFetcher",r.UseFetcher="useFetcher",r.useViewTransitionState="useViewTransitionState"})(pm||(pm={}));var xm;(function(r){r.UseFetcher="useFetcher",r.UseFetchers="useFetchers",r.UseScrollRestoration="useScrollRestoration"})(xm||(xm={}));function xj(r,a){let{target:l,replace:o,state:c,preventScrollReset:u,relative:f,viewTransition:p}=a===void 0?{}:a,x=Va(),g=rs(),v=xp(r,{relative:f});return h.useCallback(y=>{if(cj(y,l)){y.preventDefault();let E=o!==void 0?o:vi(g)===vi(v);x(r,{replace:E,state:c,preventScrollReset:u,relative:f,viewTransition:p})}},[g,x,v,o,c,l,r,u,f,p])}/** - * @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 gj=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vj=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,l,o)=>o?o.toUpperCase():l.toLowerCase()),gm=r=>{const a=vj(r);return a.charAt(0).toUpperCase()+a.slice(1)},jp=(...r)=>r.filter((a,l,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===l).join(" ").trim(),yj=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 jj={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 Nj=h.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:f,...p},x)=>h.createElement("svg",{ref:x,...jj,width:a,height:a,stroke:r,strokeWidth:o?Number(l)*24/Number(a):l,className:jp("lucide",c),...!u&&!yj(p)&&{"aria-hidden":"true"},...p},[...f.map(([g,v])=>h.createElement(g,v)),...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 ye=(r,a)=>{const l=h.forwardRef(({className:o,...c},u)=>h.createElement(Nj,{ref:u,iconNode:a,className:jp(`lucide-${gj(gm(r))}`,`lucide-${r}`,o),...c}));return l.displayName=gm(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 bj=[["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"}]],vm=ye("bitcoin",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 wj=[["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"}]],Wn=ye("book-open",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 Sj=[["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"}]],za=ye("calendar",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 Cj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mi=ye("check",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 kj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Di=ye("chevron-down",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 Ej=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],As=ye("chevron-right",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 Pj=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Np=ye("chevron-up",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=[["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"}]],_j=ye("circle-alert",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 Tj=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ym=ye("circle-check-big",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 Ij=[["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"}]],bp=ye("circle-question-mark",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=[["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"}]],jm=ye("circle-user",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=[["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"}]],Dj=ye("circle-x",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 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wp=ye("clock",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=[["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"}]],Sp=ye("copy",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 Fj=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],hd=ye("credit-card",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:"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"}]],Li=ye("crown",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=[["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"}]],yi=ye("dollar-sign",$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:"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"}]],Uj=ye("download",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 Vj=[["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"}]],ji=ye("external-link",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 Wj=[["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"}]],Ms=ye("eye",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 Hj=[["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"}]],Kj=ye("file-text",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 Gj=[["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"}]],Yj=ye("funnel",Gj);/** - * @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 Qj=[["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"}]],qj=ye("gift",Qj);/** - * @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=[["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"}]],Jj=ye("git-merge",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 Zj=[["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"}]],md=ye("globe",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 eN=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],tN=ye("graduation-cap",eN);/** - * @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 nN=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Gc=ye("grip-vertical",nN);/** - * @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 rN=[["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"}]],Nm=ye("history",rN);/** - * @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 sN=[["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"}]],aN=ye("house",sN);/** - * @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 lN=[["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"}]],Cp=ye("image",lN);/** - * @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 iN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ni=ye("info",iN);/** - * @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 oN=[["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"}]],bm=ye("key",oN);/** - * @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 cN=[["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"}]],dN=ye("layout-dashboard",cN);/** - * @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 uN=[["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"}]],Yr=ye("link-2",uN);/** - * @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 fN=[["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"}]],wm=ye("link",fN);/** - * @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 hN=[["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"}]],mN=ye("lock",hN);/** - * @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 pN=[["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"}]],xN=ye("log-out",pN);/** - * @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 gN=[["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"}]],vN=ye("map-pin",gN);/** - * @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 yN=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],jN=ye("menu",yN);/** - * @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 NN=[["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"}]],bN=ye("message-circle",NN);/** - * @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 wN=[["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"}]],SN=ye("palette",wN);/** - * @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 CN=[["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"}]],sn=ye("pen-line",CN);/** - * @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 kN=[["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"}]],EN=ye("percent",kN);/** - * @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 PN=[["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"}]],RN=ye("phone",PN);/** - * @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 _N=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Rn=ye("plus",_N);/** - * @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 TN=[["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"}]],Sm=ye("qr-code",TN);/** - * @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 IN=[["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"}]],Ze=ye("refresh-cw",IN);/** - * @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 AN=[["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"}]],Wt=ye("save",AN);/** - * @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 MN=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qr=ye("search",MN);/** - * @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 DN=[["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"}]],Ni=ye("settings",DN);/** - * @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 LN=[["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"}]],ON=ye("settings-2",LN);/** - * @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 FN=[["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"}]],zd=ye("shield-check",FN);/** - * @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 zN=[["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"}]],pd=ye("shopping-bag",zN);/** - * @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 $N=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],xd=ye("smartphone",$N);/** - * @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 BN=[["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"}]],UN=ye("tag",BN);/** - * @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 VN=[["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"}]],Vn=ye("trash-2",VN);/** - * @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 WN=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],gd=ye("trending-up",WN);/** - * @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 HN=[["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"}]],kp=ye("undo-2",HN);/** - * @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 KN=[["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"}]],bi=ye("upload",KN);/** - * @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 GN=[["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"}]],Cm=ye("user-plus",GN);/** - * @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 YN=[["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"}]],qr=ye("user",YN);/** - * @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 QN=[["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"}]],vn=ye("users",QN);/** - * @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 qN=[["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"}]],Os=ye("wallet",qN);/** - * @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 XN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],on=ye("x",XN);/** - * @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 JN=[["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"}]],ZN=ye("zap",JN),$d="admin_token";function Bd(){try{return localStorage.getItem($d)}catch{return null}}function eb(r){try{localStorage.setItem($d,r)}catch{}}function tb(){try{localStorage.removeItem($d)}catch{}}const nb="https://soulapi.quwanzhi.com",rb=()=>{const r="https://soulapi.quwanzhi.com";return r.length>0?r.replace(/\/$/,""):nb};function Fs(r){const a=rb(),l=r.startsWith("/")?r:`/${r}`;return a?`${a}${l}`:l}async function Oi(r,a={}){const{data:l,...o}=a,c=Fs(r),u=new Headers(o.headers),f=Bd();f&&u.set("Authorization",`Bearer ${f}`),l!=null&&!u.has("Content-Type")&&u.set("Content-Type","application/json");const p=l!=null?JSON.stringify(l):o.body,x=await fetch(c,{...o,headers:u,body:p,credentials:"include"}),v=(x.headers.get("Content-Type")||"").includes("application/json")?await x.json():x;if(!x.ok){const y=new Error((v==null?void 0:v.error)||`HTTP ${x.status}`);throw y.status=x.status,y.data=v,y}return v}function We(r,a){return Oi(r,{...a,method:"GET"})}function jt(r,a,l){return Oi(r,{...l,method:"POST",data:a})}function Pt(r,a,l){return Oi(r,{...l,method:"PUT",data:a})}function Wa(r,a){return Oi(r,{...a,method:"DELETE"})}const sb=[{icon:dN,label:"数据概览",href:"/dashboard"},{icon:Wn,label:"内容管理",href:"/content"},{icon:vn,label:"用户管理",href:"/users"}],km=[{icon:Li,label:"VIP 角色",href:"/vip-roles"},{icon:qr,label:"作者详情",href:"/author-settings"},{icon:zd,label:"管理员",href:"/admin-users"},{icon:tN,label:"导师管理",href:"/mentors"},{icon:za,label:"导师预约",href:"/mentor-consultations"},{icon:Os,label:"推广中心",href:"/distribution"},{icon:Jj,label:"匹配记录",href:"/match-records"},{icon:hd,label:"推广设置",href:"/referral-settings"}];function ab(){const r=rs(),a=Va(),[l,o]=h.useState(!1),[c,u]=h.useState(!1),[f,p]=h.useState(!1);h.useEffect(()=>{o(!0)},[]),h.useEffect(()=>{km.some(v=>r.pathname===v.href)&&p(!0)},[r.pathname]),h.useEffect(()=>{if(!l)return;u(!1);let g=!1;return We("/api/admin").then(v=>{g||(v&&v.success!==!1?u(!0):a("/login",{replace:!0}))}).catch(()=>{g||a("/login",{replace:!0})}),()=>{g=!0}},[l,a]);const x=async()=>{tb();try{await jt("/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.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[sb.map(g=>{const v=r.pathname===g.href;return t.jsxs(fi,{to:g.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${v?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(g.icon,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:g.label})]},g.href)}),t.jsx("button",{type:"button",onClick:()=>p(!f),className:"w-full flex items-center justify-between gap-3 px-4 py-3 text-gray-400 hover:bg-gray-700/50 hover:text-white rounded-lg transition-colors",children:t.jsxs("span",{className:"flex items-center gap-3",children:[f?t.jsx(Np,{className:"w-5 h-5"}):t.jsx(Di,{className:"w-5 h-5"}),t.jsx("span",{className:"text-sm",children:"更多"})]})}),f&&t.jsx("div",{className:"space-y-1 pl-4",children:km.map(g=>{const v=r.pathname===g.href;return t.jsxs(fi,{to:g.href,className:`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${v?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(g.icon,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:g.label})]},g.href)})}),t.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:t.jsxs(fi,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${r.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(Ni,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),t.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:t.jsxs("button",{type:"button",onClick:x,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(xN,{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(sj,{})})})]})}function Em(r,a){if(typeof r=="function")return r(a);r!=null&&(r.current=a)}function Ud(...r){return a=>{let l=!1;const o=r.map(c=>{const u=Em(c,a);return!l&&typeof u=="function"&&(l=!0),u});if(l)return()=>{for(let c=0;c{let{children:u,...f}=o;Ep(u)&&typeof wi=="function"&&(u=wi(u._payload));const p=h.Children.toArray(u),x=p.find(db);if(x){const g=x.props.children,v=p.map(y=>y===x?h.Children.count(g)>1?h.Children.only(null):h.isValidElement(g)?g.props.children:null:y);return t.jsx(a,{...f,ref:c,children:h.isValidElement(g)?h.cloneElement(g,void 0,v):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${r}.Slot`,l}var Rp=Pp("Slot");function ob(r){const a=h.forwardRef((l,o)=>{let{children:c,...u}=l;if(Ep(c)&&typeof wi=="function"&&(c=wi(c._payload)),h.isValidElement(c)){const f=fb(c),p=ub(u,c.props);return c.type!==h.Fragment&&(p.ref=o?Ud(o,f):f),h.cloneElement(c,p)}return h.Children.count(c)>1?h.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var cb=Symbol("radix.slottable");function db(r){return h.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===cb}function ub(r,a){const l={...a};for(const o in a){const c=r[o],u=a[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...p)=>{const x=u(...p);return c(...p),x}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...r,...l}}function fb(r){var o,c;let a=(o=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:o.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 _p(r){var a,l,o="";if(typeof r=="string"||typeof r=="number")o+=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,Rm=Tp,Ip=(r,a)=>l=>{var o;if((a==null?void 0:a.variants)==null)return Rm(r,l==null?void 0:l.class,l==null?void 0:l.className);const{variants:c,defaultVariants:u}=a,f=Object.keys(c).map(g=>{const v=l==null?void 0:l[g],y=u==null?void 0:u[g];if(v===null)return null;const E=Pm(v)||Pm(y);return c[g][E]}),p=l&&Object.entries(l).reduce((g,v)=>{let[y,E]=v;return E===void 0||(g[y]=E),g},{}),x=a==null||(o=a.compoundVariants)===null||o===void 0?void 0:o.reduce((g,v)=>{let{class:y,className:E,..._}=v;return Object.entries(_).every(k=>{let[w,j]=k;return Array.isArray(j)?j.includes({...u,...p}[w]):{...u,...p}[w]===j})?[...g,y,E]:g},[]);return Rm(r,f,x,l==null?void 0:l.class,l==null?void 0:l.className)},hb=(r,a)=>{const l=new Array(r.length+a.length);for(let o=0;o({classGroupId:r,validator:a}),Ap=(r=new Map,a=null,l)=>({nextPart:r,validators:a,classGroupId:l}),Si="-",_m=[],pb="arbitrary..",xb=r=>{const a=vb(r),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=r;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return gb(f);const p=f.split(Si),x=p[0]===""&&p.length>1?1:0;return Mp(p,x,a)},getConflictingClassGroupIds:(f,p)=>{if(p){const x=o[f],g=l[f];return x?g?hb(g,x):x:g||_m}return l[f]||_m}}},Mp=(r,a,l)=>{if(r.length-a===0)return l.classGroupId;const c=r[a],u=l.nextPart.get(c);if(u){const g=Mp(r,a+1,u);if(g)return g}const f=l.validators;if(f===null)return;const p=a===0?r.join(Si):r.slice(a).join(Si),x=f.length;for(let g=0;gr.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=r.slice(1,-1),l=a.indexOf(":"),o=a.slice(0,l);return o?pb+o:void 0})(),vb=r=>{const{theme:a,classGroups:l}=r;return yb(l,a)},yb=(r,a)=>{const l=Ap();for(const o in r){const c=r[o];Vd(c,l,o,a)}return l},Vd=(r,a,l,o)=>{const c=r.length;for(let u=0;u{if(typeof r=="string"){Nb(r,a,l);return}if(typeof r=="function"){bb(r,a,l,o);return}wb(r,a,l,o)},Nb=(r,a,l)=>{const o=r===""?a:Dp(a,r);o.classGroupId=l},bb=(r,a,l,o)=>{if(Sb(r)){Vd(r(o),a,l,o);return}a.validators===null&&(a.validators=[]),a.validators.push(mb(l,r))},wb=(r,a,l,o)=>{const c=Object.entries(r),u=c.length;for(let f=0;f{let l=r;const o=a.split(Si),c=o.length;for(let u=0;u"isThemeGetter"in r&&r.isThemeGetter===!0,Cb=r=>{if(r<1)return{get:()=>{},set:()=>{}};let a=0,l=Object.create(null),o=Object.create(null);const c=(u,f)=>{l[u]=f,a++,a>r&&(a=0,o=l,l=Object.create(null))};return{get(u){let f=l[u];if(f!==void 0)return f;if((f=o[u])!==void 0)return c(u,f),f},set(u,f){u in l?l[u]=f:c(u,f)}}},vd="!",Tm=":",kb=[],Im=(r,a,l,o,c)=>({modifiers:r,hasImportantModifier:a,baseClassName:l,maybePostfixModifierPosition:o,isExternal:c}),Eb=r=>{const{prefix:a,experimentalParseClassName:l}=r;let o=c=>{const u=[];let f=0,p=0,x=0,g;const v=c.length;for(let w=0;wx?g-x:void 0;return Im(u,_,E,k)};if(a){const c=a+Tm,u=o;o=f=>f.startsWith(c)?u(f.slice(c.length)):Im(kb,!1,f,void 0,!0)}if(l){const c=o;o=u=>l({className:u,parseClassName:c})}return o},Pb=r=>{const a=new Map;return r.orderSensitiveModifiers.forEach((l,o)=>{a.set(l,1e6+o)}),l=>{const o=[];let c=[];for(let u=0;u0&&(c.sort(),o.push(...c),c=[]),o.push(f)):c.push(f)}return c.length>0&&(c.sort(),o.push(...c)),o}},Rb=r=>({cache:Cb(r.cacheSize),parseClassName:Eb(r),sortModifiers:Pb(r),...xb(r)}),_b=/\s+/,Tb=(r,a)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:u}=a,f=[],p=r.trim().split(_b);let x="";for(let g=p.length-1;g>=0;g-=1){const v=p[g],{isExternal:y,modifiers:E,hasImportantModifier:_,baseClassName:k,maybePostfixModifierPosition:w}=l(v);if(y){x=v+(x.length>0?" "+x:x);continue}let j=!!w,b=o(j?k.substring(0,w):k);if(!b){if(!j){x=v+(x.length>0?" "+x:x);continue}if(b=o(k),!b){x=v+(x.length>0?" "+x:x);continue}j=!1}const C=E.length===0?"":E.length===1?E[0]:u(E).join(":"),N=_?C+vd:C,A=N+b;if(f.indexOf(A)>-1)continue;f.push(A);const $=c(b,j);for(let V=0;V<$.length;++V){const R=$[V];f.push(N+R)}x=v+(x.length>0?" "+x:x)}return x},Ib=(...r)=>{let a=0,l,o,c="";for(;a{if(typeof r=="string")return r;let a,l="";for(let o=0;o{let l,o,c,u;const f=x=>{const g=a.reduce((v,y)=>y(v),r());return l=Rb(g),o=l.cache.get,c=l.cache.set,u=p,p(x)},p=x=>{const g=o(x);if(g)return g;const v=Tb(x,l);return c(x,v),v};return u=f,(...x)=>u(Ib(...x))},Mb=[],xt=r=>{const a=l=>l[r]||Mb;return a.isThemeGetter=!0,a},Op=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Db=/^\d+\/\d+$/,Lb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ob=/\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$/,Fb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$b=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rs=r=>Db.test(r),Le=r=>!!r&&!Number.isNaN(Number(r)),gr=r=>!!r&&Number.isInteger(Number(r)),Yc=r=>r.endsWith("%")&&Le(r.slice(0,-1)),Bn=r=>Lb.test(r),Bb=()=>!0,Ub=r=>Ob.test(r)&&!Fb.test(r),zp=()=>!1,Vb=r=>zb.test(r),Wb=r=>$b.test(r),Hb=r=>!Ne(r)&&!be(r),Kb=r=>Us(r,Up,zp),Ne=r=>Op.test(r),Gr=r=>Us(r,Vp,Ub),Qc=r=>Us(r,Xb,Le),Am=r=>Us(r,$p,zp),Gb=r=>Us(r,Bp,Wb),ri=r=>Us(r,Wp,Vb),be=r=>Fp.test(r),Da=r=>Vs(r,Vp),Yb=r=>Vs(r,Jb),Mm=r=>Vs(r,$p),Qb=r=>Vs(r,Up),qb=r=>Vs(r,Bp),si=r=>Vs(r,Wp,!0),Us=(r,a,l)=>{const o=Op.exec(r);return o?o[1]?a(o[1]):l(o[2]):!1},Vs=(r,a,l=!1)=>{const o=Fp.exec(r);return o?o[1]?a(o[1]):l:!1},$p=r=>r==="position"||r==="percentage",Bp=r=>r==="image"||r==="url",Up=r=>r==="length"||r==="size"||r==="bg-size",Vp=r=>r==="length",Xb=r=>r==="number",Jb=r=>r==="family-name",Wp=r=>r==="shadow",Zb=()=>{const r=xt("color"),a=xt("font"),l=xt("text"),o=xt("font-weight"),c=xt("tracking"),u=xt("leading"),f=xt("breakpoint"),p=xt("container"),x=xt("spacing"),g=xt("radius"),v=xt("shadow"),y=xt("inset-shadow"),E=xt("text-shadow"),_=xt("drop-shadow"),k=xt("blur"),w=xt("perspective"),j=xt("aspect"),b=xt("ease"),C=xt("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],$=()=>[...A(),be,Ne],V=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],T=()=>[be,Ne,x],F=()=>[Rs,"full","auto",...T()],Y=()=>[gr,"none","subgrid",be,Ne],K=()=>["auto",{span:["full",gr,be,Ne]},gr,be,Ne],J=()=>[gr,"auto",be,Ne],ce=()=>["auto","min","max","fr",be,Ne],X=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],le=()=>["start","end","center","stretch","center-safe","end-safe"],ee=()=>["auto",...T()],q=()=>[Rs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],I=()=>[r,be,Ne],Q=()=>[...A(),Mm,Am,{position:[be,Ne]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",Qb,Kb,{size:[be,Ne]}],P=()=>[Yc,Da,Gr],W=()=>["","none","full",g,be,Ne],re=()=>["",Le,Da,Gr],he=()=>["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"],se=()=>[Le,Yc,Mm,Am],pe=()=>["","none",k,be,Ne],L=()=>["none",Le,be,Ne],ue=()=>["none",Le,be,Ne],xe=()=>[Le,be,Ne],Re=()=>[Rs,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Bn],breakpoint:[Bn],color:[Bb],container:[Bn],"drop-shadow":[Bn],ease:["in","out","in-out"],font:[Hb],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Bn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Bn],shadow:[Bn],spacing:["px",Le],text:[Bn],"text-shadow":[Bn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rs,Ne,be,j]}],container:["container"],columns:[{columns:[Le,Ne,be,p]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:$()}],overflow:[{overflow:V()}],"overflow-x":[{"overflow-x":V()}],"overflow-y":[{"overflow-y":V()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{start:F()}],end:[{end:F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[gr,"auto",be,Ne]}],basis:[{basis:[Rs,"full","auto",p,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Le,Rs,"auto","initial","none",Ne]}],grow:[{grow:["",Le,be,Ne]}],shrink:[{shrink:["",Le,be,Ne]}],order:[{order:[gr,"first","last","none",be,Ne]}],"grid-cols":[{"grid-cols":Y()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":Y()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...X(),"normal"]}],"justify-items":[{"justify-items":[...le(),"normal"]}],"justify-self":[{"justify-self":["auto",...le()]}],"align-content":[{content:["normal",...X()]}],"align-items":[{items:[...le(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...le(),{baseline:["","last"]}]}],"place-content":[{"place-content":X()}],"place-items":[{"place-items":[...le(),"baseline"]}],"place-self":[{"place-self":["auto",...le()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:ee()}],mx:[{mx:ee()}],my:[{my:ee()}],ms:[{ms:ee()}],me:[{me:ee()}],mt:[{mt:ee()}],mr:[{mr:ee()}],mb:[{mb:ee()}],ml:[{ml:ee()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],w:[{w:[p,"screen",...q()]}],"min-w":[{"min-w":[p,"screen","none",...q()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[f]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",l,Da,Gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,be,Qc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Yc,Ne]}],"font-family":[{font:[Yb,Ne,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,be,Ne]}],"line-clamp":[{"line-clamp":[Le,"none",be,Qc]}],leading:[{leading:[u,...T()]}],"list-image":[{"list-image":["none",be,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[Le,"from-font","auto",be,Gr]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Le,"auto",be,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be,Ne]}],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",be,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gr,be,Ne],radial:["",be,Ne],conic:[gr,be,Ne]},qb,Gb]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:W()}],"rounded-s":[{"rounded-s":W()}],"rounded-e":[{"rounded-e":W()}],"rounded-t":[{"rounded-t":W()}],"rounded-r":[{"rounded-r":W()}],"rounded-b":[{"rounded-b":W()}],"rounded-l":[{"rounded-l":W()}],"rounded-ss":[{"rounded-ss":W()}],"rounded-se":[{"rounded-se":W()}],"rounded-ee":[{"rounded-ee":W()}],"rounded-es":[{"rounded-es":W()}],"rounded-tl":[{"rounded-tl":W()}],"rounded-tr":[{"rounded-tr":W()}],"rounded-br":[{"rounded-br":W()}],"rounded-bl":[{"rounded-bl":W()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Le,be,Ne]}],"outline-w":[{outline:["",Le,Da,Gr]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",v,si,ri]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",y,si,ri]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Le,Gr]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",E,si,ri]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Le,be,Ne]}],"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":[Le]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[be,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":A()}],"mask-image-conic-pos":[{"mask-conic":[Le]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,Ne]}],filter:[{filter:["","none",be,Ne]}],blur:[{blur:pe()}],brightness:[{brightness:[Le,be,Ne]}],contrast:[{contrast:[Le,be,Ne]}],"drop-shadow":[{"drop-shadow":["","none",_,si,ri]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Le,be,Ne]}],"hue-rotate":[{"hue-rotate":[Le,be,Ne]}],invert:[{invert:["",Le,be,Ne]}],saturate:[{saturate:[Le,be,Ne]}],sepia:[{sepia:["",Le,be,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",be,Ne]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[Le,be,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[Le,be,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Le,be,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Le,be,Ne]}],"backdrop-invert":[{"backdrop-invert":["",Le,be,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[Le,be,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[Le,be,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",Le,be,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",be,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Le,"initial",be,Ne]}],ease:[{ease:["linear","initial",b,be,Ne]}],delay:[{delay:[Le,be,Ne]}],animate:[{animate:["none",C,be,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,be,Ne]}],"perspective-origin":[{"perspective-origin":$()}],rotate:[{rotate:L()}],"rotate-x":[{"rotate-x":L()}],"rotate-y":[{"rotate-y":L()}],"rotate-z":[{"rotate-z":L()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[be,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:$()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",be,Ne]}],"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":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",be,Ne]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Le,Da,Gr,Qc]}],stroke:[{stroke:["none",...I()]}],"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"]}},ew=Ab(Zb);function Ge(...r){return ew(Tp(r))}const tw=Ip("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 oe({className:r,variant:a,size:l,asChild:o=!1,...c}){const u=o?Rp:"button";return t.jsx(u,{"data-slot":"button",className:Ge(tw({variant:a,size:l,className:r})),...c})}function ne({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 nw(){const r=Va(),[a,l]=h.useState(""),[o,c]=h.useState(""),[u,f]=h.useState(""),[p,x]=h.useState(!1),g=async()=>{f(""),x(!0);try{const v=await jt("/api/admin",{username:a.trim(),password:o});if((v==null?void 0:v.success)!==!1&&(v!=null&&v.token)){eb(v.token),r("/dashboard",{replace:!0});return}f(v.error||"用户名或密码错误")}catch(v){const y=v;f(y.status===401?"用户名或密码错误":(y==null?void 0:y.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(zd,{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(qr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(ne,{type:"text",value:a,onChange:v=>l(v.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(mN,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(ne,{type:"password",value:o,onChange:v=>c(v.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:v=>v.key==="Enter"&&g()})]})]}),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(oe,{onClick:g,disabled:p,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:p?"登录中...":"登录"})]})]}),t.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const ke=h.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("rounded-xl border bg-card text-card-foreground shadow",r),...a}));ke.displayName="Card";const $e=h.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("flex flex-col space-y-1.5 p-6",r),...a}));$e.displayName="CardHeader";const Be=h.forwardRef(({className:r,...a},l)=>t.jsx("h3",{ref:l,className:Ge("font-semibold leading-none tracking-tight",r),...a}));Be.displayName="CardTitle";const ot=h.forwardRef(({className:r,...a},l)=>t.jsx("p",{ref:l,className:Ge("text-sm text-muted-foreground",r),...a}));ot.displayName="CardDescription";const Ee=h.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("p-6 pt-0",r),...a}));Ee.displayName="CardContent";const rw=h.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("flex items-center p-6 pt-0",r),...a}));rw.displayName="CardFooter";function sw(){const r=Va(),[a,l]=h.useState(!0),[o,c]=h.useState([]),[u,f]=h.useState([]);async function p(){l(!0);try{const[k,w]=await Promise.all([We("/api/db/users"),We("/api/orders")]);k!=null&&k.success&&k.users&&c(k.users),w!=null&&w.success&&w.orders&&f(w.orders)}catch(k){console.error("加载数据失败",k)}finally{l(!1)}}if(h.useEffect(()=>{p()},[]),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(Ze,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),t.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const g=u.filter(k=>k.status==="paid"||k.status==="completed"||k.status==="success").reduce((k,w)=>k+Number(w.amount||0),0),v=o.length,y=u.length,E=k=>{const w=k.productType||"",j=k.description||"";if(j){if(w==="section"&&j.includes("章节")){if(j.includes("-")){const b=j.split("-");if(b.length>=3)return{title:`第${b[1]}章 第${b[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:j,subtitle:"章节购买"}}return w==="fullbook"||j.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:w==="match"||j.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:j,subtitle:w==="section"?"单章":w==="fullbook"?"全书":"其他"}}return w==="section"?{title:`章节 ${k.productId||""}`,subtitle:"单章购买"}:w==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:w==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:w||"其他"}},_=[{title:"总用户数",value:v,icon:vn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${Number(g).toFixed(2)}`,icon:gd,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:y,icon:pd,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${v>0?(y/v*100).toFixed(1):0}%`,icon:Wn,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:_.map((k,w)=>t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>k.link&&r(k.link),children:[t.jsxs($e,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsx(Be,{className:"text-sm font-medium text-gray-400",children:k.title}),t.jsx("div",{className:`p-2 rounded-lg ${k.bg}`,children:t.jsx(k.icon,{className:`w-4 h-4 ${k.color}`})})]}),t.jsx(Ee,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-2xl font-bold text-white",children:k.value}),t.jsx(As,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},w))}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"最近订单"})}),t.jsx(Ee,{children:t.jsxs("div",{className:"space-y-3",children:[u.slice(-5).reverse().map(k=>{var N;const w=k.referrerId?o.find(A=>A.id===k.referrerId):void 0,j=k.referralCode||(w==null?void 0:w.referralCode)||(w==null?void 0:w.nickname)||(k.referrerId?String(k.referrerId).slice(0,8):""),b=E(k),C=k.userNickname||((N=o.find(A=>A.id===k.userId))==null?void 0:N.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:[k.userAvatar?t.jsx("img",{src:k.userAvatar,alt:C,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:A=>{A.currentTarget.style.display="none";const $=A.currentTarget.nextElementSibling;$&&$.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 ${k.userAvatar?"hidden":""}`,children:C.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:C}),t.jsx("span",{className:"text-gray-600",children:"·"}),t.jsx("span",{className:"text-sm font-medium text-white truncate",children:b.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:b.subtitle}),t.jsx("span",{children:new Date(k.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),j&&t.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",j]})]})]}),t.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[t.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(k.amount).toFixed(2)]}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:k.paymentMethod||"微信"})]})]},k.id)}),u.length===0&&t.jsxs("div",{className:"text-center py-12",children:[t.jsx(pd,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"新注册用户"})}),t.jsx(Ee,{children:t.jsxs("div",{className:"space-y-3",children:[o.slice(-5).reverse().map(k=>{var w;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:((w=k.nickname)==null?void 0:w.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-white",children:k.nickname||"匿名用户"}),t.jsx("p",{className:"text-xs text-gray-500",children:k.phone||"-"})]})]}),t.jsx("p",{className:"text-xs text-gray-400",children:k.createdAt?new Date(k.createdAt).toLocaleDateString():"-"})]},k.id)}),o.length===0&&t.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]})]})}const Yn=h.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})}));Yn.displayName="Table";const Qn=h.forwardRef(({className:r,...a},l)=>t.jsx("thead",{ref:l,className:Ge("[&_tr]:border-b",r),...a}));Qn.displayName="TableHeader";const qn=h.forwardRef(({className:r,...a},l)=>t.jsx("tbody",{ref:l,className:Ge("[&_tr:last-child]:border-0",r),...a}));qn.displayName="TableBody";const rt=h.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}));rt.displayName="TableRow";const Pe=h.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}));Pe.displayName="TableHead";const we=h.forwardRef(({className:r,...a},l)=>t.jsx("td",{ref:l,className:Ge("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...a}));we.displayName="TableCell";const aw=Ip("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 Me({className:r,variant:a,asChild:l=!1,...o}){const c=l?Rp:"span";return t.jsx(c,{className:Ge(aw({variant:a}),r),...o})}function Ae(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 lw(r,a){const l=h.createContext(a),o=u=>{const{children:f,...p}=u,x=h.useMemo(()=>p,Object.values(p));return t.jsx(l.Provider,{value:x,children:f})};o.displayName=r+"Provider";function c(u){const f=h.useContext(l);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${r}\``)}return[o,c]}function Rr(r,a=[]){let l=[];function o(u,f){const p=h.createContext(f),x=l.length;l=[...l,f];const g=y=>{var b;const{scope:E,children:_,...k}=y,w=((b=E==null?void 0:E[r])==null?void 0:b[x])||p,j=h.useMemo(()=>k,Object.values(k));return t.jsx(w.Provider,{value:j,children:_})};g.displayName=u+"Provider";function v(y,E){var w;const _=((w=E==null?void 0:E[r])==null?void 0:w[x])||p,k=h.useContext(_);if(k)return k;if(f!==void 0)return f;throw new Error(`\`${y}\` must be used within \`${u}\``)}return[g,v]}const c=()=>{const u=l.map(f=>h.createContext(f));return function(p){const x=(p==null?void 0:p[r])||u;return h.useMemo(()=>({[`__scope${r}`]:{...p,[r]:x}}),[p,x])}};return c.scopeName=r,[o,iw(c,...a)]}function iw(...r){const a=r[0];if(r.length===1)return a;const l=()=>{const o=r.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const f=o.reduce((p,{useScope:x,scopeName:g})=>{const y=x(u)[`__scope${g}`];return{...p,...y}},{});return h.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return l.scopeName=a.scopeName,l}var Rt=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},ow=Ii[" useId ".trim().toString()]||(()=>{}),cw=0;function wr(r){const[a,l]=h.useState(ow());return Rt(()=>{l(o=>o??String(cw++))},[r]),a?`radix-${a}`:""}var dw=Ii[" useInsertionEffect ".trim().toString()]||Rt;function Jr({prop:r,defaultProp:a,onChange:l=()=>{},caller:o}){const[c,u,f]=uw({defaultProp:a,onChange:l}),p=r!==void 0,x=p?r:c;{const v=h.useRef(r!==void 0);h.useEffect(()=>{const y=v.current;y!==p&&console.warn(`${o} is changing from ${y?"controlled":"uncontrolled"} to ${p?"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.`),v.current=p},[p,o])}const g=h.useCallback(v=>{var y;if(p){const E=fw(v)?v(r):v;E!==r&&((y=f.current)==null||y.call(f,E))}else u(v)},[p,r,u,f]);return[x,g]}function uw({defaultProp:r,onChange:a}){const[l,o]=h.useState(r),c=h.useRef(l),u=h.useRef(a);return dw(()=>{u.current=a},[a]),h.useEffect(()=>{var f;c.current!==l&&((f=u.current)==null||f.call(u,l),c.current=l)},[l,c]),[l,o,u]}function fw(r){return typeof r=="function"}function $a(r){const a=hw(r),l=h.forwardRef((o,c)=>{const{children:u,...f}=o,p=h.Children.toArray(u),x=p.find(pw);if(x){const g=x.props.children,v=p.map(y=>y===x?h.Children.count(g)>1?h.Children.only(null):h.isValidElement(g)?g.props.children:null:y);return t.jsx(a,{...f,ref:c,children:h.isValidElement(g)?h.cloneElement(g,void 0,v):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${r}.Slot`,l}function hw(r){const a=h.forwardRef((l,o)=>{const{children:c,...u}=l;if(h.isValidElement(c)){const f=gw(c),p=xw(u,c.props);return c.type!==h.Fragment&&(p.ref=o?Ud(o,f):f),h.cloneElement(c,p)}return h.Children.count(c)>1?h.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var mw=Symbol("radix.slottable");function pw(r){return h.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===mw}function xw(r,a){const l={...a};for(const o in a){const c=r[o],u=a[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...p)=>{const x=u(...p);return c(...p),x}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...r,...l}}function gw(r){var o,c;let a=(o=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:o.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 vw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oe=vw.reduce((r,a)=>{const l=$a(`Primitive.${a}`),o=h.forwardRef((c,u)=>{const{asChild:f,...p}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...p,ref:u})});return o.displayName=`Primitive.${a}`,{...r,[a]:o}},{});function yw(r,a){r&&Ua.flushSync(()=>r.dispatchEvent(a))}function Cr(r){const a=h.useRef(r);return h.useEffect(()=>{a.current=r}),h.useMemo(()=>(...l)=>{var o;return(o=a.current)==null?void 0:o.call(a,...l)},[])}function jw(r,a=globalThis==null?void 0:globalThis.document){const l=Cr(r);h.useEffect(()=>{const o=c=>{c.key==="Escape"&&l(c)};return a.addEventListener("keydown",o,{capture:!0}),()=>a.removeEventListener("keydown",o,{capture:!0})},[l,a])}var Nw="DismissableLayer",yd="dismissableLayer.update",bw="dismissableLayer.pointerDownOutside",ww="dismissableLayer.focusOutside",Dm,Hp=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wd=h.forwardRef((r,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,onDismiss:p,...x}=r,g=h.useContext(Hp),[v,y]=h.useState(null),E=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=h.useState({}),k=Ke(a,R=>y(R)),w=Array.from(g.layers),[j]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),b=w.indexOf(j),C=v?w.indexOf(v):-1,N=g.layersWithOutsidePointerEventsDisabled.size>0,A=C>=b,$=kw(R=>{const T=R.target,F=[...g.branches].some(Y=>Y.contains(T));!A||F||(c==null||c(R),f==null||f(R),R.defaultPrevented||p==null||p())},E),V=Ew(R=>{const T=R.target;[...g.branches].some(Y=>Y.contains(T))||(u==null||u(R),f==null||f(R),R.defaultPrevented||p==null||p())},E);return jw(R=>{C===g.layers.size-1&&(o==null||o(R),!R.defaultPrevented&&p&&(R.preventDefault(),p()))},E),h.useEffect(()=>{if(v)return l&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Dm=E.body.style.pointerEvents,E.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),Lm(),()=>{l&&g.layersWithOutsidePointerEventsDisabled.size===1&&(E.body.style.pointerEvents=Dm)}},[v,E,l,g]),h.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),Lm())},[v,g]),h.useEffect(()=>{const R=()=>_({});return document.addEventListener(yd,R),()=>document.removeEventListener(yd,R)},[]),t.jsx(Oe.div,{...x,ref:k,style:{pointerEvents:N?A?"auto":"none":void 0,...r.style},onFocusCapture:Ae(r.onFocusCapture,V.onFocusCapture),onBlurCapture:Ae(r.onBlurCapture,V.onBlurCapture),onPointerDownCapture:Ae(r.onPointerDownCapture,$.onPointerDownCapture)})});Wd.displayName=Nw;var Sw="DismissableLayerBranch",Cw=h.forwardRef((r,a)=>{const l=h.useContext(Hp),o=h.useRef(null),c=Ke(a,o);return h.useEffect(()=>{const u=o.current;if(u)return l.branches.add(u),()=>{l.branches.delete(u)}},[l.branches]),t.jsx(Oe.div,{...r,ref:c})});Cw.displayName=Sw;function kw(r,a=globalThis==null?void 0:globalThis.document){const l=Cr(r),o=h.useRef(!1),c=h.useRef(()=>{});return h.useEffect(()=>{const u=p=>{if(p.target&&!o.current){let x=function(){Kp(bw,l,g,{discrete:!0})};const g={originalEvent:p};p.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=x,a.addEventListener("click",c.current,{once:!0})):x()}else a.removeEventListener("click",c.current);o.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:()=>o.current=!0}}function Ew(r,a=globalThis==null?void 0:globalThis.document){const l=Cr(r),o=h.useRef(!1);return h.useEffect(()=>{const c=u=>{u.target&&!o.current&&Kp(ww,l,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,l]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Lm(){const r=new CustomEvent(yd);document.dispatchEvent(r)}function Kp(r,a,l,{discrete:o}){const c=l.originalEvent.target,u=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:l});a&&c.addEventListener(r,a,{once:!0}),o?yw(c,u):c.dispatchEvent(u)}var qc="focusScope.autoFocusOnMount",Xc="focusScope.autoFocusOnUnmount",Om={bubbles:!1,cancelable:!0},Pw="FocusScope",Hd=h.forwardRef((r,a)=>{const{loop:l=!1,trapped:o=!1,onMountAutoFocus:c,onUnmountAutoFocus:u,...f}=r,[p,x]=h.useState(null),g=Cr(c),v=Cr(u),y=h.useRef(null),E=Ke(a,w=>x(w)),_=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(o){let w=function(N){if(_.paused||!p)return;const A=N.target;p.contains(A)?y.current=A:yr(y.current,{select:!0})},j=function(N){if(_.paused||!p)return;const A=N.relatedTarget;A!==null&&(p.contains(A)||yr(y.current,{select:!0}))},b=function(N){if(document.activeElement===document.body)for(const $ of N)$.removedNodes.length>0&&yr(p)};document.addEventListener("focusin",w),document.addEventListener("focusout",j);const C=new MutationObserver(b);return p&&C.observe(p,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",j),C.disconnect()}}},[o,p,_.paused]),h.useEffect(()=>{if(p){zm.add(_);const w=document.activeElement;if(!p.contains(w)){const b=new CustomEvent(qc,Om);p.addEventListener(qc,g),p.dispatchEvent(b),b.defaultPrevented||(Rw(Mw(Gp(p)),{select:!0}),document.activeElement===w&&yr(p))}return()=>{p.removeEventListener(qc,g),setTimeout(()=>{const b=new CustomEvent(Xc,Om);p.addEventListener(Xc,v),p.dispatchEvent(b),b.defaultPrevented||yr(w??document.body,{select:!0}),p.removeEventListener(Xc,v),zm.remove(_)},0)}}},[p,g,v,_]);const k=h.useCallback(w=>{if(!l&&!o||_.paused)return;const j=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,b=document.activeElement;if(j&&b){const C=w.currentTarget,[N,A]=_w(C);N&&A?!w.shiftKey&&b===A?(w.preventDefault(),l&&yr(N,{select:!0})):w.shiftKey&&b===N&&(w.preventDefault(),l&&yr(A,{select:!0})):b===C&&w.preventDefault()}},[l,o,_.paused]);return t.jsx(Oe.div,{tabIndex:-1,...f,ref:E,onKeyDown:k})});Hd.displayName=Pw;function Rw(r,{select:a=!1}={}){const l=document.activeElement;for(const o of r)if(yr(o,{select:a}),document.activeElement!==l)return}function _w(r){const a=Gp(r),l=Fm(a,r),o=Fm(a.reverse(),r);return[l,o]}function Gp(r){const a=[],l=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;l.nextNode();)a.push(l.currentNode);return a}function Fm(r,a){for(const l of r)if(!Tw(l,{upTo:a}))return l}function Tw(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 Iw(r){return r instanceof HTMLInputElement&&"select"in r}function yr(r,{select:a=!1}={}){if(r&&r.focus){const l=document.activeElement;r.focus({preventScroll:!0}),r!==l&&Iw(r)&&a&&r.select()}}var zm=Aw();function Aw(){let r=[];return{add(a){const l=r[0];a!==l&&(l==null||l.pause()),r=$m(r,a),r.unshift(a)},remove(a){var l;r=$m(r,a),(l=r[0])==null||l.resume()}}}function $m(r,a){const l=[...r],o=l.indexOf(a);return o!==-1&&l.splice(o,1),l}function Mw(r){return r.filter(a=>a.tagName!=="A")}var Dw="Portal",Kd=h.forwardRef((r,a)=>{var p;const{container:l,...o}=r,[c,u]=h.useState(!1);Rt(()=>u(!0),[]);const f=l||c&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return f?dy.createPortal(t.jsx(Oe.div,{...o,ref:a}),f):null});Kd.displayName=Dw;function Lw(r,a){return h.useReducer((l,o)=>a[l][o]??l,r)}var Ha=r=>{const{present:a,children:l}=r,o=Ow(a),c=typeof l=="function"?l({present:o.isPresent}):h.Children.only(l),u=Ke(o.ref,Fw(c));return typeof l=="function"||o.isPresent?h.cloneElement(c,{ref:u}):null};Ha.displayName="Presence";function Ow(r){const[a,l]=h.useState(),o=h.useRef(null),c=h.useRef(r),u=h.useRef("none"),f=r?"mounted":"unmounted",[p,x]=Lw(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const g=ai(o.current);u.current=p==="mounted"?g:"none"},[p]),Rt(()=>{const g=o.current,v=c.current;if(v!==r){const E=u.current,_=ai(g);r?x("MOUNT"):_==="none"||(g==null?void 0:g.display)==="none"?x("UNMOUNT"):x(v&&E!==_?"ANIMATION_OUT":"UNMOUNT"),c.current=r}},[r,x]),Rt(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,y=_=>{const w=ai(o.current).includes(CSS.escape(_.animationName));if(_.target===a&&w&&(x("ANIMATION_END"),!c.current)){const j=a.style.animationFillMode;a.style.animationFillMode="forwards",g=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=j)})}},E=_=>{_.target===a&&(u.current=ai(o.current))};return a.addEventListener("animationstart",E),a.addEventListener("animationcancel",y),a.addEventListener("animationend",y),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",E),a.removeEventListener("animationcancel",y),a.removeEventListener("animationend",y)}}else x("ANIMATION_END")},[a,x]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:h.useCallback(g=>{o.current=g?getComputedStyle(g):null,l(g)},[])}}function ai(r){return(r==null?void 0:r.animationName)||"none"}function Fw(r){var o,c;let a=(o=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:o.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 Jc=0;function Yp(){h.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??Bm()),document.body.insertAdjacentElement("beforeend",r[1]??Bm()),Jc++,()=>{Jc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Jc--}},[])}function Bm(){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 En=function(){return En=Object.assign||function(a){for(var l,o=1,c=arguments.length;o"u")return t1;var a=n1(r),l=document.documentElement.clientWidth,o=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,o-l+a[2]-a[0])}},s1=Jp(),Ds="data-scroll-locked",a1=function(r,a,l,o){var c=r.left,u=r.top,f=r.right,p=r.gap;return l===void 0&&(l="margin"),` - .`.concat($w,` { - overflow: hidden `).concat(o,`; - padding-right: `).concat(p,"px ").concat(o,`; - } - body[`).concat(Ds,`] { - overflow: hidden `).concat(o,`; - overscroll-behavior: contain; - `).concat([a&&"position: relative ".concat(o,";"),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(p,"px ").concat(o,`; - `),l==="padding"&&"padding-right: ".concat(p,"px ").concat(o,";")].filter(Boolean).join(""),` - } - - .`).concat(hi,` { - right: `).concat(p,"px ").concat(o,`; - } - - .`).concat(mi,` { - margin-right: `).concat(p,"px ").concat(o,`; - } - - .`).concat(hi," .").concat(hi,` { - right: 0 `).concat(o,`; - } - - .`).concat(mi," .").concat(mi,` { - margin-right: 0 `).concat(o,`; - } - - body[`).concat(Ds,`] { - `).concat(Bw,": ").concat(p,`px; - } -`)},Vm=function(){var r=parseInt(document.body.getAttribute(Ds)||"0",10);return isFinite(r)?r:0},l1=function(){h.useEffect(function(){return document.body.setAttribute(Ds,(Vm()+1).toString()),function(){var r=Vm()-1;r<=0?document.body.removeAttribute(Ds):document.body.setAttribute(Ds,r.toString())}},[])},i1=function(r){var a=r.noRelative,l=r.noImportant,o=r.gapMode,c=o===void 0?"margin":o;l1();var u=h.useMemo(function(){return r1(c)},[c]);return h.createElement(s1,{styles:a1(u,!a,c,l?"":"!important")})},jd=!1;if(typeof window<"u")try{var li=Object.defineProperty({},"passive",{get:function(){return jd=!0,!0}});window.addEventListener("test",li,li),window.removeEventListener("test",li,li)}catch{jd=!1}var _s=jd?{passive:!1}:!1,o1=function(r){return r.tagName==="TEXTAREA"},Zp=function(r,a){if(!(r instanceof Element))return!1;var l=window.getComputedStyle(r);return l[a]!=="hidden"&&!(l.overflowY===l.overflowX&&!o1(r)&&l[a]==="visible")},c1=function(r){return Zp(r,"overflowY")},d1=function(r){return Zp(r,"overflowX")},Wm=function(r,a){var l=a.ownerDocument,o=a;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var c=ex(r,o);if(c){var u=tx(r,o),f=u[1],p=u[2];if(f>p)return!0}o=o.parentNode}while(o&&o!==l.body);return!1},u1=function(r){var a=r.scrollTop,l=r.scrollHeight,o=r.clientHeight;return[a,l,o]},f1=function(r){var a=r.scrollLeft,l=r.scrollWidth,o=r.clientWidth;return[a,l,o]},ex=function(r,a){return r==="v"?c1(a):d1(a)},tx=function(r,a){return r==="v"?u1(a):f1(a)},h1=function(r,a){return r==="h"&&a==="rtl"?-1:1},m1=function(r,a,l,o,c){var u=h1(r,window.getComputedStyle(a).direction),f=u*o,p=l.target,x=a.contains(p),g=!1,v=f>0,y=0,E=0;do{if(!p)break;var _=tx(r,p),k=_[0],w=_[1],j=_[2],b=w-j-u*k;(k||b)&&ex(r,p)&&(y+=b,E+=k);var C=p.parentNode;p=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!x&&p!==document.body||x&&(a.contains(p)||a===p));return(v&&Math.abs(y)<1||!v&&Math.abs(E)<1)&&(g=!0),g},ii=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},Hm=function(r){return[r.deltaX,r.deltaY]},Km=function(r){return r&&"current"in r?r.current:r},p1=function(r,a){return r[0]===a[0]&&r[1]===a[1]},x1=function(r){return` - .block-interactivity-`.concat(r,` {pointer-events: none;} - .allow-interactivity-`).concat(r,` {pointer-events: all;} -`)},g1=0,Ts=[];function v1(r){var a=h.useRef([]),l=h.useRef([0,0]),o=h.useRef(),c=h.useState(g1++)[0],u=h.useState(Jp)[0],f=h.useRef(r);h.useEffect(function(){f.current=r},[r]),h.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(c));var w=zw([r.lockRef.current],(r.shards||[]).map(Km),!0).filter(Boolean);return w.forEach(function(j){return j.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),w.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(c))})}}},[r.inert,r.lockRef.current,r.shards]);var p=h.useCallback(function(w,j){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!f.current.allowPinchZoom;var b=ii(w),C=l.current,N="deltaX"in w?w.deltaX:C[0]-b[0],A="deltaY"in w?w.deltaY:C[1]-b[1],$,V=w.target,R=Math.abs(N)>Math.abs(A)?"h":"v";if("touches"in w&&R==="h"&&V.type==="range")return!1;var T=window.getSelection(),F=T&&T.anchorNode,Y=F?F===V||F.contains(V):!1;if(Y)return!1;var K=Wm(R,V);if(!K)return!0;if(K?$=R:($=R==="v"?"h":"v",K=Wm(R,V)),!K)return!1;if(!o.current&&"changedTouches"in w&&(N||A)&&(o.current=$),!$)return!0;var J=o.current||$;return m1(J,j,w,J==="h"?N:A)},[]),x=h.useCallback(function(w){var j=w;if(!(!Ts.length||Ts[Ts.length-1]!==u)){var b="deltaY"in j?Hm(j):ii(j),C=a.current.filter(function($){return $.name===j.type&&($.target===j.target||j.target===$.shadowParent)&&p1($.delta,b)})[0];if(C&&C.should){j.cancelable&&j.preventDefault();return}if(!C){var N=(f.current.shards||[]).map(Km).filter(Boolean).filter(function($){return $.contains(j.target)}),A=N.length>0?p(j,N[0]):!f.current.noIsolation;A&&j.cancelable&&j.preventDefault()}}},[]),g=h.useCallback(function(w,j,b,C){var N={name:w,delta:j,target:b,should:C,shadowParent:y1(b)};a.current.push(N),setTimeout(function(){a.current=a.current.filter(function(A){return A!==N})},1)},[]),v=h.useCallback(function(w){l.current=ii(w),o.current=void 0},[]),y=h.useCallback(function(w){g(w.type,Hm(w),w.target,p(w,r.lockRef.current))},[]),E=h.useCallback(function(w){g(w.type,ii(w),w.target,p(w,r.lockRef.current))},[]);h.useEffect(function(){return Ts.push(u),r.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:E}),document.addEventListener("wheel",x,_s),document.addEventListener("touchmove",x,_s),document.addEventListener("touchstart",v,_s),function(){Ts=Ts.filter(function(w){return w!==u}),document.removeEventListener("wheel",x,_s),document.removeEventListener("touchmove",x,_s),document.removeEventListener("touchstart",v,_s)}},[]);var _=r.removeScrollBar,k=r.inert;return h.createElement(h.Fragment,null,k?h.createElement(u,{styles:x1(c)}):null,_?h.createElement(i1,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function y1(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const j1=Yw(Xp,v1);var Gd=h.forwardRef(function(r,a){return h.createElement(Fi,En({},r,{ref:a,sideCar:j1}))});Gd.classNames=Fi.classNames;var N1=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Is=new WeakMap,oi=new WeakMap,ci={},nd=0,nx=function(r){return r&&(r.host||nx(r.parentNode))},b1=function(r,a){return a.map(function(l){if(r.contains(l))return l;var o=nx(l);return o&&r.contains(o)?o:(console.error("aria-hidden",l,"in not contained inside",r,". Doing nothing"),null)}).filter(function(l){return!!l})},w1=function(r,a,l,o){var c=b1(a,Array.isArray(r)?r:[r]);ci[l]||(ci[l]=new WeakMap);var u=ci[l],f=[],p=new Set,x=new Set(c),g=function(y){!y||p.has(y)||(p.add(y),g(y.parentNode))};c.forEach(g);var v=function(y){!y||x.has(y)||Array.prototype.forEach.call(y.children,function(E){if(p.has(E))v(E);else try{var _=E.getAttribute(o),k=_!==null&&_!=="false",w=(Is.get(E)||0)+1,j=(u.get(E)||0)+1;Is.set(E,w),u.set(E,j),f.push(E),w===1&&k&&oi.set(E,!0),j===1&&E.setAttribute(l,"true"),k||E.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",E,b)}})};return v(a),p.clear(),nd++,function(){f.forEach(function(y){var E=Is.get(y)-1,_=u.get(y)-1;Is.set(y,E),u.set(y,_),E||(oi.has(y)||y.removeAttribute(o),oi.delete(y)),_||y.removeAttribute(l)}),nd--,nd||(Is=new WeakMap,Is=new WeakMap,oi=new WeakMap,ci={})}},rx=function(r,a,l){l===void 0&&(l="data-aria-hidden");var o=Array.from(Array.isArray(r)?r:[r]),c=N1(r);return c?(o.push.apply(o,Array.from(c.querySelectorAll("[aria-live], script"))),w1(o,c,l,"aria-hidden")):function(){return null}},zi="Dialog",[sx]=Rr(zi),[S1,Nn]=sx(zi),ax=r=>{const{__scopeDialog:a,children:l,open:o,defaultOpen:c,onOpenChange:u,modal:f=!0}=r,p=h.useRef(null),x=h.useRef(null),[g,v]=Jr({prop:o,defaultProp:c??!1,onChange:u,caller:zi});return t.jsx(S1,{scope:a,triggerRef:p,contentRef:x,contentId:wr(),titleId:wr(),descriptionId:wr(),open:g,onOpenChange:v,onOpenToggle:h.useCallback(()=>v(y=>!y),[v]),modal:f,children:l})};ax.displayName=zi;var lx="DialogTrigger",C1=h.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=Nn(lx,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":qd(c.open),...o,ref:u,onClick:Ae(r.onClick,c.onOpenToggle)})});C1.displayName=lx;var Yd="DialogPortal",[k1,ix]=sx(Yd,{forceMount:void 0}),ox=r=>{const{__scopeDialog:a,forceMount:l,children:o,container:c}=r,u=Nn(Yd,a);return t.jsx(k1,{scope:a,forceMount:l,children:h.Children.map(o,f=>t.jsx(Ha,{present:l||u.open,children:t.jsx(Kd,{asChild:!0,container:c,children:f})}))})};ox.displayName=Yd;var Ci="DialogOverlay",cx=h.forwardRef((r,a)=>{const l=ix(Ci,r.__scopeDialog),{forceMount:o=l.forceMount,...c}=r,u=Nn(Ci,r.__scopeDialog);return u.modal?t.jsx(Ha,{present:o||u.open,children:t.jsx(P1,{...c,ref:a})}):null});cx.displayName=Ci;var E1=$a("DialogOverlay.RemoveScroll"),P1=h.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=Nn(Ci,l);return t.jsx(Gd,{as:E1,allowPinchZoom:!0,shards:[c.contentRef],children:t.jsx(Oe.div,{"data-state":qd(c.open),...o,ref:a,style:{pointerEvents:"auto",...o.style}})})}),Zr="DialogContent",dx=h.forwardRef((r,a)=>{const l=ix(Zr,r.__scopeDialog),{forceMount:o=l.forceMount,...c}=r,u=Nn(Zr,r.__scopeDialog);return t.jsx(Ha,{present:o||u.open,children:u.modal?t.jsx(R1,{...c,ref:a}):t.jsx(_1,{...c,ref:a})})});dx.displayName=Zr;var R1=h.forwardRef((r,a)=>{const l=Nn(Zr,r.__scopeDialog),o=h.useRef(null),c=Ke(a,l.contentRef,o);return h.useEffect(()=>{const u=o.current;if(u)return rx(u)},[]),t.jsx(ux,{...r,ref:c,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ae(r.onCloseAutoFocus,u=>{var f;u.preventDefault(),(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Ae(r.onPointerDownOutside,u=>{const f=u.detail.originalEvent,p=f.button===0&&f.ctrlKey===!0;(f.button===2||p)&&u.preventDefault()}),onFocusOutside:Ae(r.onFocusOutside,u=>u.preventDefault())})}),_1=h.forwardRef((r,a)=>{const l=Nn(Zr,r.__scopeDialog),o=h.useRef(!1),c=h.useRef(!1);return t.jsx(ux,{...r,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var f,p;(f=r.onCloseAutoFocus)==null||f.call(r,u),u.defaultPrevented||(o.current||(p=l.triggerRef.current)==null||p.focus(),u.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:u=>{var x,g;(x=r.onInteractOutside)==null||x.call(r,u),u.defaultPrevented||(o.current=!0,u.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const f=u.target;((g=l.triggerRef.current)==null?void 0:g.contains(f))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&c.current&&u.preventDefault()}})}),ux=h.forwardRef((r,a)=>{const{__scopeDialog:l,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:u,...f}=r,p=Nn(Zr,l),x=h.useRef(null),g=Ke(a,x);return Yp(),t.jsxs(t.Fragment,{children:[t.jsx(Hd,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:u,children:t.jsx(Wd,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionId,"aria-labelledby":p.titleId,"data-state":qd(p.open),...f,ref:g,onDismiss:()=>p.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(T1,{titleId:p.titleId}),t.jsx(A1,{contentRef:x,descriptionId:p.descriptionId})]})]})}),Qd="DialogTitle",fx=h.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=Nn(Qd,l);return t.jsx(Oe.h2,{id:c.titleId,...o,ref:a})});fx.displayName=Qd;var hx="DialogDescription",mx=h.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=Nn(hx,l);return t.jsx(Oe.p,{id:c.descriptionId,...o,ref:a})});mx.displayName=hx;var px="DialogClose",xx=h.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=Nn(px,l);return t.jsx(Oe.button,{type:"button",...o,ref:a,onClick:Ae(r.onClick,()=>c.onOpenChange(!1))})});xx.displayName=px;function qd(r){return r?"open":"closed"}var gx="DialogTitleWarning",[g4,vx]=lw(gx,{contentName:Zr,titleName:Qd,docsSlug:"dialog"}),T1=({titleId:r})=>{const a=vx(gx),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 h.useEffect(()=>{r&&(document.getElementById(r)||console.error(l))},[l,r]),null},I1="DialogDescriptionWarning",A1=({contentRef:r,descriptionId:a})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vx(I1).contentName}}.`;return h.useEffect(()=>{var u;const c=(u=r.current)==null?void 0:u.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(o))},[o,r,a]),null},M1=ax,D1=ox,L1=cx,O1=dx,F1=fx,z1=mx,$1=xx;function Bt(r){return t.jsx(M1,{"data-slot":"dialog",...r})}function B1(r){return t.jsx(D1,{...r})}const yx=h.forwardRef(({className:r,...a},l)=>t.jsx(L1,{ref:l,className:Ge("fixed inset-0 z-50 bg-black/50",r),...a}));yx.displayName="DialogOverlay";const It=h.forwardRef(({className:r,children:a,showCloseButton:l=!0,...o},c)=>t.jsxs(B1,{children:[t.jsx(yx,{}),t.jsxs(O1,{ref:c,"aria-describedby":void 0,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),...o,children:[a,l&&t.jsxs($1,{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(on,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));It.displayName="DialogContent";function Ut({className:r,...a}){return t.jsx("div",{className:Ge("flex flex-col gap-2 text-center sm:text-left",r),...a})}function qt({className:r,...a}){return t.jsx("div",{className:Ge("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",r),...a})}function Vt(r){return t.jsx(F1,{className:"text-lg font-semibold leading-none",...r})}function U1(r){return t.jsx(z1,{className:"text-sm text-muted-foreground",...r})}function Xd(r,a){const[l,o]=h.useState(r);return h.useEffect(()=>{const c=setTimeout(()=>o(r),a);return()=>clearTimeout(c)},[r,a]),l}function Sr({page:r,totalPages:a,total:l,pageSize:o,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:o,onChange:p=>u(Number(p.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:f.map(p=>t.jsxs("option",{value:p,children:[p," 条/页"]},p))})]}),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 V1(){const[r,a]=h.useState([]),[l,o]=h.useState([]),[c,u]=h.useState(0),[f,p]=h.useState(0),[x,g]=h.useState(0),[v,y]=h.useState(1),[E,_]=h.useState(10),[k,w]=h.useState(""),j=Xd(k,300),[b,C]=h.useState("all"),[N,A]=h.useState(!0),[$,V]=h.useState(null),[R,T]=h.useState(null),[F,Y]=h.useState(""),[K,J]=h.useState(!1);async function ce(){A(!0),V(null);try{const B=b==="all"?"":b==="completed"?"completed":b,D=new URLSearchParams({page:String(v),pageSize:String(E),...B&&{status:B},...j&&{search:j}}),[P,W]=await Promise.all([We(`/api/orders?${D}`),We("/api/db/users?page=1&pageSize=500")]);P!=null&&P.success&&(a(P.orders||[]),u(P.total??0),p(P.totalRevenue??0),g(P.todayRevenue??0)),W!=null&&W.success&&W.users&&o(W.users)}catch(B){console.error("加载订单失败",B),V("加载订单失败,请检查网络后重试")}finally{A(!1)}}h.useEffect(()=>{y(1)},[j,b]),h.useEffect(()=>{ce()},[v,E,j,b]);const X=B=>{var D;return B.userNickname||((D=l.find(P=>P.id===B.userId))==null?void 0:D.nickname)||"匿名用户"},le=B=>{var D;return((D=l.find(P=>P.id===B))==null?void 0:D.phone)||"-"},ee=B=>{const D=B.productType||B.type||"",P=B.description||"";if(P){if(D==="section"&&P.includes("章节")){if(P.includes("-")){const W=P.split("-");if(W.length>=3)return{name:`第${W[1]}章 第${W[2]}节`,type:"《一场Soul的创业实验》"}}return{name:P,type:"章节购买"}}return D==="fullbook"||P.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:D==="vip"||P.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:D==="match"||P.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:P,type:"其他"}}return D==="section"?{name:`章节 ${B.productId||B.sectionId||""}`,type:"单章"}:D==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:D==="vip"?{name:"VIP年度会员",type:"VIP"}:D==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:D||"其他"}},q=Math.ceil(c/E)||1;async function I(){var B;if(!(!(R!=null&&R.orderSn)&&!(R!=null&&R.id))){J(!0),V(null);try{const D=await Pt("/api/admin/orders/refund",{orderSn:R.orderSn||R.id,reason:F||void 0});D!=null&&D.success?(T(null),Y(""),ce()):V((D==null?void 0:D.error)||"退款失败")}catch(D){const P=D;V(((B=P==null?void 0:P.data)==null?void 0:B.error)||"退款失败,请检查网络后重试")}finally{J(!1)}}}function Q(){if(r.length===0){alert("暂无数据可导出");return}const B=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],D=r.map(me=>{const se=ee(me);return[me.orderSn||me.id||"",X(me),le(me.userId),se.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(",")}),P="\uFEFF"+[B.join(","),...D].join(` -`),W=new Blob([P],{type:"text/csv;charset=utf-8"}),re=URL.createObjectURL(W),he=document.createElement("a");he.href=re,he.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,he.click(),URL.revokeObjectURL(re)}return t.jsxs("div",{className:"p-8 w-full",children:[$&&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:$}),t.jsx("button",{type:"button",onClick:()=>V(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(oe,{variant:"outline",onClick:ce,disabled:N,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${N?"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(Qr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(ne,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:k,onChange:B=>w(B.target.value)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Yj,{className:"w-4 h-4 text-gray-400"}),t.jsxs("select",{value:b,onChange:B=>C(B.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(oe,{variant:"outline",onClick:Q,disabled:r.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Uj,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Ee,{className:"p-0",children:N?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{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(Yn,{children:[t.jsx(Qn,{children:t.jsxs(rt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(Pe,{className:"text-gray-400",children:"订单号"}),t.jsx(Pe,{className:"text-gray-400",children:"用户"}),t.jsx(Pe,{className:"text-gray-400",children:"商品"}),t.jsx(Pe,{className:"text-gray-400",children:"金额"}),t.jsx(Pe,{className:"text-gray-400",children:"支付方式"}),t.jsx(Pe,{className:"text-gray-400",children:"状态"}),t.jsx(Pe,{className:"text-gray-400",children:"退款原因"}),t.jsx(Pe,{className:"text-gray-400",children:"分销佣金"}),t.jsx(Pe,{className:"text-gray-400",children:"下单时间"}),t.jsx(Pe,{className:"text-gray-400",children:"操作"})]})}),t.jsxs(qn,{children:[r.map(B=>{const D=ee(B);return t.jsxs(rt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsxs(we,{className:"font-mono text-xs text-gray-400",children:[(B.orderSn||B.id||"").slice(0,12),"..."]}),t.jsx(we,{children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:X(B)}),t.jsx("p",{className:"text-gray-500 text-xs",children:le(B.userId)})]})}),t.jsx(we,{children:t.jsxs("div",{children:[t.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[D.name,(B.productType||B.type)==="vip"&&t.jsx(Me,{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:D.type})]})}),t.jsxs(we,{className:"text-[#38bdac] font-bold",children:["¥",Number(B.amount||0).toFixed(2)]}),t.jsx(we,{className:"text-gray-300",children:B.paymentMethod==="wechat"?"微信支付":B.paymentMethod==="alipay"?"支付宝":B.paymentMethod||"微信支付"}),t.jsx(we,{children:B.status==="refunded"?t.jsx(Me,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):B.status==="paid"||B.status==="completed"?t.jsx(Me,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):B.status==="pending"||B.status==="created"?t.jsx(Me,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):t.jsx(Me,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),t.jsx(we,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:B.refundReason,children:B.status==="refunded"&&B.refundReason?B.refundReason:"-"}),t.jsx(we,{className:"text-[#FFD700]",children:B.referrerEarnings?`¥${Number(B.referrerEarnings).toFixed(2)}`:"-"}),t.jsx(we,{className:"text-gray-400 text-sm",children:new Date(B.createdAt).toLocaleString("zh-CN")}),t.jsx(we,{children:(B.status==="paid"||B.status==="completed")&&t.jsxs(oe,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{T(B),Y("")},children:[t.jsx(kp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},B.id)}),r.length===0&&t.jsx(rt,{children:t.jsx(we,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),t.jsx(Sr,{page:v,totalPages:q,total:c,pageSize:E,onPageChange:y,onPageSizeChange:B=>{_(B),y(1)}})]})})}),t.jsx(Bt,{open:!!R,onOpenChange:B=>!B&&T(null),children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Ut,{children:t.jsx(Vt,{className:"text-white",children:"订单退款"})}),R&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",R.orderSn||R.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(R.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(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:F,onChange:B=>Y(B.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(qt,{children:[t.jsx(oe,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>T(null),disabled:K,children:"取消"}),t.jsx(oe,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:I,disabled:K,children:K?"退款中...":"确认退款"})]})]})})]})}var W1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],H1=W1.reduce((r,a)=>{const l=Pp(`Primitive.${a}`),o=h.forwardRef((c,u)=>{const{asChild:f,...p}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...p,ref:u})});return o.displayName=`Primitive.${a}`,{...r,[a]:o}},{}),K1="Label",jx=h.forwardRef((r,a)=>t.jsx(H1.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())}}));jx.displayName=K1;var Nx=jx;const Z=h.forwardRef(({className:r,...a},l)=>t.jsx(Nx,{ref:l,className:Ge("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",r),...a}));Z.displayName=Nx.displayName;function Jd(r){const a=h.useRef({value:r,previous:r});return h.useMemo(()=>(a.current.value!==r&&(a.current.previous=a.current.value,a.current.value=r),a.current.previous),[r])}function Zd(r){const[a,l]=h.useState(void 0);return Rt(()=>{if(r){l({width:r.offsetWidth,height:r.offsetHeight});const o=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const u=c[0];let f,p;if("borderBoxSize"in u){const x=u.borderBoxSize,g=Array.isArray(x)?x[0]:x;f=g.inlineSize,p=g.blockSize}else f=r.offsetWidth,p=r.offsetHeight;l({width:f,height:p})});return o.observe(r,{box:"border-box"}),()=>o.unobserve(r)}else l(void 0)},[r]),a}var $i="Switch",[G1]=Rr($i),[Y1,Q1]=G1($i),bx=h.forwardRef((r,a)=>{const{__scopeSwitch:l,name:o,checked:c,defaultChecked:u,required:f,disabled:p,value:x="on",onCheckedChange:g,form:v,...y}=r,[E,_]=h.useState(null),k=Ke(a,N=>_(N)),w=h.useRef(!1),j=E?v||!!E.closest("form"):!0,[b,C]=Jr({prop:c,defaultProp:u??!1,onChange:g,caller:$i});return t.jsxs(Y1,{scope:l,checked:b,disabled:p,children:[t.jsx(Oe.button,{type:"button",role:"switch","aria-checked":b,"aria-required":f,"data-state":kx(b),"data-disabled":p?"":void 0,disabled:p,value:x,...y,ref:k,onClick:Ae(r.onClick,N=>{C(A=>!A),j&&(w.current=N.isPropagationStopped(),w.current||N.stopPropagation())})}),j&&t.jsx(Cx,{control:E,bubbles:!w.current,name:o,value:x,checked:b,required:f,disabled:p,form:v,style:{transform:"translateX(-100%)"}})]})});bx.displayName=$i;var wx="SwitchThumb",Sx=h.forwardRef((r,a)=>{const{__scopeSwitch:l,...o}=r,c=Q1(wx,l);return t.jsx(Oe.span,{"data-state":kx(c.checked),"data-disabled":c.disabled?"":void 0,...o,ref:a})});Sx.displayName=wx;var q1="SwitchBubbleInput",Cx=h.forwardRef(({__scopeSwitch:r,control:a,checked:l,bubbles:o=!0,...c},u)=>{const f=h.useRef(null),p=Ke(f,u),x=Jd(l),g=Zd(a);return h.useEffect(()=>{const v=f.current;if(!v)return;const y=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(y,"checked").set;if(x!==l&&_){const k=new Event("click",{bubbles:o});_.call(v,l),v.dispatchEvent(k)}},[x,l,o]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:l,...c,tabIndex:-1,ref:p,style:{...c.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Cx.displayName=q1;function kx(r){return r?"checked":"unchecked"}var Ex=bx,X1=Sx;const ht=h.forwardRef(({className:r,...a},l)=>t.jsx(Ex,{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(X1,{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")})}));ht.displayName=Ex.displayName;function eu(r){const a=r+"CollectionProvider",[l,o]=Rr(a),[c,u]=l(a,{collectionRef:{current:null},itemMap:new Map}),f=w=>{const{scope:j,children:b}=w,C=vr.useRef(null),N=vr.useRef(new Map).current;return t.jsx(c,{scope:j,itemMap:N,collectionRef:C,children:b})};f.displayName=a;const p=r+"CollectionSlot",x=$a(p),g=vr.forwardRef((w,j)=>{const{scope:b,children:C}=w,N=u(p,b),A=Ke(j,N.collectionRef);return t.jsx(x,{ref:A,children:C})});g.displayName=p;const v=r+"CollectionItemSlot",y="data-radix-collection-item",E=$a(v),_=vr.forwardRef((w,j)=>{const{scope:b,children:C,...N}=w,A=vr.useRef(null),$=Ke(j,A),V=u(v,b);return vr.useEffect(()=>(V.itemMap.set(A,{ref:A,...N}),()=>void V.itemMap.delete(A))),t.jsx(E,{[y]:"",ref:$,children:C})});_.displayName=v;function k(w){const j=u(r+"CollectionConsumer",w);return vr.useCallback(()=>{const C=j.collectionRef.current;if(!C)return[];const N=Array.from(C.querySelectorAll(`[${y}]`));return Array.from(j.itemMap.values()).sort((V,R)=>N.indexOf(V.ref.current)-N.indexOf(R.ref.current))},[j.collectionRef,j.itemMap])}return[{Provider:f,Slot:g,ItemSlot:_},k,o]}var J1=h.createContext(void 0);function Bi(r){const a=h.useContext(J1);return r||a||"ltr"}var rd="rovingFocusGroup.onEntryFocus",Z1={bubbles:!1,cancelable:!0},Ka="RovingFocusGroup",[Nd,Px,e2]=eu(Ka),[t2,Rx]=Rr(Ka,[e2]),[n2,r2]=t2(Ka),_x=h.forwardRef((r,a)=>t.jsx(Nd.Provider,{scope:r.__scopeRovingFocusGroup,children:t.jsx(Nd.Slot,{scope:r.__scopeRovingFocusGroup,children:t.jsx(s2,{...r,ref:a})})}));_x.displayName=Ka;var s2=h.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,orientation:o,loop:c=!1,dir:u,currentTabStopId:f,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:x,onEntryFocus:g,preventScrollOnEntryFocus:v=!1,...y}=r,E=h.useRef(null),_=Ke(a,E),k=Bi(u),[w,j]=Jr({prop:f,defaultProp:p??null,onChange:x,caller:Ka}),[b,C]=h.useState(!1),N=Cr(g),A=Px(l),$=h.useRef(!1),[V,R]=h.useState(0);return h.useEffect(()=>{const T=E.current;if(T)return T.addEventListener(rd,N),()=>T.removeEventListener(rd,N)},[N]),t.jsx(n2,{scope:l,orientation:o,dir:k,loop:c,currentTabStopId:w,onItemFocus:h.useCallback(T=>j(T),[j]),onItemShiftTab:h.useCallback(()=>C(!0),[]),onFocusableItemAdd:h.useCallback(()=>R(T=>T+1),[]),onFocusableItemRemove:h.useCallback(()=>R(T=>T-1),[]),children:t.jsx(Oe.div,{tabIndex:b||V===0?-1:0,"data-orientation":o,...y,ref:_,style:{outline:"none",...r.style},onMouseDown:Ae(r.onMouseDown,()=>{$.current=!0}),onFocus:Ae(r.onFocus,T=>{const F=!$.current;if(T.target===T.currentTarget&&F&&!b){const Y=new CustomEvent(rd,Z1);if(T.currentTarget.dispatchEvent(Y),!Y.defaultPrevented){const K=A().filter(ee=>ee.focusable),J=K.find(ee=>ee.active),ce=K.find(ee=>ee.id===w),le=[J,ce,...K].filter(Boolean).map(ee=>ee.ref.current);Ax(le,v)}}$.current=!1}),onBlur:Ae(r.onBlur,()=>C(!1))})})}),Tx="RovingFocusGroupItem",Ix=h.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,focusable:o=!0,active:c=!1,tabStopId:u,children:f,...p}=r,x=wr(),g=u||x,v=r2(Tx,l),y=v.currentTabStopId===g,E=Px(l),{onFocusableItemAdd:_,onFocusableItemRemove:k,currentTabStopId:w}=v;return h.useEffect(()=>{if(o)return _(),()=>k()},[o,_,k]),t.jsx(Nd.ItemSlot,{scope:l,id:g,focusable:o,active:c,children:t.jsx(Oe.span,{tabIndex:y?0:-1,"data-orientation":v.orientation,...p,ref:a,onMouseDown:Ae(r.onMouseDown,j=>{o?v.onItemFocus(g):j.preventDefault()}),onFocus:Ae(r.onFocus,()=>v.onItemFocus(g)),onKeyDown:Ae(r.onKeyDown,j=>{if(j.key==="Tab"&&j.shiftKey){v.onItemShiftTab();return}if(j.target!==j.currentTarget)return;const b=i2(j,v.orientation,v.dir);if(b!==void 0){if(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey)return;j.preventDefault();let N=E().filter(A=>A.focusable).map(A=>A.ref.current);if(b==="last")N.reverse();else if(b==="prev"||b==="next"){b==="prev"&&N.reverse();const A=N.indexOf(j.currentTarget);N=v.loop?o2(N,A+1):N.slice(A+1)}setTimeout(()=>Ax(N))}}),children:typeof f=="function"?f({isCurrentTabStop:y,hasTabStop:w!=null}):f})})});Ix.displayName=Tx;var a2={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function l2(r,a){return a!=="rtl"?r:r==="ArrowLeft"?"ArrowRight":r==="ArrowRight"?"ArrowLeft":r}function i2(r,a,l){const o=l2(r.key,l);if(!(a==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(a==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return a2[o]}function Ax(r,a=!1){const l=document.activeElement;for(const o of r)if(o===l||(o.focus({preventScroll:a}),document.activeElement!==l))return}function o2(r,a){return r.map((l,o)=>r[(a+o)%r.length])}var c2=_x,d2=Ix,Ui="Tabs",[u2]=Rr(Ui,[Rx]),Mx=Rx(),[f2,tu]=u2(Ui),Dx=h.forwardRef((r,a)=>{const{__scopeTabs:l,value:o,onValueChange:c,defaultValue:u,orientation:f="horizontal",dir:p,activationMode:x="automatic",...g}=r,v=Bi(p),[y,E]=Jr({prop:o,onChange:c,defaultProp:u??"",caller:Ui});return t.jsx(f2,{scope:l,baseId:wr(),value:y,onValueChange:E,orientation:f,dir:v,activationMode:x,children:t.jsx(Oe.div,{dir:v,"data-orientation":f,...g,ref:a})})});Dx.displayName=Ui;var Lx="TabsList",Ox=h.forwardRef((r,a)=>{const{__scopeTabs:l,loop:o=!0,...c}=r,u=tu(Lx,l),f=Mx(l);return t.jsx(c2,{asChild:!0,...f,orientation:u.orientation,dir:u.dir,loop:o,children:t.jsx(Oe.div,{role:"tablist","aria-orientation":u.orientation,...c,ref:a})})});Ox.displayName=Lx;var Fx="TabsTrigger",zx=h.forwardRef((r,a)=>{const{__scopeTabs:l,value:o,disabled:c=!1,...u}=r,f=tu(Fx,l),p=Mx(l),x=Ux(f.baseId,o),g=Vx(f.baseId,o),v=o===f.value;return t.jsx(d2,{asChild:!0,...p,focusable:!c,active:v,children:t.jsx(Oe.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":g,"data-state":v?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:x,...u,ref:a,onMouseDown:Ae(r.onMouseDown,y=>{!c&&y.button===0&&y.ctrlKey===!1?f.onValueChange(o):y.preventDefault()}),onKeyDown:Ae(r.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&f.onValueChange(o)}),onFocus:Ae(r.onFocus,()=>{const y=f.activationMode!=="manual";!v&&!c&&y&&f.onValueChange(o)})})})});zx.displayName=Fx;var $x="TabsContent",Bx=h.forwardRef((r,a)=>{const{__scopeTabs:l,value:o,forceMount:c,children:u,...f}=r,p=tu($x,l),x=Ux(p.baseId,o),g=Vx(p.baseId,o),v=o===p.value,y=h.useRef(v);return h.useEffect(()=>{const E=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(E)},[]),t.jsx(Ha,{present:c||v,children:({present:E})=>t.jsx(Oe.div,{"data-state":v?"active":"inactive","data-orientation":p.orientation,role:"tabpanel","aria-labelledby":x,hidden:!E,id:g,tabIndex:0,...f,ref:a,style:{...r.style,animationDuration:y.current?"0s":void 0},children:E&&u})})});Bx.displayName=$x;function Ux(r,a){return`${r}-trigger-${a}`}function Vx(r,a){return`${r}-content-${a}`}var h2=Dx,Wx=Ox,Hx=zx,Kx=Bx;const nu=h2,Vi=h.forwardRef(({className:r,...a},l)=>t.jsx(Wx,{ref:l,className:Ge("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",r),...a}));Vi.displayName=Wx.displayName;const an=h.forwardRef(({className:r,...a},l)=>t.jsx(Hx,{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}));an.displayName=Hx.displayName;const ln=h.forwardRef(({className:r,...a},l)=>t.jsx(Kx,{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}));ln.displayName=Kx.displayName;function m2({open:r,onClose:a,userId:l,onUserUpdated:o}){var ee;const[c,u]=h.useState(null),[f,p]=h.useState([]),[x,g]=h.useState([]),[v,y]=h.useState(!1),[E,_]=h.useState(!1),[k,w]=h.useState(!1),[j,b]=h.useState("info"),[C,N]=h.useState(""),[A,$]=h.useState(""),[V,R]=h.useState([]),[T,F]=h.useState("");h.useEffect(()=>{r&&l&&Y()},[r,l]);async function Y(){if(l){y(!0);try{const q=await We(`/api/db/users?id=${encodeURIComponent(l)}`);if(q!=null&&q.success&&q.user){const I=q.user;u(I),N(I.phone||""),$(I.nickname||""),R(typeof I.tags=="string"?JSON.parse(I.tags||"[]"):[])}try{const I=await We(`/api/user/track?userId=${encodeURIComponent(l)}&limit=50`);I!=null&&I.success&&I.tracks&&p(I.tracks)}catch{p([])}try{const I=await We(`/api/db/users/referrals?userId=${encodeURIComponent(l)}`);I!=null&&I.success&&I.referrals&&g(I.referrals)}catch{g([])}}catch(q){console.error("Load user detail error:",q)}finally{y(!1)}}}async function K(){if(!(c!=null&&c.phone)){alert("用户未绑定手机号,无法同步");return}_(!0);try{const q=await jt("/api/ckb/sync",{action:"full_sync",phone:c.phone,userId:c.id});q!=null&&q.success?(alert("同步成功"),Y()):alert("同步失败: "+(q==null?void 0:q.error))}catch(q){console.error("Sync CKB error:",q),alert("同步失败")}finally{_(!1)}}async function J(){if(c){w(!0);try{const q={id:c.id,phone:C||void 0,nickname:A||void 0,tags:JSON.stringify(V)},I=await Pt("/api/db/users",q);I!=null&&I.success?(alert("保存成功"),Y(),o==null||o()):alert("保存失败: "+(I==null?void 0:I.error))}catch(q){console.error("Save user error:",q),alert("保存失败")}finally{w(!1)}}}const ce=()=>{T&&!V.includes(T)&&(R([...V,T]),F(""))},X=q=>{R(V.filter(I=>I!==q))},le=q=>{const Q={view_chapter:Wn,purchase:pd,match:vn,login:qr,register:qr,share:Yr,bind_phone:RN,bind_wechat:bN}[q]||Nm;return t.jsx(Q,{className:"w-4 h-4"})};return r?t.jsx(Bt,{open:r,onOpenChange:()=>a(),children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[t.jsx(Ut,{children:t.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[t.jsx(qr,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(c==null?void 0:c.phone)&&t.jsx(Me,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"})]})}),v?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(Ze,{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:""}):((ee=c.nickname)==null?void 0:ee.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(Me,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),c.hasFullBook&&t.jsx(Me,{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(nu,{value:j,onValueChange:b,className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs(Vi,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-4",children:[t.jsx(an,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"基础信息"}),t.jsx(an,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"标签体系"}),t.jsx(an,{value:"tracks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"行为轨迹"}),t.jsx(an,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"关系链路"})]}),t.jsxs(ln,{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(Z,{className:"text-gray-300",children:"手机号"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:C,onChange:q=>N(q.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"昵称"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:A,onChange:q=>$(q.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(Yr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),t.jsx(oe,{size:"sm",onClick:K,disabled:E||!c.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Ze,{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(Me,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):t.jsx(Me,{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(ln,{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(UN,{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:[V.map((q,I)=>t.jsxs(Me,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[q,t.jsx("button",{type:"button",onClick:()=>X(q),className:"ml-1 hover:text-red-400",children:t.jsx(on,{className:"w-3 h-3"})})]},I)),V.length===0&&t.jsx("span",{className:"text-gray-500 text-sm",children:"暂无标签"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"添加新标签",value:T,onChange:q=>F(q.target.value),onKeyDown:q=>q.key==="Enter"&&ce()}),t.jsx(oe,{onClick:ce,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})}),t.jsx(ln,{value:"tracks",className:"flex-1 overflow-auto",children:t.jsx("div",{className:"space-y-2",children:f.length>0?f.map(q=>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:le(q.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:q.actionLabel}),q.chapterTitle&&t.jsxs("span",{className:"text-gray-400 text-sm",children:["- ",q.chapterTitle]})]}),t.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:[t.jsx(wp,{className:"w-3 h-3 inline mr-1"}),q.timeAgo," · ",new Date(q.createdAt).toLocaleString()]})]})]},q.id)):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Nm,{className:"w-10 h-10 text-[#38bdac]/40 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-400",children:"暂无行为轨迹"})]})})}),t.jsx(ln,{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(Yr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"推荐的用户"})]}),t.jsxs(Me,{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((q,I)=>{var B;const Q=q;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:((B=Q.nickname)==null?void 0:B.charAt(0))||"?"}),t.jsx("span",{className:"text-white text-sm",children:Q.nickname})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[Q.status==="vip"&&t.jsx(Me,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),t.jsx("span",{className:"text-gray-500 text-xs",children:Q.createdAt?new Date(Q.createdAt).toLocaleDateString():""})]})]},Q.id||I)}):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(oe,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(on,{className:"w-4 h-4 mr-2"}),"关闭"]}),t.jsxs(oe,{onClick:J,disabled:k,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),k?"保存中...":"保存修改"]})]})]}):t.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}const sd={isVip:!1,vipExpireDate:"",vipSort:"",vipRole:"",vipRoleCustom:"",vipName:"",vipProject:"",vipContact:"",vipBio:""};function p2({open:r,onClose:a,userId:l,userNickname:o="",onSaved:c}){const[u,f]=h.useState(sd),[p,x]=h.useState([]),[g,v]=h.useState(!1),[y,E]=h.useState(!1);h.useEffect(()=>{if(!r){f(sd);return}let k=!1;return v(!0),Promise.all([We("/api/db/vip-roles"),l?We(`/api/db/users?id=${encodeURIComponent(l)}`):Promise.resolve(null)]).then(([w,j])=>{if(k)return;const b=w!=null&&w.success&&w.data?w.data:[];x(b);const C=j&&j.user?j.user:null;if(C){const N=String(C.vipRole??""),A=b.some($=>$.name===N);f({isVip:!!(C.isVip??!1),vipExpireDate:C.vipExpireDate?String(C.vipExpireDate).slice(0,10):"",vipSort:typeof C.vipSort=="number"?C.vipSort:"",vipRole:A?N:N?"__custom__":"",vipRoleCustom:A?"":N,vipName:String(C.vipName??""),vipProject:String(C.vipProject??""),vipContact:String(C.vipContact??""),vipBio:String(C.vipBio??"")})}else f(sd)}).catch(w=>{k||console.error("Load error:",w)}).finally(()=>{k||v(!1)}),()=>{k=!0}},[r,l]);async function _(){if(l){if(u.isVip&&!u.vipExpireDate.trim()){alert("开启 VIP 时请填写有效到期日");return}if(u.isVip&&u.vipExpireDate.trim()){const k=new Date(u.vipExpireDate);if(isNaN(k.getTime())){alert("到期日格式无效,请使用 YYYY-MM-DD");return}}E(!0);try{const k=u.vipRole==="__custom__"?u.vipRoleCustom.trim():u.vipRole,w={id:l,isVip:u.isVip,vipExpireDate:u.isVip?u.vipExpireDate:void 0,vipSort:u.vipSort===""?void 0:u.vipSort,vipRole:k||void 0,vipName:u.vipName||void 0,vipProject:u.vipProject||void 0,vipContact:u.vipContact||void 0,vipBio:u.vipBio||void 0},j=await Pt("/api/db/users",w);j!=null&&j.success?(alert("VIP 设置已保存"),c==null||c(),a()):alert("保存失败: "+(j==null?void 0:j.error))}catch(k){console.error("Save VIP error:",k),alert("保存失败")}finally{E(!1)}}}return r?t.jsx(Bt,{open:r,onOpenChange:()=>a(),children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Ut,{children:t.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[t.jsx(Li,{className:"w-5 h-5 text-amber-400"}),"设置 VIP - ",o||l]})}),g?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(Z,{className:"text-gray-300",children:"VIP 会员"}),t.jsx(ht,{checked:u.isVip,onCheckedChange:k=>f(w=>({...w,isVip:k}))})]}),u.isVip&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{className:"text-gray-300",children:["到期日 (YYYY-MM-DD) ",t.jsx("span",{className:"text-amber-400",children:"*"})]}),t.jsx(ne,{type:"date",className:"bg-[#0a1628] border-gray-700 text-white",value:u.vipExpireDate,onChange:k=>f(w=>({...w,vipExpireDate:k.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"排序"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"数字越小越靠前,留空按时间",value:u.vipSort===""?"":u.vipSort,onChange:k=>{const w=k.target.value;f(j=>({...j,vipSort:w===""?"":parseInt(w,10)||0}))}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{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:k=>f(w=>({...w,vipRole:k.target.value})),children:[t.jsx("option",{value:"",children:"请选择或下方手动填写"}),p.map(k=>t.jsx("option",{value:k.name,children:k.name},k.id)),t.jsx("option",{value:"__custom__",children:"其他(手动填写)"})]}),u.vipRole==="__custom__"&&t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"输入自定义角色",value:u.vipRoleCustom,onChange:k=>f(w=>({...w,vipRoleCustom:k.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"VIP 展示名"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创业老板排行展示名",value:u.vipName,onChange:k=>f(w=>({...w,vipName:k.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"项目/公司"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"项目名称",value:u.vipProject,onChange:k=>f(w=>({...w,vipProject:k.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"联系方式"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"微信号或手机",value:u.vipContact,onChange:k=>f(w=>({...w,vipContact:k.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"一句话简介"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"简要描述业务",value:u.vipBio,onChange:k=>f(w=>({...w,vipBio:k.target.value}))})]})]}),t.jsxs(qt,{children:[t.jsxs(oe,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(on,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(oe,{onClick:_,disabled:y||g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),y?"保存中...":"保存"]})]})]})}):null}function x2(){var ss,Ys,Qs,qs,Xs;const[r,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f,p]=h.useState(10),[x,g]=h.useState(""),v=Xd(x,300),[y,E]=h.useState("all"),[_,k]=h.useState(!0),[w,j]=h.useState(null),[b,C]=h.useState(!1),[N,A]=h.useState(!1),[$,V]=h.useState(null),[R,T]=h.useState(""),[F,Y]=h.useState(""),[K,J]=h.useState(!1),[ce,X]=h.useState(!1),[le,ee]=h.useState({referrals:[],stats:{}}),[q,I]=h.useState(!1),[Q,B]=h.useState(null),[D,P]=h.useState(!1),[W,re]=h.useState(null),[he,me]=h.useState(!1),[se,pe]=h.useState(null),[L,ue]=h.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1});async function xe(){k(!0),j(null);try{const te=new URLSearchParams({page:String(c),pageSize:String(f),search:v,...y==="vip"&&{vip:"true"}}),Ue=await We(`/api/db/users?${te}`);Ue!=null&&Ue.success?(a(Ue.users||[]),o(Ue.total??0)):j((Ue==null?void 0:Ue.error)||"加载失败")}catch(te){console.error("Load users error:",te),j("网络错误,请检查连接")}finally{k(!1)}}h.useEffect(()=>{u(1)},[v,y]),h.useEffect(()=>{xe()},[c,f,v,y]);const Re=Math.ceil(l/f)||1;async function De(te){if(confirm("确定要删除这个用户吗?"))try{const Ue=await Wa(`/api/db/users?id=${encodeURIComponent(te)}`);Ue!=null&&Ue.success?xe():alert("删除失败: "+((Ue==null?void 0:Ue.error)||"未知错误"))}catch(Ue){console.error("Delete user error:",Ue),alert("删除失败")}}const Fe=te=>{V(te),ue({phone:te.phone||"",nickname:te.nickname||"",password:"",isAdmin:!!(te.isAdmin??!1),hasFullBook:!!(te.hasFullBook??!1)}),C(!0)},Qe=()=>{V(null),ue({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),C(!0)};async function st(){if(!L.phone||!L.nickname){alert("请填写手机号和昵称");return}J(!0);try{if($){const te=await Pt("/api/db/users",{id:$.id,nickname:L.nickname,isAdmin:L.isAdmin,hasFullBook:L.hasFullBook,...L.password&&{password:L.password}});if(!(te!=null&&te.success)){alert("更新失败: "+((te==null?void 0:te.error)||"未知错误"));return}}else{const te=await jt("/api/db/users",{phone:L.phone,nickname:L.nickname,password:L.password,isAdmin:L.isAdmin});if(!(te!=null&&te.success)){alert("创建失败: "+((te==null?void 0:te.error)||"未知错误"));return}}C(!1),xe()}catch(te){console.error("Save user error:",te),alert("保存失败")}finally{J(!1)}}const et=te=>{V(te),T(""),Y(""),A(!0)};async function At(te){B(te),X(!0),I(!0);try{const Ue=await We(`/api/db/users/referrals?userId=${encodeURIComponent(te.id)}`);Ue!=null&&Ue.success?ee({referrals:Ue.referrals||[],stats:Ue.stats||{}}):ee({referrals:[],stats:{}})}catch(Ue){console.error("Load referrals error:",Ue),ee({referrals:[],stats:{}})}finally{I(!1)}}const Mt=te=>{re(te.id),P(!0)},Ir=te=>{pe(te),me(!0)};async function Xn(){if(!R){alert("请输入新密码");return}if(R!==F){alert("两次输入的密码不一致");return}if(R.length<6){alert("密码长度不能少于6位");return}J(!0);try{const te=await Pt("/api/db/users",{id:$==null?void 0:$.id,password:R});te!=null&&te.success?(alert("密码修改成功"),A(!1)):alert("密码修改失败: "+((te==null?void 0:te.error)||"未知错误"))}catch(te){console.error("Change password error:",te),alert("密码修改失败")}finally{J(!1)}}return t.jsxs("div",{className:"p-8 w-full",children:[w&&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:w}),t.jsx("button",{type:"button",onClick:()=>j(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," 位注册用户",y==="vip"&&",当前筛选 VIP"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(oe,{variant:"outline",onClick:xe,disabled:_,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${_?"animate-spin":""}`}),"刷新"]}),t.jsxs("select",{value:y,onChange:te=>{E(te.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(Qr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(ne,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-64",value:x,onChange:te=>g(te.target.value)})]}),t.jsxs(oe,{onClick:Qe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Cm,{className:"w-4 h-4 mr-2"}),"添加用户"]})]})]}),t.jsx(Bt,{open:b,onOpenChange:C,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[t.jsx(Ut,{children:t.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[$?t.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(Cm,{className:"w-5 h-5 text-[#38bdac]"}),$?"编辑用户":"添加用户"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"手机号"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:L.phone,onChange:te=>ue({...L,phone:te.target.value}),disabled:!!$})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"昵称"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:L.nickname,onChange:te=>ue({...L,nickname:te.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:$?"新密码 (留空则不修改)":"密码"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:$?"留空则不修改":"请输入密码",value:L.password,onChange:te=>ue({...L,password:te.target.value})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(Z,{className:"text-gray-300",children:"管理员权限"}),t.jsx(ht,{checked:L.isAdmin,onCheckedChange:te=>ue({...L,isAdmin:te})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(Z,{className:"text-gray-300",children:"已购全书"}),t.jsx(ht,{checked:L.hasFullBook,onCheckedChange:te=>ue({...L,hasFullBook:te})})]})]}),t.jsxs(qt,{children:[t.jsxs(oe,{variant:"outline",onClick:()=>C(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(on,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(oe,{onClick:st,disabled:K,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),K?"保存中...":"保存"]})]})]})}),t.jsx(Bt,{open:N,onOpenChange:A,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Ut,{children:t.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[t.jsx(bm,{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:["用户:",$==null?void 0:$.nickname]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["手机号:",$==null?void 0:$.phone]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"新密码"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入新密码 (至少6位)",value:R,onChange:te=>T(te.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"确认密码"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请再次输入新密码",value:F,onChange:te=>Y(te.target.value)})]})]}),t.jsxs(qt,{children:[t.jsx(oe,{variant:"outline",onClick:()=>A(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(oe,{onClick:Xn,disabled:K,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:K?"保存中...":"确认修改"})]})]})}),t.jsx(m2,{open:D,onClose:()=>P(!1),userId:W,onUserUpdated:xe}),t.jsx(p2,{open:he,onClose:()=>{me(!1),pe(null)},userId:(se==null?void 0:se.id)??null,userNickname:se==null?void 0:se.nickname,onSaved:xe}),t.jsx(Bt,{open:ce,onOpenChange:X,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[t.jsx(Ut,{children:t.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[t.jsx(vn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系详情 - ",Q==null?void 0:Q.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:((ss=le.stats)==null?void 0:ss.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:((Ys=le.stats)==null?void 0:Ys.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:["¥",(((Qs=le.stats)==null?void 0:Qs.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:["¥",(((qs=le.stats)==null?void 0:qs.pendingEarnings)||0).toFixed(2)]}),t.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),q?t.jsxs("div",{className:"flex items-center justify-center py-8",children:[t.jsx(Ze,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Xs=le.referrals)==null?void 0:Xs.length)??0)>0?t.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(le.referrals??[]).map((te,Ue)=>{var cn;const Nt=te;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:((cn=Nt.nickname)==null?void 0:cn.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white text-sm",children:Nt.nickname}),t.jsx("div",{className:"text-xs text-gray-500",children:Nt.phone||(Nt.hasOpenId?"微信用户":"未绑定")})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[Nt.status==="vip"&&t.jsx(Me,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Nt.status==="paid"&&t.jsxs(Me,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Nt.purchasedSections,"章"]}),Nt.status==="free"&&t.jsx(Me,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),t.jsx("span",{className:"text-xs text-gray-500",children:Nt.createdAt?new Date(Nt.createdAt).toLocaleDateString():""})]})]},Nt.id||Ue)})}):t.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),t.jsx(qt,{children:t.jsx(oe,{variant:"outline",onClick:()=>X(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Ee,{className:"p-0",children:_?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{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(Yn,{children:[t.jsx(Qn,{children:t.jsxs(rt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(Pe,{className:"text-gray-400",children:"用户信息"}),t.jsx(Pe,{className:"text-gray-400",children:"绑定信息"}),t.jsx(Pe,{className:"text-gray-400",children:"购买状态"}),t.jsx(Pe,{className:"text-gray-400",children:"分销收益"}),t.jsx(Pe,{className:"text-gray-400",children:"推广码"}),t.jsx(Pe,{className:"text-gray-400",children:"注册时间"}),t.jsx(Pe,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(qn,{children:[r.map(te=>{var Ue,Nt,cn;return t.jsxs(rt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(we,{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:te.avatar?t.jsx("img",{src:te.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Ue=te.nickname)==null?void 0:Ue.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:te.nickname}),te.isAdmin&&t.jsx(Me,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),te.openId&&!((Nt=te.id)!=null&&Nt.startsWith("user_"))&&t.jsx(Me,{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:te.openId?te.openId.slice(0,12)+"...":(cn=te.id)==null?void 0:cn.slice(0,12)})]})]})}),t.jsx(we,{children:t.jsxs("div",{className:"space-y-1",children:[te.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:te.phone})]}),te.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:te.wechatId})]}),te.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:te.openId,children:[te.openId.slice(0,12),"..."]})]}),!te.phone&&!te.wechatId&&!te.openId&&t.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),t.jsx(we,{children:te.hasFullBook?t.jsx(Me,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):t.jsx(Me,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),t.jsx(we,{children:t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(te.earnings||0)).toFixed(2)]}),parseFloat(String(te.pendingEarnings||0))>0&&t.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(te.pendingEarnings||0)).toFixed(2)]}),t.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>At(te),onKeyDown:Ar=>Ar.key==="Enter"&&At(te),role:"button",tabIndex:0,children:[t.jsx(vn,{className:"w-3 h-3"}),"绑定",te.referralCount||0,"人"]})]})}),t.jsx(we,{children:t.jsx("code",{className:"text-[#38bdac] text-xs bg-[#38bdac]/10 px-2 py-0.5 rounded",children:te.referralCode||"-"})}),t.jsx(we,{className:"text-gray-400",children:te.createdAt?new Date(te.createdAt).toLocaleDateString():"-"}),t.jsx(we,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>Ir(te),className:"text-gray-400 hover:text-amber-400 hover:bg-amber-400/10",title:"设置 VIP",children:t.jsx(Li,{className:"w-4 h-4"})}),t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>Mt(te),className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"查看详情",children:t.jsx(Ms,{className:"w-4 h-4"})}),t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>Fe(te),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑",children:t.jsx(sn,{className:"w-4 h-4"})}),t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>et(te),className:"text-gray-400 hover:text-yellow-400 hover:bg-yellow-400/10",title:"修改密码",children:t.jsx(bm,{className:"w-4 h-4"})}),t.jsx(oe,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>De(te.id),title:"删除",children:t.jsx(Vn,{className:"w-4 h-4"})})]})})]},te.id)}),r.length===0&&t.jsx(rt,{children:t.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),t.jsx(Sr,{page:c,totalPages:Re,total:l,pageSize:f,onPageChange:u,onPageSizeChange:te=>{p(te),u(1)}})]})})})]})}function g2(){const[r,a]=h.useState("overview"),[l,o]=h.useState([]),[c,u]=h.useState(null),[f,p]=h.useState([]),[x,g]=h.useState([]),[v,y]=h.useState([]),[E,_]=h.useState(!0),[k,w]=h.useState(null),[j,b]=h.useState(""),[C,N]=h.useState("all"),[A,$]=h.useState(1),[V,R]=h.useState(10),[T,F]=h.useState(0),[Y,K]=h.useState(new Set),[J,ce]=h.useState(null),[X,le]=h.useState(""),[ee,q]=h.useState(!1);h.useEffect(()=>{I()},[]),h.useEffect(()=>{$(1)},[r,C]),h.useEffect(()=>{Q(r)},[r]),h.useEffect(()=>{["orders","bindings","withdrawals"].includes(r)&&Q(r,!0)},[A,V,C,j]);async function I(){w(null);try{const L=await We("/api/admin/distribution/overview");L!=null&&L.success&&L.overview&&u(L.overview)}catch(L){console.error("[Admin] 概览接口异常:",L),w("加载概览失败")}try{const L=await We("/api/db/users");y((L==null?void 0:L.users)||[])}catch(L){console.error("[Admin] 用户数据加载失败:",L)}}async function Q(L,ue=!1){var xe;if(!(!ue&&Y.has(L))){_(!0);try{const Re=v;switch(L){case"overview":break;case"orders":{try{const De=new URLSearchParams({page:String(A),pageSize:String(V),...C!=="all"&&{status:C},...j&&{search:j}}),Fe=await We(`/api/orders?${De}`);if(Fe!=null&&Fe.success&&Fe.orders){const Qe=Fe.orders.map(st=>{const et=Re.find(Mt=>Mt.id===st.userId),At=st.referrerId?Re.find(Mt=>Mt.id===st.referrerId):null;return{...st,amount:parseFloat(String(st.amount))||0,userNickname:(et==null?void 0:et.nickname)||st.userNickname||"未知用户",userPhone:(et==null?void 0:et.phone)||st.userPhone||"-",referrerNickname:(At==null?void 0:At.nickname)||null,referrerCode:(At==null?void 0:At.referralCode)??null,type:st.productType||st.type}});o(Qe),F(Fe.total??Qe.length)}else o([]),F(0)}catch(De){console.error(De),w("加载订单失败"),o([])}break}case"bindings":{try{const De=new URLSearchParams({page:String(A),pageSize:String(V),...C!=="all"&&{status:C}}),Fe=await We(`/api/db/distribution?${De}`);p((Fe==null?void 0:Fe.bindings)||[]),F((Fe==null?void 0:Fe.total)??((xe=Fe==null?void 0:Fe.bindings)==null?void 0:xe.length)??0)}catch(De){console.error(De),w("加载绑定数据失败"),p([])}break}case"withdrawals":{try{const De=C==="completed"?"success":C==="rejected"?"failed":C,Fe=new URLSearchParams({...De&&De!=="all"&&{status:De},page:String(A),pageSize:String(V)}),Qe=await We(`/api/admin/withdrawals?${Fe}`);if(Qe!=null&&Qe.success&&Qe.withdrawals){const st=Qe.withdrawals.map(et=>({...et,account:et.account??"未绑定微信号",status:et.status==="success"?"completed":et.status==="failed"?"rejected":et.status}));g(st),F((Qe==null?void 0:Qe.total)??st.length)}else Qe!=null&&Qe.success||w(`获取提现记录失败: ${(Qe==null?void 0:Qe.error)||"未知错误"}`),g([])}catch(De){console.error(De),w("加载提现数据失败"),g([])}break}}K(De=>new Set(De).add(L))}catch(Re){console.error(Re)}finally{_(!1)}}}async function B(){w(null),K(L=>{const ue=new Set(L);return ue.delete(r),ue}),r==="overview"&&I(),await Q(r,!0)}async function D(L){if(confirm("确认审核通过并打款?"))try{const ue=await Pt("/api/admin/withdrawals",{id:L,action:"approve"});if(!(ue!=null&&ue.success)){const xe=(ue==null?void 0:ue.message)||(ue==null?void 0:ue.error)||"操作失败";alert(xe);return}await B()}catch(ue){console.error(ue),alert("操作失败")}}async function P(L){const ue=prompt("请输入拒绝原因:");if(ue)try{const xe=await Pt("/api/admin/withdrawals",{id:L,action:"reject",errorMessage:ue});if(!(xe!=null&&xe.success)){alert((xe==null?void 0:xe.error)||"操作失败");return}await B()}catch(xe){console.error(xe),alert("操作失败")}}async function W(){var L;if(!(!(J!=null&&J.orderSn)&&!(J!=null&&J.id))){q(!0),w(null);try{const ue=await Pt("/api/admin/orders/refund",{orderSn:J.orderSn||J.id,reason:X||void 0});ue!=null&&ue.success?(ce(null),le(""),await Q("orders",!0)):w((ue==null?void 0:ue.error)||"退款失败")}catch(ue){const xe=ue;w(((L=xe==null?void 0:xe.data)==null?void 0:L.error)||"退款失败,请检查网络后重试")}finally{q(!1)}}}function re(L){const ue={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"},xe={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return t.jsx(Me,{className:`${ue[L]||"bg-gray-500/20 text-gray-400"} border-0`,children:xe[L]||L})}const he=Math.ceil(T/V)||1,me=l,se=f.filter(L=>{var xe,Re,De,Fe;if(!j)return!0;const ue=j.toLowerCase();return((xe=L.refereeNickname)==null?void 0:xe.toLowerCase().includes(ue))||((Re=L.refereePhone)==null?void 0:Re.includes(ue))||((De=L.referrerName)==null?void 0:De.toLowerCase().includes(ue))||((Fe=L.referrerCode)==null?void 0:Fe.toLowerCase().includes(ue))}),pe=x.filter(L=>{var xe;if(!j)return!0;const ue=j.toLowerCase();return((xe=L.userName)==null?void 0:xe.toLowerCase().includes(ue))||L.account&&L.account.toLowerCase().includes(ue)});return t.jsxs("div",{className:"p-8 w-full",children:[k&&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:k}),t.jsx("button",{type:"button",onClick:()=>w(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(oe,{onClick:B,disabled:E,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[t.jsx(Ze,{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:gd},{key:"orders",label:"订单管理",icon:yi},{key:"bindings",label:"绑定管理",icon:Yr},{key:"withdrawals",label:"提现审核",icon:Os}].map(L=>t.jsxs("button",{type:"button",onClick:()=>{a(L.key),N("all"),b("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${r===L.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[t.jsx(L.icon,{className:"w-4 h-4"}),L.label]},L.key))}),E?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(Ze,{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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Ee,{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(Ms,{className:"w-6 h-6 text-blue-400"})})]})})}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Ee,{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(Yr,{className:"w-6 h-6 text-green-400"})})]})})}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Ee,{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(ym,{className:"w-6 h-6 text-purple-400"})})]})})}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Ee,{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(yi,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(ke,{className:"bg-orange-500/10 border-orange-500/30",children:t.jsx(Ee,{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(wp,{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(ke,{className:"bg-blue-500/10 border-blue-500/30",children:t.jsx(Ee,{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(Os,{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(oe,{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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx($e,{children:t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(za,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),t.jsx(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx($e,{children:t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(gd,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),t.jsxs(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx($e,{children:t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(vn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),t.jsx(Ee,{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(Qr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ne,{value:j,onChange:L=>b(L.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:C,onChange:L=>N(L.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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Ee,{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(L=>{var ue,xe;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:[(ue=L.id)==null?void 0:ue.slice(0,12),"..."]}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:L.userNickname}),t.jsx("p",{className:"text-gray-500 text-xs",children:L.userPhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:(()=>{const Re=L.productType||L.type;return Re==="fullbook"?`${L.bookName||"《底层逻辑》"} - 全本`:Re==="match"?"匹配次数购买":`${L.bookName||"《底层逻辑》"} - ${L.sectionTitle||L.chapterTitle||`章节${L.productId||L.sectionId||""}`}`})()}),t.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Re=L.productType||L.type;return Re==="fullbook"?"全书解锁":Re==="match"?"功能权益":L.chapterTitle||"单章购买"})()})]})}),t.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof L.amount=="number"?L.amount.toFixed(2):parseFloat(String(L.amount||"0")).toFixed(2)]}),t.jsx("td",{className:"p-4 text-gray-300",children:L.paymentMethod==="wechat"?"微信支付":L.paymentMethod==="alipay"?"支付宝":L.paymentMethod||"微信支付"}),t.jsx("td",{className:"p-4",children:L.status==="refunded"?t.jsx(Me,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):L.status==="completed"||L.status==="paid"?t.jsx(Me,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):L.status==="pending"||L.status==="created"?t.jsx(Me,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):t.jsx(Me,{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:L.refundReason,children:L.status==="refunded"&&L.refundReason?L.refundReason:"-"}),t.jsx("td",{className:"p-4 text-gray-300 text-sm",children:L.referrerId||L.referralCode?t.jsxs("span",{title:L.referralCode||L.referrerCode||L.referrerId||"",children:[L.referrerNickname||L.referralCode||L.referrerCode||((xe=L.referrerId)==null?void 0:xe.slice(0,8)),(L.referralCode||L.referrerCode)&&` (${L.referralCode||L.referrerCode})`]}):"-"}),t.jsx("td",{className:"p-4 text-[#FFD700]",children:L.referrerEarnings?`¥${(typeof L.referrerEarnings=="number"?L.referrerEarnings:parseFloat(String(L.referrerEarnings))).toFixed(2)}`:"-"}),t.jsx("td",{className:"p-4 text-gray-400 text-sm",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:(L.status==="paid"||L.status==="completed")&&t.jsxs(oe,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{ce(L),le("")},children:[t.jsx(kp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},L.id)})})]})}),r==="orders"&&t.jsx(Sr,{page:A,totalPages:he,total:T,pageSize:V,onPageChange:$,onPageSizeChange:L=>{R(L),$(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(Qr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ne,{value:j,onChange:L=>b(L.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:C,onChange:L=>N(L.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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Ee,{className:"p-0",children:[se.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:se.map(L=>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:L.refereeNickname||"匿名用户"}),t.jsx("p",{className:"text-gray-500 text-xs",children:L.refereePhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white",children:L.referrerName||"-"}),t.jsx("p",{className:"text-gray-500 text-xs font-mono",children:L.referrerCode})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:L.boundAt?new Date(L.boundAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:L.expiresAt?new Date(L.expiresAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:re(L.status)}),t.jsx("td",{className:"p-4",children:L.commission?t.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",L.commission.toFixed(2)]}):t.jsx("span",{className:"text-gray-500",children:"-"})})]},L.id))})]})}),r==="bindings"&&t.jsx(Sr,{page:A,totalPages:he,total:T,pageSize:V,onPageChange:$,onPageSizeChange:L=>{R(L),$(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(Qr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ne,{value:j,onChange:L=>b(L.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:C,onChange:L=>N(L.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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Ee,{className:"p-0",children:[pe.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:pe.map(L=>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:[L.userAvatar?t.jsx("img",{src:L.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:(L.userName||L.name||"?").slice(0,1)}),t.jsx("p",{className:"text-white font-medium",children:L.userName||L.name})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",L.amount.toFixed(2)]})}),t.jsx("td",{className:"p-4",children:t.jsx(Me,{className:L.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:L.method==="wechat"?"微信":"支付宝"})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-mono text-xs",children:L.account}),t.jsx("p",{className:"text-gray-500 text-xs",children:L.name})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:re(L.status)}),t.jsx("td",{className:"p-4 text-right",children:L.status==="pending"&&t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsxs(oe,{size:"sm",onClick:()=>D(L.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(ym,{className:"w-4 h-4 mr-1"}),"通过"]}),t.jsxs(oe,{size:"sm",variant:"outline",onClick:()=>P(L.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[t.jsx(Dj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},L.id))})]})}),r==="withdrawals"&&t.jsx(Sr,{page:A,totalPages:he,total:T,pageSize:V,onPageChange:$,onPageSizeChange:L=>{R(L),$(1)}})]})})]})]}),t.jsx(Bt,{open:!!J,onOpenChange:L=>!L&&ce(null),children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Ut,{children:t.jsx(Vt,{className:"text-white",children:"订单退款"})}),J&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",J.orderSn||J.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof J.amount=="number"?J.amount.toFixed(2):parseFloat(String(J.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(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:X,onChange:L=>le(L.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(qt,{children:[t.jsx(oe,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>ce(null),disabled:ee,children:"取消"}),t.jsx(oe,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:W,disabled:ee,children:ee?"退款中...":"确认退款"})]})]})})]})}function v2(){const[r,a]=h.useState([]),[l,o]=h.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[c,u]=h.useState(!0),[f,p]=h.useState(null),[x,g]=h.useState("all"),[v,y]=h.useState(1),[E,_]=h.useState(10),[k,w]=h.useState(0),[j,b]=h.useState(null);async function C(){var R,T,F,Y,K,J,ce;u(!0),p(null);try{const X=new URLSearchParams({status:x,page:String(v),pageSize:String(E)}),le=await We(`/api/admin/withdrawals?${X}`);if(le!=null&&le.success){const ee=le.withdrawals||[];a(ee),w(le.total??((R=le.stats)==null?void 0:R.total)??ee.length),o({total:((T=le.stats)==null?void 0:T.total)??le.total??ee.length,pendingCount:((F=le.stats)==null?void 0:F.pendingCount)??0,pendingAmount:((Y=le.stats)==null?void 0:Y.pendingAmount)??0,successCount:((K=le.stats)==null?void 0:K.successCount)??0,successAmount:((J=le.stats)==null?void 0:J.successAmount)??0,failedCount:((ce=le.stats)==null?void 0:ce.failedCount)??0})}else p("加载提现记录失败")}catch(X){console.error("Load withdrawals error:",X),p("加载失败,请检查网络后重试")}finally{u(!1)}}h.useEffect(()=>{y(1)},[x]),h.useEffect(()=>{C()},[x,v,E]);const N=Math.ceil(k/E)||1;async function A(R){const T=r.find(F=>F.id===R);if(T!=null&&T.userCommissionInfo&&T.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${T.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;b(R);try{const F=await Pt("/api/admin/withdrawals",{id:R,action:"approve"});F!=null&&F.success?C():alert("操作失败: "+((F==null?void 0:F.error)??""))}catch{alert("操作失败")}finally{b(null)}}async function $(R){const T=prompt("请输入拒绝原因(将返还用户余额):");if(T){b(R);try{const F=await Pt("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:T});F!=null&&F.success?C():alert("操作失败: "+((F==null?void 0:F.error)??""))}catch{alert("操作失败")}finally{b(null)}}}function V(R){switch(R){case"pending":return t.jsx(Me,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return t.jsx(Me,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return t.jsx(Me,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return t.jsx(Me,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return t.jsx(Me,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return t.jsx(Me,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}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:()=>p(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(oe,{variant:"outline",onClick:C,disabled:c,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),t.jsx(ke,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:t.jsx(Ee,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(yi,{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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Ee,{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(R=>t.jsx(oe,{variant:x===R?"default":"outline",size:"sm",onClick:()=>g(R),className:x===R?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:R==="all"?"全部":R==="pending"?"待处理":R==="success"?"已完成":"已拒绝"},R))}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Ee,{className:"p-0",children:c?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{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(Os,{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(R=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?t.jsx("img",{src:R.userAvatar,alt:R.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:(R.userName??"?").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),t.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),t.jsx("td",{className:"p-4",children:R.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:["¥",R.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:["¥",R.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:["¥",R.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:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):t.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),t.jsxs("td",{className:"p-4",children:[V(R.status),R.errorMessage&&t.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),t.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?t.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),t.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsxs(oe,{size:"sm",onClick:()=>A(R.id),disabled:j===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[t.jsx(Mi,{className:"w-4 h-4 mr-1"}),"批准"]}),t.jsxs(oe,{size:"sm",variant:"outline",onClick:()=>$(R.id),disabled:j===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[t.jsx(on,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&t.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),t.jsx(Sr,{page:v,totalPages:N,total:k,pageSize:E,onPageChange:y,onPageSizeChange:R=>{_(R),y(1)}})]})})})]})}const Xr=h.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}));Xr.displayName="Textarea";function ki(r,[a,l]){return Math.min(l,Math.max(a,r))}const y2=["top","right","bottom","left"],kr=Math.min,Qt=Math.max,Ei=Math.round,di=Math.floor,_n=r=>({x:r,y:r}),j2={left:"right",right:"left",bottom:"top",top:"bottom"},N2={start:"end",end:"start"};function bd(r,a,l){return Qt(r,kr(a,l))}function Hn(r,a){return typeof r=="function"?r(a):r}function Kn(r){return r.split("-")[0]}function Ws(r){return r.split("-")[1]}function ru(r){return r==="x"?"y":"x"}function su(r){return r==="y"?"height":"width"}const b2=new Set(["top","bottom"]);function Pn(r){return b2.has(Kn(r))?"y":"x"}function au(r){return ru(Pn(r))}function w2(r,a,l){l===void 0&&(l=!1);const o=Ws(r),c=au(r),u=su(c);let f=c==="x"?o===(l?"end":"start")?"right":"left":o==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=Pi(f)),[f,Pi(f)]}function S2(r){const a=Pi(r);return[wd(r),a,wd(a)]}function wd(r){return r.replace(/start|end/g,a=>N2[a])}const Gm=["left","right"],Ym=["right","left"],C2=["top","bottom"],k2=["bottom","top"];function E2(r,a,l){switch(r){case"top":case"bottom":return l?a?Ym:Gm:a?Gm:Ym;case"left":case"right":return a?C2:k2;default:return[]}}function P2(r,a,l,o){const c=Ws(r);let u=E2(Kn(r),l==="start",o);return c&&(u=u.map(f=>f+"-"+c),a&&(u=u.concat(u.map(wd)))),u}function Pi(r){return r.replace(/left|right|bottom|top/g,a=>j2[a])}function R2(r){return{top:0,right:0,bottom:0,left:0,...r}}function Gx(r){return typeof r!="number"?R2(r):{top:r,right:r,bottom:r,left:r}}function Ri(r){const{x:a,y:l,width:o,height:c}=r;return{width:o,height:c,top:l,left:a,right:a+o,bottom:l+c,x:a,y:l}}function Qm(r,a,l){let{reference:o,floating:c}=r;const u=Pn(a),f=au(a),p=su(f),x=Kn(a),g=u==="y",v=o.x+o.width/2-c.width/2,y=o.y+o.height/2-c.height/2,E=o[p]/2-c[p]/2;let _;switch(x){case"top":_={x:v,y:o.y-c.height};break;case"bottom":_={x:v,y:o.y+o.height};break;case"right":_={x:o.x+o.width,y};break;case"left":_={x:o.x-c.width,y};break;default:_={x:o.x,y:o.y}}switch(Ws(a)){case"start":_[f]-=E*(l&&g?-1:1);break;case"end":_[f]+=E*(l&&g?-1:1);break}return _}async function _2(r,a){var l;a===void 0&&(a={});const{x:o,y:c,platform:u,rects:f,elements:p,strategy:x}=r,{boundary:g="clippingAncestors",rootBoundary:v="viewport",elementContext:y="floating",altBoundary:E=!1,padding:_=0}=Hn(a,r),k=Gx(_),j=p[E?y==="floating"?"reference":"floating":y],b=Ri(await u.getClippingRect({element:(l=await(u.isElement==null?void 0:u.isElement(j)))==null||l?j:j.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(p.floating)),boundary:g,rootBoundary:v,strategy:x})),C=y==="floating"?{x:o,y:c,width:f.floating.width,height:f.floating.height}:f.reference,N=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p.floating)),A=await(u.isElement==null?void 0:u.isElement(N))?await(u.getScale==null?void 0:u.getScale(N))||{x:1,y:1}:{x:1,y:1},$=Ri(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:C,offsetParent:N,strategy:x}):C);return{top:(b.top-$.top+k.top)/A.y,bottom:($.bottom-b.bottom+k.bottom)/A.y,left:(b.left-$.left+k.left)/A.x,right:($.right-b.right+k.right)/A.x}}const T2=async(r,a,l)=>{const{placement:o="bottom",strategy:c="absolute",middleware:u=[],platform:f}=l,p=u.filter(Boolean),x=await(f.isRTL==null?void 0:f.isRTL(a));let g=await f.getElementRects({reference:r,floating:a,strategy:c}),{x:v,y}=Qm(g,o,x),E=o,_={},k=0;for(let j=0;j({name:"arrow",options:r,async fn(a){const{x:l,y:o,placement:c,rects:u,platform:f,elements:p,middlewareData:x}=a,{element:g,padding:v=0}=Hn(r,a)||{};if(g==null)return{};const y=Gx(v),E={x:l,y:o},_=au(c),k=su(_),w=await f.getDimensions(g),j=_==="y",b=j?"top":"left",C=j?"bottom":"right",N=j?"clientHeight":"clientWidth",A=u.reference[k]+u.reference[_]-E[_]-u.floating[k],$=E[_]-u.reference[_],V=await(f.getOffsetParent==null?void 0:f.getOffsetParent(g));let R=V?V[N]:0;(!R||!await(f.isElement==null?void 0:f.isElement(V)))&&(R=p.floating[N]||u.floating[k]);const T=A/2-$/2,F=R/2-w[k]/2-1,Y=kr(y[b],F),K=kr(y[C],F),J=Y,ce=R-w[k]-K,X=R/2-w[k]/2+T,le=bd(J,X,ce),ee=!x.arrow&&Ws(c)!=null&&X!==le&&u.reference[k]/2-(XX<=0)){var K,J;const X=(((K=u.flip)==null?void 0:K.index)||0)+1,le=R[X];if(le&&(!(y==="alignment"?C!==Pn(le):!1)||Y.every(I=>Pn(I.placement)===C?I.overflows[0]>0:!0)))return{data:{index:X,overflows:Y},reset:{placement:le}};let ee=(J=Y.filter(q=>q.overflows[0]<=0).sort((q,I)=>q.overflows[1]-I.overflows[1])[0])==null?void 0:J.placement;if(!ee)switch(_){case"bestFit":{var ce;const q=(ce=Y.filter(I=>{if(V){const Q=Pn(I.placement);return Q===C||Q==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(Q=>Q>0).reduce((Q,B)=>Q+B,0)]).sort((I,Q)=>I[1]-Q[1])[0])==null?void 0:ce[0];q&&(ee=q);break}case"initialPlacement":ee=p;break}if(c!==ee)return{reset:{placement:ee}}}return{}}}};function qm(r,a){return{top:r.top-a.height,right:r.right-a.width,bottom:r.bottom-a.height,left:r.left-a.width}}function Xm(r){return y2.some(a=>r[a]>=0)}const M2=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(a){const{rects:l,platform:o}=a,{strategy:c="referenceHidden",...u}=Hn(r,a);switch(c){case"referenceHidden":{const f=await o.detectOverflow(a,{...u,elementContext:"reference"}),p=qm(f,l.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:Xm(p)}}}case"escaped":{const f=await o.detectOverflow(a,{...u,altBoundary:!0}),p=qm(f,l.floating);return{data:{escapedOffsets:p,escaped:Xm(p)}}}default:return{}}}}},Yx=new Set(["left","top"]);async function D2(r,a){const{placement:l,platform:o,elements:c}=r,u=await(o.isRTL==null?void 0:o.isRTL(c.floating)),f=Kn(l),p=Ws(l),x=Pn(l)==="y",g=Yx.has(f)?-1:1,v=u&&x?-1:1,y=Hn(a,r);let{mainAxis:E,crossAxis:_,alignmentAxis:k}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return p&&typeof k=="number"&&(_=p==="end"?k*-1:k),x?{x:_*v,y:E*g}:{x:E*g,y:_*v}}const L2=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(a){var l,o;const{x:c,y:u,placement:f,middlewareData:p}=a,x=await D2(a,r);return f===((l=p.offset)==null?void 0:l.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:c+x.x,y:u+x.y,data:{...x,placement:f}}}}},O2=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(a){const{x:l,y:o,placement:c,platform:u}=a,{mainAxis:f=!0,crossAxis:p=!1,limiter:x={fn:b=>{let{x:C,y:N}=b;return{x:C,y:N}}},...g}=Hn(r,a),v={x:l,y:o},y=await u.detectOverflow(a,g),E=Pn(Kn(c)),_=ru(E);let k=v[_],w=v[E];if(f){const b=_==="y"?"top":"left",C=_==="y"?"bottom":"right",N=k+y[b],A=k-y[C];k=bd(N,k,A)}if(p){const b=E==="y"?"top":"left",C=E==="y"?"bottom":"right",N=w+y[b],A=w-y[C];w=bd(N,w,A)}const j=x.fn({...a,[_]:k,[E]:w});return{...j,data:{x:j.x-l,y:j.y-o,enabled:{[_]:f,[E]:p}}}}}},F2=function(r){return r===void 0&&(r={}),{options:r,fn(a){const{x:l,y:o,placement:c,rects:u,middlewareData:f}=a,{offset:p=0,mainAxis:x=!0,crossAxis:g=!0}=Hn(r,a),v={x:l,y:o},y=Pn(c),E=ru(y);let _=v[E],k=v[y];const w=Hn(p,a),j=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(x){const N=E==="y"?"height":"width",A=u.reference[E]-u.floating[N]+j.mainAxis,$=u.reference[E]+u.reference[N]-j.mainAxis;_$&&(_=$)}if(g){var b,C;const N=E==="y"?"width":"height",A=Yx.has(Kn(c)),$=u.reference[y]-u.floating[N]+(A&&((b=f.offset)==null?void 0:b[y])||0)+(A?0:j.crossAxis),V=u.reference[y]+u.reference[N]+(A?0:((C=f.offset)==null?void 0:C[y])||0)-(A?j.crossAxis:0);k<$?k=$:k>V&&(k=V)}return{[E]:_,[y]:k}}}},z2=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(a){var l,o;const{placement:c,rects:u,platform:f,elements:p}=a,{apply:x=()=>{},...g}=Hn(r,a),v=await f.detectOverflow(a,g),y=Kn(c),E=Ws(c),_=Pn(c)==="y",{width:k,height:w}=u.floating;let j,b;y==="top"||y==="bottom"?(j=y,b=E===(await(f.isRTL==null?void 0:f.isRTL(p.floating))?"start":"end")?"left":"right"):(b=y,j=E==="end"?"top":"bottom");const C=w-v.top-v.bottom,N=k-v.left-v.right,A=kr(w-v[j],C),$=kr(k-v[b],N),V=!a.middlewareData.shift;let R=A,T=$;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(T=N),(o=a.middlewareData.shift)!=null&&o.enabled.y&&(R=C),V&&!E){const Y=Qt(v.left,0),K=Qt(v.right,0),J=Qt(v.top,0),ce=Qt(v.bottom,0);_?T=k-2*(Y!==0||K!==0?Y+K:Qt(v.left,v.right)):R=w-2*(J!==0||ce!==0?J+ce:Qt(v.top,v.bottom))}await x({...a,availableWidth:T,availableHeight:R});const F=await f.getDimensions(p.floating);return k!==F.width||w!==F.height?{reset:{rects:!0}}:{}}}};function Wi(){return typeof window<"u"}function Hs(r){return Qx(r)?(r.nodeName||"").toLowerCase():"#document"}function Xt(r){var a;return(r==null||(a=r.ownerDocument)==null?void 0:a.defaultView)||window}function In(r){var a;return(a=(Qx(r)?r.ownerDocument:r.document)||window.document)==null?void 0:a.documentElement}function Qx(r){return Wi()?r instanceof Node||r instanceof Xt(r).Node:!1}function yn(r){return Wi()?r instanceof Element||r instanceof Xt(r).Element:!1}function Tn(r){return Wi()?r instanceof HTMLElement||r instanceof Xt(r).HTMLElement:!1}function Jm(r){return!Wi()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Xt(r).ShadowRoot}const $2=new Set(["inline","contents"]);function Ga(r){const{overflow:a,overflowX:l,overflowY:o,display:c}=jn(r);return/auto|scroll|overlay|hidden|clip/.test(a+o+l)&&!$2.has(c)}const B2=new Set(["table","td","th"]);function U2(r){return B2.has(Hs(r))}const V2=[":popover-open",":modal"];function Hi(r){return V2.some(a=>{try{return r.matches(a)}catch{return!1}})}const W2=["transform","translate","scale","rotate","perspective"],H2=["transform","translate","scale","rotate","perspective","filter"],K2=["paint","layout","strict","content"];function lu(r){const a=iu(),l=yn(r)?jn(r):r;return W2.some(o=>l[o]?l[o]!=="none":!1)||(l.containerType?l.containerType!=="normal":!1)||!a&&(l.backdropFilter?l.backdropFilter!=="none":!1)||!a&&(l.filter?l.filter!=="none":!1)||H2.some(o=>(l.willChange||"").includes(o))||K2.some(o=>(l.contain||"").includes(o))}function G2(r){let a=Er(r);for(;Tn(a)&&!zs(a);){if(lu(a))return a;if(Hi(a))return null;a=Er(a)}return null}function iu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Y2=new Set(["html","body","#document"]);function zs(r){return Y2.has(Hs(r))}function jn(r){return Xt(r).getComputedStyle(r)}function Ki(r){return yn(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Er(r){if(Hs(r)==="html")return r;const a=r.assignedSlot||r.parentNode||Jm(r)&&r.host||In(r);return Jm(a)?a.host:a}function qx(r){const a=Er(r);return zs(a)?r.ownerDocument?r.ownerDocument.body:r.body:Tn(a)&&Ga(a)?a:qx(a)}function Ba(r,a,l){var o;a===void 0&&(a=[]),l===void 0&&(l=!0);const c=qx(r),u=c===((o=r.ownerDocument)==null?void 0:o.body),f=Xt(c);if(u){const p=Sd(f);return a.concat(f,f.visualViewport||[],Ga(c)?c:[],p&&l?Ba(p):[])}return a.concat(c,Ba(c,[],l))}function Sd(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Xx(r){const a=jn(r);let l=parseFloat(a.width)||0,o=parseFloat(a.height)||0;const c=Tn(r),u=c?r.offsetWidth:l,f=c?r.offsetHeight:o,p=Ei(l)!==u||Ei(o)!==f;return p&&(l=u,o=f),{width:l,height:o,$:p}}function ou(r){return yn(r)?r:r.contextElement}function Ls(r){const a=ou(r);if(!Tn(a))return _n(1);const l=a.getBoundingClientRect(),{width:o,height:c,$:u}=Xx(a);let f=(u?Ei(l.width):l.width)/o,p=(u?Ei(l.height):l.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!p||!Number.isFinite(p))&&(p=1),{x:f,y:p}}const Q2=_n(0);function Jx(r){const a=Xt(r);return!iu()||!a.visualViewport?Q2:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function q2(r,a,l){return a===void 0&&(a=!1),!l||a&&l!==Xt(r)?!1:a}function es(r,a,l,o){a===void 0&&(a=!1),l===void 0&&(l=!1);const c=r.getBoundingClientRect(),u=ou(r);let f=_n(1);a&&(o?yn(o)&&(f=Ls(o)):f=Ls(r));const p=q2(u,l,o)?Jx(u):_n(0);let x=(c.left+p.x)/f.x,g=(c.top+p.y)/f.y,v=c.width/f.x,y=c.height/f.y;if(u){const E=Xt(u),_=o&&yn(o)?Xt(o):o;let k=E,w=Sd(k);for(;w&&o&&_!==k;){const j=Ls(w),b=w.getBoundingClientRect(),C=jn(w),N=b.left+(w.clientLeft+parseFloat(C.paddingLeft))*j.x,A=b.top+(w.clientTop+parseFloat(C.paddingTop))*j.y;x*=j.x,g*=j.y,v*=j.x,y*=j.y,x+=N,g+=A,k=Xt(w),w=Sd(k)}}return Ri({width:v,height:y,x,y:g})}function Gi(r,a){const l=Ki(r).scrollLeft;return a?a.left+l:es(In(r)).left+l}function Zx(r,a){const l=r.getBoundingClientRect(),o=l.left+a.scrollLeft-Gi(r,l),c=l.top+a.scrollTop;return{x:o,y:c}}function X2(r){let{elements:a,rect:l,offsetParent:o,strategy:c}=r;const u=c==="fixed",f=In(o),p=a?Hi(a.floating):!1;if(o===f||p&&u)return l;let x={scrollLeft:0,scrollTop:0},g=_n(1);const v=_n(0),y=Tn(o);if((y||!y&&!u)&&((Hs(o)!=="body"||Ga(f))&&(x=Ki(o)),Tn(o))){const _=es(o);g=Ls(o),v.x=_.x+o.clientLeft,v.y=_.y+o.clientTop}const E=f&&!y&&!u?Zx(f,x):_n(0);return{width:l.width*g.x,height:l.height*g.y,x:l.x*g.x-x.scrollLeft*g.x+v.x+E.x,y:l.y*g.y-x.scrollTop*g.y+v.y+E.y}}function J2(r){return Array.from(r.getClientRects())}function Z2(r){const a=In(r),l=Ki(r),o=r.ownerDocument.body,c=Qt(a.scrollWidth,a.clientWidth,o.scrollWidth,o.clientWidth),u=Qt(a.scrollHeight,a.clientHeight,o.scrollHeight,o.clientHeight);let f=-l.scrollLeft+Gi(r);const p=-l.scrollTop;return jn(o).direction==="rtl"&&(f+=Qt(a.clientWidth,o.clientWidth)-c),{width:c,height:u,x:f,y:p}}const Zm=25;function eS(r,a){const l=Xt(r),o=In(r),c=l.visualViewport;let u=o.clientWidth,f=o.clientHeight,p=0,x=0;if(c){u=c.width,f=c.height;const v=iu();(!v||v&&a==="fixed")&&(p=c.offsetLeft,x=c.offsetTop)}const g=Gi(o);if(g<=0){const v=o.ownerDocument,y=v.body,E=getComputedStyle(y),_=v.compatMode==="CSS1Compat"&&parseFloat(E.marginLeft)+parseFloat(E.marginRight)||0,k=Math.abs(o.clientWidth-y.clientWidth-_);k<=Zm&&(u-=k)}else g<=Zm&&(u+=g);return{width:u,height:f,x:p,y:x}}const tS=new Set(["absolute","fixed"]);function nS(r,a){const l=es(r,!0,a==="fixed"),o=l.top+r.clientTop,c=l.left+r.clientLeft,u=Tn(r)?Ls(r):_n(1),f=r.clientWidth*u.x,p=r.clientHeight*u.y,x=c*u.x,g=o*u.y;return{width:f,height:p,x,y:g}}function ep(r,a,l){let o;if(a==="viewport")o=eS(r,l);else if(a==="document")o=Z2(In(r));else if(yn(a))o=nS(a,l);else{const c=Jx(r);o={x:a.x-c.x,y:a.y-c.y,width:a.width,height:a.height}}return Ri(o)}function eg(r,a){const l=Er(r);return l===a||!yn(l)||zs(l)?!1:jn(l).position==="fixed"||eg(l,a)}function rS(r,a){const l=a.get(r);if(l)return l;let o=Ba(r,[],!1).filter(p=>yn(p)&&Hs(p)!=="body"),c=null;const u=jn(r).position==="fixed";let f=u?Er(r):r;for(;yn(f)&&!zs(f);){const p=jn(f),x=lu(f);!x&&p.position==="fixed"&&(c=null),(u?!x&&!c:!x&&p.position==="static"&&!!c&&tS.has(c.position)||Ga(f)&&!x&&eg(r,f))?o=o.filter(v=>v!==f):c=p,f=Er(f)}return a.set(r,o),o}function sS(r){let{element:a,boundary:l,rootBoundary:o,strategy:c}=r;const f=[...l==="clippingAncestors"?Hi(a)?[]:rS(a,this._c):[].concat(l),o],p=f[0],x=f.reduce((g,v)=>{const y=ep(a,v,c);return g.top=Qt(y.top,g.top),g.right=kr(y.right,g.right),g.bottom=kr(y.bottom,g.bottom),g.left=Qt(y.left,g.left),g},ep(a,p,c));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function aS(r){const{width:a,height:l}=Xx(r);return{width:a,height:l}}function lS(r,a,l){const o=Tn(a),c=In(a),u=l==="fixed",f=es(r,!0,u,a);let p={scrollLeft:0,scrollTop:0};const x=_n(0);function g(){x.x=Gi(c)}if(o||!o&&!u)if((Hs(a)!=="body"||Ga(c))&&(p=Ki(a)),o){const _=es(a,!0,u,a);x.x=_.x+a.clientLeft,x.y=_.y+a.clientTop}else c&&g();u&&!o&&c&&g();const v=c&&!o&&!u?Zx(c,p):_n(0),y=f.left+p.scrollLeft-x.x-v.x,E=f.top+p.scrollTop-x.y-v.y;return{x:y,y:E,width:f.width,height:f.height}}function ad(r){return jn(r).position==="static"}function tp(r,a){if(!Tn(r)||jn(r).position==="fixed")return null;if(a)return a(r);let l=r.offsetParent;return In(r)===l&&(l=l.ownerDocument.body),l}function tg(r,a){const l=Xt(r);if(Hi(r))return l;if(!Tn(r)){let c=Er(r);for(;c&&!zs(c);){if(yn(c)&&!ad(c))return c;c=Er(c)}return l}let o=tp(r,a);for(;o&&U2(o)&&ad(o);)o=tp(o,a);return o&&zs(o)&&ad(o)&&!lu(o)?l:o||G2(r)||l}const iS=async function(r){const a=this.getOffsetParent||tg,l=this.getDimensions,o=await l(r.floating);return{reference:lS(r.reference,await a(r.floating),r.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function oS(r){return jn(r).direction==="rtl"}const cS={convertOffsetParentRelativeRectToViewportRelativeRect:X2,getDocumentElement:In,getClippingRect:sS,getOffsetParent:tg,getElementRects:iS,getClientRects:J2,getDimensions:aS,getScale:Ls,isElement:yn,isRTL:oS};function ng(r,a){return r.x===a.x&&r.y===a.y&&r.width===a.width&&r.height===a.height}function dS(r,a){let l=null,o;const c=In(r);function u(){var p;clearTimeout(o),(p=l)==null||p.disconnect(),l=null}function f(p,x){p===void 0&&(p=!1),x===void 0&&(x=1),u();const g=r.getBoundingClientRect(),{left:v,top:y,width:E,height:_}=g;if(p||a(),!E||!_)return;const k=di(y),w=di(c.clientWidth-(v+E)),j=di(c.clientHeight-(y+_)),b=di(v),N={rootMargin:-k+"px "+-w+"px "+-j+"px "+-b+"px",threshold:Qt(0,kr(1,x))||1};let A=!0;function $(V){const R=V[0].intersectionRatio;if(R!==x){if(!A)return f();R?f(!1,R):o=setTimeout(()=>{f(!1,1e-7)},1e3)}R===1&&!ng(g,r.getBoundingClientRect())&&f(),A=!1}try{l=new IntersectionObserver($,{...N,root:c.ownerDocument})}catch{l=new IntersectionObserver($,N)}l.observe(r)}return f(!0),u}function uS(r,a,l,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:x=!1}=o,g=ou(r),v=c||u?[...g?Ba(g):[],...Ba(a)]:[];v.forEach(b=>{c&&b.addEventListener("scroll",l,{passive:!0}),u&&b.addEventListener("resize",l)});const y=g&&p?dS(g,l):null;let E=-1,_=null;f&&(_=new ResizeObserver(b=>{let[C]=b;C&&C.target===g&&_&&(_.unobserve(a),cancelAnimationFrame(E),E=requestAnimationFrame(()=>{var N;(N=_)==null||N.observe(a)})),l()}),g&&!x&&_.observe(g),_.observe(a));let k,w=x?es(r):null;x&&j();function j(){const b=es(r);w&&!ng(w,b)&&l(),w=b,k=requestAnimationFrame(j)}return l(),()=>{var b;v.forEach(C=>{c&&C.removeEventListener("scroll",l),u&&C.removeEventListener("resize",l)}),y==null||y(),(b=_)==null||b.disconnect(),_=null,x&&cancelAnimationFrame(k)}}const fS=L2,hS=O2,mS=A2,pS=z2,xS=M2,np=I2,gS=F2,vS=(r,a,l)=>{const o=new Map,c={platform:cS,...l},u={...c.platform,_c:o};return T2(r,a,{...c,platform:u})};var yS=typeof document<"u",jS=function(){},pi=yS?h.useLayoutEffect:jS;function _i(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,o,c;if(r&&a&&typeof r=="object"){if(Array.isArray(r)){if(l=r.length,l!==a.length)return!1;for(o=l;o--!==0;)if(!_i(r[o],a[o]))return!1;return!0}if(c=Object.keys(r),l=c.length,l!==Object.keys(a).length)return!1;for(o=l;o--!==0;)if(!{}.hasOwnProperty.call(a,c[o]))return!1;for(o=l;o--!==0;){const u=c[o];if(!(u==="_owner"&&r.$$typeof)&&!_i(r[u],a[u]))return!1}return!0}return r!==r&&a!==a}function rg(r){return typeof window>"u"?1:(r.ownerDocument.defaultView||window).devicePixelRatio||1}function rp(r,a){const l=rg(r);return Math.round(a*l)/l}function ld(r){const a=h.useRef(r);return pi(()=>{a.current=r}),a}function NS(r){r===void 0&&(r={});const{placement:a="bottom",strategy:l="absolute",middleware:o=[],platform:c,elements:{reference:u,floating:f}={},transform:p=!0,whileElementsMounted:x,open:g}=r,[v,y]=h.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[E,_]=h.useState(o);_i(E,o)||_(o);const[k,w]=h.useState(null),[j,b]=h.useState(null),C=h.useCallback(I=>{I!==V.current&&(V.current=I,w(I))},[]),N=h.useCallback(I=>{I!==R.current&&(R.current=I,b(I))},[]),A=u||k,$=f||j,V=h.useRef(null),R=h.useRef(null),T=h.useRef(v),F=x!=null,Y=ld(x),K=ld(c),J=ld(g),ce=h.useCallback(()=>{if(!V.current||!R.current)return;const I={placement:a,strategy:l,middleware:E};K.current&&(I.platform=K.current),vS(V.current,R.current,I).then(Q=>{const B={...Q,isPositioned:J.current!==!1};X.current&&!_i(T.current,B)&&(T.current=B,Ua.flushSync(()=>{y(B)}))})},[E,a,l,K,J]);pi(()=>{g===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,y(I=>({...I,isPositioned:!1})))},[g]);const X=h.useRef(!1);pi(()=>(X.current=!0,()=>{X.current=!1}),[]),pi(()=>{if(A&&(V.current=A),$&&(R.current=$),A&&$){if(Y.current)return Y.current(A,$,ce);ce()}},[A,$,ce,Y,F]);const le=h.useMemo(()=>({reference:V,floating:R,setReference:C,setFloating:N}),[C,N]),ee=h.useMemo(()=>({reference:A,floating:$}),[A,$]),q=h.useMemo(()=>{const I={position:l,left:0,top:0};if(!ee.floating)return I;const Q=rp(ee.floating,v.x),B=rp(ee.floating,v.y);return p?{...I,transform:"translate("+Q+"px, "+B+"px)",...rg(ee.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:Q,top:B}},[l,p,ee.floating,v.x,v.y]);return h.useMemo(()=>({...v,update:ce,refs:le,elements:ee,floatingStyles:q}),[v,ce,le,ee,q])}const bS=r=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:r,fn(l){const{element:o,padding:c}=typeof r=="function"?r(l):r;return o&&a(o)?o.current!=null?np({element:o.current,padding:c}).fn(l):{}:o?np({element:o,padding:c}).fn(l):{}}}},wS=(r,a)=>({...fS(r),options:[r,a]}),SS=(r,a)=>({...hS(r),options:[r,a]}),CS=(r,a)=>({...gS(r),options:[r,a]}),kS=(r,a)=>({...mS(r),options:[r,a]}),ES=(r,a)=>({...pS(r),options:[r,a]}),PS=(r,a)=>({...xS(r),options:[r,a]}),RS=(r,a)=>({...bS(r),options:[r,a]});var _S="Arrow",sg=h.forwardRef((r,a)=>{const{children:l,width:o=10,height:c=5,...u}=r;return t.jsx(Oe.svg,{...u,ref:a,width:o,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:r.asChild?l:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});sg.displayName=_S;var TS=sg,cu="Popper",[ag,lg]=Rr(cu),[IS,ig]=ag(cu),og=r=>{const{__scopePopper:a,children:l}=r,[o,c]=h.useState(null);return t.jsx(IS,{scope:a,anchor:o,onAnchorChange:c,children:l})};og.displayName=cu;var cg="PopperAnchor",dg=h.forwardRef((r,a)=>{const{__scopePopper:l,virtualRef:o,...c}=r,u=ig(cg,l),f=h.useRef(null),p=Ke(a,f),x=h.useRef(null);return h.useEffect(()=>{const g=x.current;x.current=(o==null?void 0:o.current)||f.current,g!==x.current&&u.onAnchorChange(x.current)}),o?null:t.jsx(Oe.div,{...c,ref:p})});dg.displayName=cg;var du="PopperContent",[AS,MS]=ag(du),ug=h.forwardRef((r,a)=>{var se,pe,L,ue,xe,Re;const{__scopePopper:l,side:o="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,arrowPadding:p=0,avoidCollisions:x=!0,collisionBoundary:g=[],collisionPadding:v=0,sticky:y="partial",hideWhenDetached:E=!1,updatePositionStrategy:_="optimized",onPlaced:k,...w}=r,j=ig(du,l),[b,C]=h.useState(null),N=Ke(a,De=>C(De)),[A,$]=h.useState(null),V=Zd(A),R=(V==null?void 0:V.width)??0,T=(V==null?void 0:V.height)??0,F=o+(u!=="center"?"-"+u:""),Y=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},K=Array.isArray(g)?g:[g],J=K.length>0,ce={padding:Y,boundary:K.filter(LS),altBoundary:J},{refs:X,floatingStyles:le,placement:ee,isPositioned:q,middlewareData:I}=NS({strategy:"fixed",placement:F,whileElementsMounted:(...De)=>uS(...De,{animationFrame:_==="always"}),elements:{reference:j.anchor},middleware:[wS({mainAxis:c+T,alignmentAxis:f}),x&&SS({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?CS():void 0,...ce}),x&&kS({...ce}),ES({...ce,apply:({elements:De,rects:Fe,availableWidth:Qe,availableHeight:st})=>{const{width:et,height:At}=Fe.reference,Mt=De.floating.style;Mt.setProperty("--radix-popper-available-width",`${Qe}px`),Mt.setProperty("--radix-popper-available-height",`${st}px`),Mt.setProperty("--radix-popper-anchor-width",`${et}px`),Mt.setProperty("--radix-popper-anchor-height",`${At}px`)}}),A&&RS({element:A,padding:p}),OS({arrowWidth:R,arrowHeight:T}),E&&PS({strategy:"referenceHidden",...ce})]}),[Q,B]=mg(ee),D=Cr(k);Rt(()=>{q&&(D==null||D())},[q,D]);const P=(se=I.arrow)==null?void 0:se.x,W=(pe=I.arrow)==null?void 0:pe.y,re=((L=I.arrow)==null?void 0:L.centerOffset)!==0,[he,me]=h.useState();return Rt(()=>{b&&me(window.getComputedStyle(b).zIndex)},[b]),t.jsx("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...le,transform:q?le.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(ue=I.transformOrigin)==null?void 0:ue.x,(xe=I.transformOrigin)==null?void 0:xe.y].join(" "),...((Re=I.hide)==null?void 0:Re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:r.dir,children:t.jsx(AS,{scope:l,placedSide:Q,onArrowChange:$,arrowX:P,arrowY:W,shouldHideArrow:re,children:t.jsx(Oe.div,{"data-side":Q,"data-align":B,...w,ref:N,style:{...w.style,animation:q?void 0:"none"}})})})});ug.displayName=du;var fg="PopperArrow",DS={top:"bottom",right:"left",bottom:"top",left:"right"},hg=h.forwardRef(function(a,l){const{__scopePopper:o,...c}=a,u=MS(fg,o),f=DS[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(TS,{...c,ref:l,style:{...c.style,display:"block"}})})});hg.displayName=fg;function LS(r){return r!==null}var OS=r=>({name:"transformOrigin",options:r,fn(a){var j,b,C;const{placement:l,rects:o,middlewareData:c}=a,f=((j=c.arrow)==null?void 0:j.centerOffset)!==0,p=f?0:r.arrowWidth,x=f?0:r.arrowHeight,[g,v]=mg(l),y={start:"0%",center:"50%",end:"100%"}[v],E=(((b=c.arrow)==null?void 0:b.x)??0)+p/2,_=(((C=c.arrow)==null?void 0:C.y)??0)+x/2;let k="",w="";return g==="bottom"?(k=f?y:`${E}px`,w=`${-x}px`):g==="top"?(k=f?y:`${E}px`,w=`${o.floating.height+x}px`):g==="right"?(k=`${-x}px`,w=f?y:`${_}px`):g==="left"&&(k=`${o.floating.width+x}px`,w=f?y:`${_}px`),{data:{x:k,y:w}}}});function mg(r){const[a,l="center"]=r.split("-");return[a,l]}var FS=og,zS=dg,$S=ug,BS=hg,pg=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"}),US="VisuallyHidden",VS=h.forwardRef((r,a)=>t.jsx(Oe.span,{...r,ref:a,style:{...pg,...r.style}}));VS.displayName=US;var WS=[" ","Enter","ArrowUp","ArrowDown"],HS=[" ","Enter"],ts="Select",[Yi,Qi,KS]=eu(ts),[Ks]=Rr(ts,[KS,lg]),qi=lg(),[GS,_r]=Ks(ts),[YS,QS]=Ks(ts),xg=r=>{const{__scopeSelect:a,children:l,open:o,defaultOpen:c,onOpenChange:u,value:f,defaultValue:p,onValueChange:x,dir:g,name:v,autoComplete:y,disabled:E,required:_,form:k}=r,w=qi(a),[j,b]=h.useState(null),[C,N]=h.useState(null),[A,$]=h.useState(!1),V=Bi(g),[R,T]=Jr({prop:o,defaultProp:c??!1,onChange:u,caller:ts}),[F,Y]=Jr({prop:f,defaultProp:p,onChange:x,caller:ts}),K=h.useRef(null),J=j?k||!!j.closest("form"):!0,[ce,X]=h.useState(new Set),le=Array.from(ce).map(ee=>ee.props.value).join(";");return t.jsx(FS,{...w,children:t.jsxs(GS,{required:_,scope:a,trigger:j,onTriggerChange:b,valueNode:C,onValueNodeChange:N,valueNodeHasChildren:A,onValueNodeHasChildrenChange:$,contentId:wr(),value:F,onValueChange:Y,open:R,onOpenChange:T,dir:V,triggerPointerDownPosRef:K,disabled:E,children:[t.jsx(Yi.Provider,{scope:a,children:t.jsx(YS,{scope:r.__scopeSelect,onNativeOptionAdd:h.useCallback(ee=>{X(q=>new Set(q).add(ee))},[]),onNativeOptionRemove:h.useCallback(ee=>{X(q=>{const I=new Set(q);return I.delete(ee),I})},[]),children:l})}),J?t.jsxs(Fg,{"aria-hidden":!0,required:_,tabIndex:-1,name:v,autoComplete:y,value:F,onChange:ee=>Y(ee.target.value),disabled:E,form:k,children:[F===void 0?t.jsx("option",{value:""}):null,Array.from(ce)]},le):null]})})};xg.displayName=ts;var gg="SelectTrigger",vg=h.forwardRef((r,a)=>{const{__scopeSelect:l,disabled:o=!1,...c}=r,u=qi(l),f=_r(gg,l),p=f.disabled||o,x=Ke(a,f.onTriggerChange),g=Qi(l),v=h.useRef("touch"),[y,E,_]=$g(w=>{const j=g().filter(N=>!N.disabled),b=j.find(N=>N.value===f.value),C=Bg(j,w,b);C!==void 0&&f.onValueChange(C.value)}),k=w=>{p||(f.onOpenChange(!0),_()),w&&(f.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return t.jsx(zS,{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:p,"data-disabled":p?"":void 0,"data-placeholder":zg(f.value)?"":void 0,...c,ref:x,onClick:Ae(c.onClick,w=>{w.currentTarget.focus(),v.current!=="mouse"&&k(w)}),onPointerDown:Ae(c.onPointerDown,w=>{v.current=w.pointerType;const j=w.target;j.hasPointerCapture(w.pointerId)&&j.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(k(w),w.preventDefault())}),onKeyDown:Ae(c.onKeyDown,w=>{const j=y.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&E(w.key),!(j&&w.key===" ")&&WS.includes(w.key)&&(k(),w.preventDefault())})})})});vg.displayName=gg;var yg="SelectValue",jg=h.forwardRef((r,a)=>{const{__scopeSelect:l,className:o,style:c,children:u,placeholder:f="",...p}=r,x=_r(yg,l),{onValueNodeHasChildrenChange:g}=x,v=u!==void 0,y=Ke(a,x.onValueNodeChange);return Rt(()=>{g(v)},[g,v]),t.jsx(Oe.span,{...p,ref:y,style:{pointerEvents:"none"},children:zg(x.value)?t.jsx(t.Fragment,{children:f}):u})});jg.displayName=yg;var qS="SelectIcon",Ng=h.forwardRef((r,a)=>{const{__scopeSelect:l,children:o,...c}=r;return t.jsx(Oe.span,{"aria-hidden":!0,...c,ref:a,children:o||"▼"})});Ng.displayName=qS;var XS="SelectPortal",bg=r=>t.jsx(Kd,{asChild:!0,...r});bg.displayName=XS;var ns="SelectContent",wg=h.forwardRef((r,a)=>{const l=_r(ns,r.__scopeSelect),[o,c]=h.useState();if(Rt(()=>{c(new DocumentFragment)},[]),!l.open){const u=o;return u?Ua.createPortal(t.jsx(Sg,{scope:r.__scopeSelect,children:t.jsx(Yi.Slot,{scope:r.__scopeSelect,children:t.jsx("div",{children:r.children})})}),u):null}return t.jsx(Cg,{...r,ref:a})});wg.displayName=ns;var gn=10,[Sg,Tr]=Ks(ns),JS="SelectContentImpl",ZS=$a("SelectContent.RemoveScroll"),Cg=h.forwardRef((r,a)=>{const{__scopeSelect:l,position:o="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,side:p,sideOffset:x,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:E,collisionPadding:_,sticky:k,hideWhenDetached:w,avoidCollisions:j,...b}=r,C=_r(ns,l),[N,A]=h.useState(null),[$,V]=h.useState(null),R=Ke(a,se=>A(se)),[T,F]=h.useState(null),[Y,K]=h.useState(null),J=Qi(l),[ce,X]=h.useState(!1),le=h.useRef(!1);h.useEffect(()=>{if(N)return rx(N)},[N]),Yp();const ee=h.useCallback(se=>{const[pe,...L]=J().map(Re=>Re.ref.current),[ue]=L.slice(-1),xe=document.activeElement;for(const Re of se)if(Re===xe||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===pe&&$&&($.scrollTop=0),Re===ue&&$&&($.scrollTop=$.scrollHeight),Re==null||Re.focus(),document.activeElement!==xe))return},[J,$]),q=h.useCallback(()=>ee([T,N]),[ee,T,N]);h.useEffect(()=>{ce&&q()},[ce,q]);const{onOpenChange:I,triggerPointerDownPosRef:Q}=C;h.useEffect(()=>{if(N){let se={x:0,y:0};const pe=ue=>{var xe,Re;se={x:Math.abs(Math.round(ue.pageX)-(((xe=Q.current)==null?void 0:xe.x)??0)),y:Math.abs(Math.round(ue.pageY)-(((Re=Q.current)==null?void 0:Re.y)??0))}},L=ue=>{se.x<=10&&se.y<=10?ue.preventDefault():N.contains(ue.target)||I(!1),document.removeEventListener("pointermove",pe),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",pe),document.addEventListener("pointerup",L,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",pe),document.removeEventListener("pointerup",L,{capture:!0})}}},[N,I,Q]),h.useEffect(()=>{const se=()=>I(!1);return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[I]);const[B,D]=$g(se=>{const pe=J().filter(xe=>!xe.disabled),L=pe.find(xe=>xe.ref.current===document.activeElement),ue=Bg(pe,se,L);ue&&setTimeout(()=>ue.ref.current.focus())}),P=h.useCallback((se,pe,L)=>{const ue=!le.current&&!L;(C.value!==void 0&&C.value===pe||ue)&&(F(se),ue&&(le.current=!0))},[C.value]),W=h.useCallback(()=>N==null?void 0:N.focus(),[N]),re=h.useCallback((se,pe,L)=>{const ue=!le.current&&!L;(C.value!==void 0&&C.value===pe||ue)&&K(se)},[C.value]),he=o==="popper"?Cd:kg,me=he===Cd?{side:p,sideOffset:x,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:E,collisionPadding:_,sticky:k,hideWhenDetached:w,avoidCollisions:j}:{};return t.jsx(Sg,{scope:l,content:N,viewport:$,onViewportChange:V,itemRefCallback:P,selectedItem:T,onItemLeave:W,itemTextRefCallback:re,focusSelectedItem:q,selectedItemText:Y,position:o,isPositioned:ce,searchRef:B,children:t.jsx(Gd,{as:ZS,allowPinchZoom:!0,children:t.jsx(Hd,{asChild:!0,trapped:C.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:Ae(c,se=>{var pe;(pe=C.trigger)==null||pe.focus({preventScroll:!0}),se.preventDefault()}),children:t.jsx(Wd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:t.jsx(he,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:se=>se.preventDefault(),...b,...me,onPlaced:()=>X(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ae(b.onKeyDown,se=>{const pe=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!pe&&se.key.length===1&&D(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.key)){let ue=J().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(se.key)&&(ue=ue.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const xe=se.target,Re=ue.indexOf(xe);ue=ue.slice(Re+1)}setTimeout(()=>ee(ue)),se.preventDefault()}})})})})})})});Cg.displayName=JS;var eC="SelectItemAlignedPosition",kg=h.forwardRef((r,a)=>{const{__scopeSelect:l,onPlaced:o,...c}=r,u=_r(ns,l),f=Tr(ns,l),[p,x]=h.useState(null),[g,v]=h.useState(null),y=Ke(a,R=>v(R)),E=Qi(l),_=h.useRef(!1),k=h.useRef(!0),{viewport:w,selectedItem:j,selectedItemText:b,focusSelectedItem:C}=f,N=h.useCallback(()=>{if(u.trigger&&u.valueNode&&p&&g&&w&&j&&b){const R=u.trigger.getBoundingClientRect(),T=g.getBoundingClientRect(),F=u.valueNode.getBoundingClientRect(),Y=b.getBoundingClientRect();if(u.dir!=="rtl"){const xe=Y.left-T.left,Re=F.left-xe,De=R.left-Re,Fe=R.width+De,Qe=Math.max(Fe,T.width),st=window.innerWidth-gn,et=ki(Re,[gn,Math.max(gn,st-Qe)]);p.style.minWidth=Fe+"px",p.style.left=et+"px"}else{const xe=T.right-Y.right,Re=window.innerWidth-F.right-xe,De=window.innerWidth-R.right-Re,Fe=R.width+De,Qe=Math.max(Fe,T.width),st=window.innerWidth-gn,et=ki(Re,[gn,Math.max(gn,st-Qe)]);p.style.minWidth=Fe+"px",p.style.right=et+"px"}const K=E(),J=window.innerHeight-gn*2,ce=w.scrollHeight,X=window.getComputedStyle(g),le=parseInt(X.borderTopWidth,10),ee=parseInt(X.paddingTop,10),q=parseInt(X.borderBottomWidth,10),I=parseInt(X.paddingBottom,10),Q=le+ee+ce+I+q,B=Math.min(j.offsetHeight*5,Q),D=window.getComputedStyle(w),P=parseInt(D.paddingTop,10),W=parseInt(D.paddingBottom,10),re=R.top+R.height/2-gn,he=J-re,me=j.offsetHeight/2,se=j.offsetTop+me,pe=le+ee+se,L=Q-pe;if(pe<=re){const xe=K.length>0&&j===K[K.length-1].ref.current;p.style.bottom="0px";const Re=g.clientHeight-w.offsetTop-w.offsetHeight,De=Math.max(he,me+(xe?W:0)+Re+q),Fe=pe+De;p.style.height=Fe+"px"}else{const xe=K.length>0&&j===K[0].ref.current;p.style.top="0px";const De=Math.max(re,le+w.offsetTop+(xe?P:0)+me)+L;p.style.height=De+"px",w.scrollTop=pe-re+w.offsetTop}p.style.margin=`${gn}px 0`,p.style.minHeight=B+"px",p.style.maxHeight=J+"px",o==null||o(),requestAnimationFrame(()=>_.current=!0)}},[E,u.trigger,u.valueNode,p,g,w,j,b,u.dir,o]);Rt(()=>N(),[N]);const[A,$]=h.useState();Rt(()=>{g&&$(window.getComputedStyle(g).zIndex)},[g]);const V=h.useCallback(R=>{R&&k.current===!0&&(N(),C==null||C(),k.current=!1)},[N,C]);return t.jsx(nC,{scope:l,contentWrapper:p,shouldExpandOnScrollRef:_,onScrollButtonChange:V,children:t.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:t.jsx(Oe.div,{...c,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});kg.displayName=eC;var tC="SelectPopperPosition",Cd=h.forwardRef((r,a)=>{const{__scopeSelect:l,align:o="start",collisionPadding:c=gn,...u}=r,f=qi(l);return t.jsx($S,{...f,...u,ref:a,align:o,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)"}})});Cd.displayName=tC;var[nC,uu]=Ks(ns,{}),kd="SelectViewport",Eg=h.forwardRef((r,a)=>{const{__scopeSelect:l,nonce:o,...c}=r,u=Tr(kd,l),f=uu(kd,l),p=Ke(a,u.onViewportChange),x=h.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:o}),t.jsx(Yi.Slot,{scope:l,children:t.jsx(Oe.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:p,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:Ae(c.onScroll,g=>{const v=g.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:E}=f;if(E!=null&&E.current&&y){const _=Math.abs(x.current-v.scrollTop);if(_>0){const k=window.innerHeight-gn*2,w=parseFloat(y.style.minHeight),j=parseFloat(y.style.height),b=Math.max(w,j);if(b0?A:0,y.style.justifyContent="flex-end")}}}x.current=v.scrollTop})})})]})});Eg.displayName=kd;var Pg="SelectGroup",[rC,sC]=Ks(Pg),aC=h.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r,c=wr();return t.jsx(rC,{scope:l,id:c,children:t.jsx(Oe.div,{role:"group","aria-labelledby":c,...o,ref:a})})});aC.displayName=Pg;var Rg="SelectLabel",lC=h.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r,c=sC(Rg,l);return t.jsx(Oe.div,{id:c.id,...o,ref:a})});lC.displayName=Rg;var Ti="SelectItem",[iC,_g]=Ks(Ti),Tg=h.forwardRef((r,a)=>{const{__scopeSelect:l,value:o,disabled:c=!1,textValue:u,...f}=r,p=_r(Ti,l),x=Tr(Ti,l),g=p.value===o,[v,y]=h.useState(u??""),[E,_]=h.useState(!1),k=Ke(a,C=>{var N;return(N=x.itemRefCallback)==null?void 0:N.call(x,C,o,c)}),w=wr(),j=h.useRef("touch"),b=()=>{c||(p.onValueChange(o),p.onOpenChange(!1))};if(o==="")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(iC,{scope:l,value:o,disabled:c,textId:w,isSelected:g,onItemTextChange:h.useCallback(C=>{y(N=>N||((C==null?void 0:C.textContent)??"").trim())},[]),children:t.jsx(Yi.ItemSlot,{scope:l,value:o,disabled:c,textValue:v,children:t.jsx(Oe.div,{role:"option","aria-labelledby":w,"data-highlighted":E?"":void 0,"aria-selected":g&&E,"data-state":g?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...f,ref:k,onFocus:Ae(f.onFocus,()=>_(!0)),onBlur:Ae(f.onBlur,()=>_(!1)),onClick:Ae(f.onClick,()=>{j.current!=="mouse"&&b()}),onPointerUp:Ae(f.onPointerUp,()=>{j.current==="mouse"&&b()}),onPointerDown:Ae(f.onPointerDown,C=>{j.current=C.pointerType}),onPointerMove:Ae(f.onPointerMove,C=>{var N;j.current=C.pointerType,c?(N=x.onItemLeave)==null||N.call(x):j.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ae(f.onPointerLeave,C=>{var N;C.currentTarget===document.activeElement&&((N=x.onItemLeave)==null||N.call(x))}),onKeyDown:Ae(f.onKeyDown,C=>{var A;((A=x.searchRef)==null?void 0:A.current)!==""&&C.key===" "||(HS.includes(C.key)&&b(),C.key===" "&&C.preventDefault())})})})})});Tg.displayName=Ti;var La="SelectItemText",Ig=h.forwardRef((r,a)=>{const{__scopeSelect:l,className:o,style:c,...u}=r,f=_r(La,l),p=Tr(La,l),x=_g(La,l),g=QS(La,l),[v,y]=h.useState(null),E=Ke(a,b=>y(b),x.onItemTextChange,b=>{var C;return(C=p.itemTextRefCallback)==null?void 0:C.call(p,b,x.value,x.disabled)}),_=v==null?void 0:v.textContent,k=h.useMemo(()=>t.jsx("option",{value:x.value,disabled:x.disabled,children:_},x.value),[x.disabled,x.value,_]),{onNativeOptionAdd:w,onNativeOptionRemove:j}=g;return Rt(()=>(w(k),()=>j(k)),[w,j,k]),t.jsxs(t.Fragment,{children:[t.jsx(Oe.span,{id:x.textId,...u,ref:E}),x.isSelected&&f.valueNode&&!f.valueNodeHasChildren?Ua.createPortal(u.children,f.valueNode):null]})});Ig.displayName=La;var Ag="SelectItemIndicator",Mg=h.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r;return _g(Ag,l).isSelected?t.jsx(Oe.span,{"aria-hidden":!0,...o,ref:a}):null});Mg.displayName=Ag;var Ed="SelectScrollUpButton",Dg=h.forwardRef((r,a)=>{const l=Tr(Ed,r.__scopeSelect),o=uu(Ed,r.__scopeSelect),[c,u]=h.useState(!1),f=Ke(a,o.onScrollButtonChange);return Rt(()=>{if(l.viewport&&l.isPositioned){let p=function(){const g=x.scrollTop>0;u(g)};const x=l.viewport;return p(),x.addEventListener("scroll",p),()=>x.removeEventListener("scroll",p)}},[l.viewport,l.isPositioned]),c?t.jsx(Og,{...r,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:x}=l;p&&x&&(p.scrollTop=p.scrollTop-x.offsetHeight)}}):null});Dg.displayName=Ed;var Pd="SelectScrollDownButton",Lg=h.forwardRef((r,a)=>{const l=Tr(Pd,r.__scopeSelect),o=uu(Pd,r.__scopeSelect),[c,u]=h.useState(!1),f=Ke(a,o.onScrollButtonChange);return Rt(()=>{if(l.viewport&&l.isPositioned){let p=function(){const g=x.scrollHeight-x.clientHeight,v=Math.ceil(x.scrollTop)x.removeEventListener("scroll",p)}},[l.viewport,l.isPositioned]),c?t.jsx(Og,{...r,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:x}=l;p&&x&&(p.scrollTop=p.scrollTop+x.offsetHeight)}}):null});Lg.displayName=Pd;var Og=h.forwardRef((r,a)=>{const{__scopeSelect:l,onAutoScroll:o,...c}=r,u=Tr("SelectScrollButton",l),f=h.useRef(null),p=Qi(l),x=h.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return h.useEffect(()=>()=>x(),[x]),Rt(()=>{var v;const g=p().find(y=>y.ref.current===document.activeElement);(v=g==null?void 0:g.ref.current)==null||v.scrollIntoView({block:"nearest"})},[p]),t.jsx(Oe.div,{"aria-hidden":!0,...c,ref:a,style:{flexShrink:0,...c.style},onPointerDown:Ae(c.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:Ae(c.onPointerMove,()=>{var g;(g=u.onItemLeave)==null||g.call(u),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:Ae(c.onPointerLeave,()=>{x()})})}),oC="SelectSeparator",cC=h.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r;return t.jsx(Oe.div,{"aria-hidden":!0,...o,ref:a})});cC.displayName=oC;var Rd="SelectArrow",dC=h.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r,c=qi(l),u=_r(Rd,l),f=Tr(Rd,l);return u.open&&f.position==="popper"?t.jsx(BS,{...c,...o,ref:a}):null});dC.displayName=Rd;var uC="SelectBubbleInput",Fg=h.forwardRef(({__scopeSelect:r,value:a,...l},o)=>{const c=h.useRef(null),u=Ke(o,c),f=Jd(a);return h.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&v){const y=new Event("change",{bubbles:!0});v.call(p,a),p.dispatchEvent(y)}},[f,a]),t.jsx(Oe.select,{...l,style:{...pg,...l.style},ref:u,defaultValue:a})});Fg.displayName=uC;function zg(r){return r===""||r===void 0}function $g(r){const a=Cr(r),l=h.useRef(""),o=h.useRef(0),c=h.useCallback(f=>{const p=l.current+f;a(p),(function x(g){l.current=g,window.clearTimeout(o.current),g!==""&&(o.current=window.setTimeout(()=>x(""),1e3))})(p)},[a]),u=h.useCallback(()=>{l.current="",window.clearTimeout(o.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(o.current),[]),[l,c,u]}function Bg(r,a,l){const c=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a,u=l?r.indexOf(l):-1;let f=fC(r,Math.max(u,0));c.length===1&&(f=f.filter(g=>g!==l));const x=f.find(g=>g.textValue.toLowerCase().startsWith(c.toLowerCase()));return x!==l?x:void 0}function fC(r,a){return r.map((l,o)=>r[(a+o)%r.length])}var hC=xg,Ug=vg,mC=jg,pC=Ng,xC=bg,Vg=wg,gC=Eg,Wg=Tg,vC=Ig,yC=Mg,jC=Dg,NC=Lg;const id=hC,od=mC,xi=h.forwardRef(({className:r,children:a,...l},o)=>t.jsxs(Ug,{ref:o,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(pC,{asChild:!0,children:t.jsx(Di,{className:"h-4 w-4 opacity-50"})})]}));xi.displayName=Ug.displayName;const gi=h.forwardRef(({className:r,children:a,position:l="popper",...o},c)=>t.jsx(xC,{children:t.jsxs(Vg,{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,...o,children:[t.jsx(jC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(Np,{className:"h-4 w-4"})}),t.jsx(gC,{className:"p-1",children:a}),t.jsx(NC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(Di,{className:"h-4 w-4"})})]})}));gi.displayName=Vg.displayName;const jr=h.forwardRef(({className:r,children:a,...l},o)=>t.jsxs(Wg,{ref:o,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(yC,{children:t.jsx(Mi,{className:"h-4 w-4"})})}),t.jsx(vC,{children:a})]}));jr.displayName=Wg.displayName;const bC=["一","二","三","四","五","六","七","八","九","十"],wC=["序言","尾声","附录"];function ui(r){return r?wC.some(a=>r.includes(a)):!1}function cd(r){return r.startsWith("part:")?{type:"part",id:r.slice(5)}:r.startsWith("chapter:")?{type:"chapter",id:r.slice(8)}:r.startsWith("section:")?{type:"section",id:r.slice(8)}:null}function SC({parts:r,expandedParts:a,onTogglePart:l,onReorder:o,onReadSection:c,onDeleteSection:u}){const[f,p]=h.useState(null),[x,g]=h.useState(null),v=(j,b)=>(f==null?void 0:f.type)===j&&(f==null?void 0:f.id)===b,y=(j,b)=>(x==null?void 0:x.type)===j&&(x==null?void 0:x.id)===b,E=h.useCallback(()=>{const j=[];for(const b of r)for(const C of b.chapters)for(const N of C.sections)j.push({id:N.id,partId:b.id,partTitle:b.title,chapterId:C.id,chapterTitle:C.title});return j},[r]),_=h.useCallback(async(j,b,C,N)=>{var T;j.preventDefault(),j.stopPropagation();const A=j.dataTransfer.getData("text/plain"),$=cd(A);if(!$||$.type===b&&$.id===C)return;const V=E(),R=new Map(V.map(F=>[F.id,F]));if($.type==="section"){const F=R.get($.id);if(F&&ui(F.partTitle))return}else{const F=$.type==="part"?r.find(Y=>Y.id===$.id):r.find(Y=>Y.chapters.some(K=>K.id===$.id));if(F&&ui(F.title))return}if(!(N&&ui(N.partTitle))){if(b==="part"){const F=r.find(Y=>Y.id===C);if(F&&ui(F.title))return}if($.type==="part"&&b==="part"){const F=r.map(X=>X.id),Y=F.indexOf($.id),K=F.indexOf(C);if(Y===-1||K===-1)return;const J=[...F];J.splice(Y,1),J.splice(Yee.id===X);if(le)for(const ee of le.chapters)for(const q of ee.sections){const I=R.get(q.id);I&&ce.push(I)}}await o(ce);return}if($.type==="chapter"&&(b==="chapter"||b==="section"||b==="part")){const F=r.find(I=>I.chapters.some(Q=>Q.id===$.id)),Y=F==null?void 0:F.chapters.find(I=>I.id===$.id);if(!F||!Y)return;let K,J,ce=null;if(b==="section"){const I=R.get(C);if(!I)return;K=I.partId,J=I.partTitle,ce=C}else if(b==="chapter"){const I=r.find(D=>D.chapters.some(P=>P.id===C)),Q=I==null?void 0:I.chapters.find(D=>D.id===C);if(!I||!Q)return;K=I.id,J=I.title;const B=V.filter(D=>D.chapterId===C).pop();ce=(B==null?void 0:B.id)??null}else{const I=r.find(B=>B.id===C);if(!I||!I.chapters[0])return;K=I.id,J=I.title;const Q=V.filter(B=>B.partId===I.id&&B.chapterId===I.chapters[0].id);ce=((T=Q[Q.length-1])==null?void 0:T.id)??null}const X=Y.sections.map(I=>I.id),le=V.filter(I=>!X.includes(I.id));let ee=le.length;if(ce){const I=le.findIndex(Q=>Q.id===ce);I>=0&&(ee=I+1)}const q=X.map(I=>({...R.get(I),partId:K,partTitle:J,chapterId:Y.id,chapterTitle:Y.title}));await o([...le.slice(0,ee),...q,...le.slice(ee)]);return}if($.type==="section"&&(b==="section"||b==="chapter"||b==="part")){if(!N)return;const{partId:F,partTitle:Y,chapterId:K,chapterTitle:J}=N;let ce;if(b==="section")ce=V.findIndex(Q=>Q.id===C);else if(b==="chapter"){const Q=V.filter(B=>B.chapterId===C).pop();ce=Q?V.findIndex(B=>B.id===Q.id)+1:V.length}else{const Q=r.find(P=>P.id===C);if(!(Q!=null&&Q.chapters[0]))return;const B=V.filter(P=>P.partId===Q.id&&P.chapterId===Q.chapters[0].id),D=B[B.length-1];ce=D?V.findIndex(P=>P.id===D.id)+1:0}const X=V.findIndex(Q=>Q.id===$.id);if(X===-1)return;const le=V.filter(Q=>Q.id!==$.id),ee=X({onDragEnter:N=>{N.preventDefault(),N.stopPropagation(),N.dataTransfer.dropEffect="move",g({type:j,id:b})},onDragOver:N=>{N.preventDefault(),N.stopPropagation(),N.dataTransfer.dropEffect="move",g({type:j,id:b})},onDragLeave:()=>g(null),onDrop:N=>{g(null);const A=cd(N.dataTransfer.getData("text/plain"));if(A&&!(j==="section"&&A.type==="section"&&A.id===b))if(j==="part")if(A.type==="part")_(N,"part",b);else{const $=r.find(R=>R.id===b);($==null?void 0:$.chapters[0])&&C&&_(N,"part",b,C)}else j==="chapter"&&C?(A.type==="section"||A.type==="chapter")&&_(N,"chapter",b,C):j==="section"&&C&&_(N,"section",b,C)}}),w=j=>bC[j]??String(j+1);return t.jsx("div",{className:"space-y-3",children:r.map((j,b)=>{var F,Y;const C=j.title==="序言"||j.title.includes("序言"),N=j.title==="尾声"||j.title.includes("尾声"),A=j.title==="附录"||j.title.includes("附录"),$=a.includes(j.id),V=j.chapters.length,R=j.chapters.reduce((K,J)=>K+J.sections.length,0);if(C&&j.chapters.length===1&&j.chapters[0].sections.length===1){const K=j.chapters[0].sections[0];return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:t.jsx(Wn,{className:"w-4 h-4 text-gray-400"})}),t.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[j.chapters[0].title," | ",K.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:J=>J.stopPropagation(),onClick:J=>J.stopPropagation(),children:[K.price===0||K.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",K.price]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(sn,{className:"w-3.5 h-3.5"})}),t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(K),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Vn,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},j.id)}if(A)return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),t.jsx("div",{className:"space-y-3",children:j.chapters.map((K,J)=>t.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[t.jsxs("span",{className:"text-sm text-gray-300",children:["附录",J+1," | ",K.title]}),t.jsx(As,{className:"w-4 h-4 text-gray-500 shrink-0"})]},K.id))})]},j.id);if(N&&j.chapters.length===1&&j.chapters[0].sections.length===1){const K=j.chapters[0].sections[0];return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:t.jsx(Wn,{className:"w-4 h-4 text-gray-400"})}),t.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[j.chapters[0].title," | ",K.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:J=>J.stopPropagation(),onClick:J=>J.stopPropagation(),children:[K.price===0||K.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",K.price]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(sn,{className:"w-3.5 h-3.5"})}),t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(K),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Vn,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},j.id)}if(N)return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),t.jsx("div",{className:"space-y-3",children:j.chapters.map(K=>K.sections.map(J=>t.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[t.jsxs("span",{className:"text-sm text-gray-300",children:[K.title," | ",J.title]}),t.jsxs("div",{className:"flex gap-1 shrink-0",children:[t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(J),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(J),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(sn,{className:"w-3.5 h-3.5"})}),t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(J),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Vn,{className:"w-3.5 h-3.5"})})]})]},J.id)))})]},j.id);const T=y("part",j.id);return t.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${T?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...k("part",j.id,{partId:j.id,partTitle:j.title,chapterId:((F=j.chapters[0])==null?void 0:F.id)??"",chapterTitle:((Y=j.chapters[0])==null?void 0:Y.title)??""}),children:[t.jsxs("div",{draggable:!0,onDragStart:K=>{K.stopPropagation(),K.dataTransfer.setData("text/plain","part:"+j.id),K.dataTransfer.effectAllowed="move",p({type:"part",id:j.id})},onDragEnd:()=>{p(null),g(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${v("part",j.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>l(j.id),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx(Gc,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),t.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:w(b)}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-bold text-white text-base",children:j.title}),t.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",R," 节"]})]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[t.jsxs("span",{className:"text-xs text-gray-500",children:[V,"章"]}),$?t.jsx(Di,{className:"w-5 h-5 text-gray-500"}):t.jsx(As,{className:"w-5 h-5 text-gray-500"})]})]}),$&&t.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:j.chapters.map((K,J)=>{const ce=y("chapter",K.id);return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{draggable:!0,onDragStart:X=>{X.stopPropagation(),X.dataTransfer.setData("text/plain","chapter:"+K.id),X.dataTransfer.effectAllowed="move",p({type:"chapter",id:K.id})},onDragEnd:()=>{p(null),g(null)},onDragEnter:X=>{X.preventDefault(),X.stopPropagation(),X.dataTransfer.dropEffect="move",g({type:"chapter",id:K.id})},onDragOver:X=>{X.preventDefault(),X.stopPropagation(),X.dataTransfer.dropEffect="move",g({type:"chapter",id:K.id})},onDragLeave:()=>g(null),onDrop:X=>{g(null);const le=cd(X.dataTransfer.getData("text/plain"));if(!le)return;const ee={partId:j.id,partTitle:j.title,chapterId:K.id,chapterTitle:K.title};(le.type==="section"||le.type==="chapter")&&_(X,"chapter",K.id,ee)},className:`py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${ce?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${v("chapter",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[t.jsx(Gc,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),t.jsxs("p",{className:"text-xs text-gray-500 pb-1",children:["第",J+1,"章 | ",K.title]})]}),t.jsx("div",{className:"space-y-1 pl-2",children:K.sections.map(X=>{const le=y("section",X.id);return t.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+X.id),ee.dataTransfer.effectAllowed="move",p({type:"section",id:X.id})},onDragEnd:()=>{p(null),g(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${le?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${v("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...k("section",X.id,{partId:j.id,partTitle:j.title,chapterId:K.id,chapterTitle:K.title}),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx(Gc,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),t.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${X.price===0||X.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),t.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[X.id," ",X.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[X.isNew&&t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),X.price===0||X.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",X.price]}),t.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:t.jsx(sn,{className:"w-3.5 h-3.5"})}),t.jsx(oe,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:t.jsx(Vn,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},X.id)})})]},K.id)})})]},j.id)})})}function CC(r){const a=new Map;for(const c of r){const u=c.partId||"part-1",f=c.partTitle||"未分类",p=c.chapterId||"chapter-1",x=c.chapterTitle||"未分类";a.has(u)||a.set(u,{id:u,title:f,chapters:new Map});const g=a.get(u);g.chapters.has(p)||g.chapters.set(p,{id:p,title:x,sections:[]}),g.chapters.get(p).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew})}const l=Array.from(a.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes("附录")?2:c.includes("尾声")?3:1;return l.sort((c,u)=>{const f=o(c.title),p=o(u.title);return f!==p?f-p:0})}function kC(){const[r,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState([]),[f,p]=h.useState(null),[x,g]=h.useState(!1),[v,y]=h.useState(!1),[E,_]=h.useState(!1),[k,w]=h.useState(""),[j,b]=h.useState([]),[C,N]=h.useState(!1),[A,$]=h.useState(!1),V=h.useRef(null),[R,T]=h.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),F=CC(r),Y=r.length,K=async()=>{o(!0);try{const P=await We("/api/db/book?action=list");a(Array.isArray(P==null?void 0:P.sections)?P.sections:[])}catch(P){console.error(P),a([])}finally{o(!1)}};h.useEffect(()=>{K()},[]);const J=P=>{u(W=>W.includes(P)?W.filter(re=>re!==P):[...W,P])},ce=h.useCallback(P=>{const W=r,re=P.flatMap(he=>{const me=W.find(se=>se.id===he.id);return me?[{...me,partId:he.partId,partTitle:he.partTitle,chapterId:he.chapterId,chapterTitle:he.chapterTitle}]:[]});return a(re),Pt("/api/db/book",{action:"reorder",items:P}).then(he=>{he&&he.success===!1&&(a(W),alert("排序失败: "+(he&&typeof he=="object"&&"error"in he?he.error:"未知错误")))}).catch(he=>{a(W),console.error("排序失败:",he),alert("排序失败: "+(he instanceof Error?he.message:"网络或服务异常"))}),Promise.resolve()},[r]),X=async P=>{if(confirm(`确定要删除章节「${P.title}」吗?此操作不可恢复。`))try{const W=await Wa(`/api/db/book?id=${encodeURIComponent(P.id)}`);W&&W.success!==!1?(alert("已删除"),K()):alert("删除失败: "+(W&&typeof W=="object"&&"error"in W?W.error:"未知错误"))}catch(W){console.error(W),alert("删除失败")}},le=async P=>{y(!0);try{const W=await We(`/api/db/book?action=read&id=${encodeURIComponent(P.id)}`);if(W!=null&&W.success&&W.section){const re=W.section;p({id:P.id,title:W.section.title??P.title,price:W.section.price??P.price,content:W.section.content??"",filePath:P.filePath,isFree:P.isFree||P.price===0,isNew:re.isNew??P.isNew})}else p({id:P.id,title:P.title,price:P.price,content:"",filePath:P.filePath,isFree:P.isFree,isNew:P.isNew}),W&&!W.success&&alert("无法读取文件内容: "+(W.error||"未知错误"))}catch(W){console.error(W),p({id:P.id,title:P.title,price:P.price,content:"",filePath:P.filePath,isFree:P.isFree})}finally{y(!1)}},ee=async()=>{var P;if(f){_(!0);try{let W=f.content||"";const re=[new RegExp(`^#+\\s*${f.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${f.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(P=f.title)==null?void 0:P.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const me of re)W=W.replace(me,"");W=W.replace(/^\s*\n+/,"").trim();const he=await Pt("/api/db/book",{id:f.id,title:f.title,price:f.isFree?0:f.price,content:W,isFree:f.isFree||f.price===0,isNew:f.isNew,saveToFile:!0});he&&he.success!==!1?(alert(`已保存章节: ${f.title}`),p(null),K()):alert("保存失败: "+(he&&typeof he=="object"&&"error"in he?he.error:"未知错误"))}catch(W){console.error(W),alert("保存失败")}finally{_(!1)}}},q=async()=>{if(!R.id||!R.title){alert("请填写章节ID和标题");return}_(!0);try{const P=await Pt("/api/db/book",{id:R.id,title:R.title,price:R.price,content:R.content,partId:R.partId,chapterId:R.chapterId,saveToFile:!1});P&&P.success!==!1?(alert(`章节创建成功: ${R.title}`),g(!1),T({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),K()):alert("创建失败: "+(P&&typeof P=="object"&&"error"in P?P.error:"未知错误"))}catch(P){console.error(P),alert("创建失败")}finally{_(!1)}},I=async P=>{var re,he;const W=(re=P.target.files)==null?void 0:re[0];if(W){$(!0);try{const me=new FormData;me.append("file",W),me.append("folder","book-images");const pe=await(await fetch(Fs("/api/upload"),{method:"POST",body:me,credentials:"include"})).json();if(pe!=null&&pe.success&&((he=pe==null?void 0:pe.data)!=null&&he.url)){const L=`![${W.name}](${pe.data.url})`;f&&p({...f,content:(f.content||"")+` - -`+L}),alert(`图片上传成功: ${pe.data.url}`)}else alert("上传失败: "+((pe==null?void 0:pe.error)||"未知错误"))}catch(me){console.error(me),alert("上传失败")}finally{$(!1),V.current&&(V.current.value="")}}},Q=async()=>{var P;if(k.trim()){N(!0);try{const W=await We(`/api/search?q=${encodeURIComponent(k)}`);W!=null&&W.success&&((P=W.data)!=null&&P.results)?b(W.data.results):(b([]),W&&!W.success&&alert("搜索失败: "+W.error))}catch(W){console.error(W),b([]),alert("搜索失败")}finally{N(!1)}}},B=F.find(P=>P.id===R.partId),D=(B==null?void 0:B.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:["共 ",F.length," 篇 · ",Y," 节内容"]})]}),t.jsx("div",{className:"flex gap-2",children:t.jsxs(oe,{onClick:()=>{const P=typeof window<"u"?`${window.location.origin}/api-doc`:"";P&&window.open(P,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Yr,{className:"w-4 h-4 mr-2"}),"API 接口"]})})]}),t.jsx(Bt,{open:x,onOpenChange:g,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(Ut,{children:t.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[t.jsx(Rn,{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(Z,{className:"text-gray-300",children:"章节ID *"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:R.id,onChange:P=>T({...R,id:P.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:R.price,onChange:P=>T({...R,price:Number(P.target.value)})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"章节标题 *"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:R.title,onChange:P=>T({...R,title:P.target.value})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"所属篇"}),t.jsxs(id,{value:R.partId,onValueChange:P=>T({...R,partId:P,chapterId:"chapter-1"}),children:[t.jsx(xi,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[F.map(P=>t.jsx(jr,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id)),F.length===0&&t.jsx(jr,{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(Z,{className:"text-gray-300",children:"所属章"}),t.jsxs(id,{value:R.chapterId,onValueChange:P=>T({...R,chapterId:P}),children:[t.jsx(xi,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[D.map(P=>t.jsx(jr,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id)),D.length===0&&t.jsx(jr,{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(Z,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsx(Xr,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:R.content,onChange:P=>T({...R,content:P.target.value})})]})]}),t.jsxs(qt,{children:[t.jsx(oe,{variant:"outline",onClick:()=>g(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(oe,{onClick:q,disabled:E||!R.id||!R.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Rn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),t.jsx(Bt,{open:!!f,onOpenChange:()=>p(null),children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(Ut,{children:t.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[t.jsx(sn,{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(Z,{className:"text-gray-300",children:"章节ID"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.id,disabled:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.isFree?0:f.price,onChange:P=>p({...f,price:Number(P.target.value),isFree:Number(P.target.value)===0}),disabled:f.isFree})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"免费章节(唯一入口,小程序以 is_free 或 price=0 为准)"}),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:P=>p({...f,isFree:P.target.checked,price:P.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(Z,{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.isNew??!1,onChange:P=>p({...f,isNew:P.target.checked}),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:"标记 NEW"})]})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"章节标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.title,onChange:P=>p({...f,title:P.target.value})})]}),f.filePath&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"文件路径"}),t.jsx(ne,{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(Z,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:V,type:"file",accept:"image/*",onChange:I,className:"hidden"}),t.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>{var P;return(P=V.current)==null?void 0:P.click()},disabled:A,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[A?t.jsx(Ze,{className:"w-4 h-4 mr-1 animate-spin"}):t.jsx(Cp,{className:"w-4 h-4 mr-1"}),"上传图片"]})]})]}),v?t.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(Xr,{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:P=>p({...f,content:P.target.value})})]})]}),t.jsxs(qt,{children:[t.jsxs(oe,{variant:"outline",onClick:()=>p(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(on,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsx(oe,{onClick:ee,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),t.jsxs(nu,{defaultValue:"chapters",className:"space-y-6",children:[t.jsxs(Vi,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[t.jsxs(an,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Wn,{className:"w-4 h-4 mr-2"}),"章节管理"]}),t.jsxs(an,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Qr,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),t.jsxs(an,{value:"hooks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(ON,{className:"w-4 h-4 mr-2"}),"钩子配置"]})]}),t.jsxs(ln,{value:"chapters",className:"space-y-4",children:[t.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:t.jsx(Wn,{className:"w-6 h-6"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),t.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),t.jsxs("div",{className:"text-center shrink-0",children:[t.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:Y}),t.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),t.jsxs(oe,{onClick:()=>g(!0),className:"w-full bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[t.jsx(Rn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),l?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(SC,{parts:F,expandedParts:c,onTogglePart:J,onReorder:ce,onReadSection:le,onDeleteSection:X})]}),t.jsx(ln,{value:"search",className:"space-y-4",children:t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"内容搜索"})}),t.jsxs(Ee,{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:k,onChange:P=>w(P.target.value),onKeyDown:P=>P.key==="Enter"&&Q()}),t.jsx(oe,{onClick:Q,disabled:C||!k.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?t.jsx(Ze,{className:"w-4 h-4 animate-spin"}):t.jsx(Qr,{className:"w-4 h-4"})})]}),j.length>0&&t.jsxs("div",{className:"space-y-2 mt-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",j.length," 个结果"]}),j.map(P=>t.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>le({id:P.id,title:P.title,price:P.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:P.id}),t.jsx("span",{className:"text-white",children:P.title})]}),t.jsx(Me,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:P.matchType==="title"?"标题匹配":"内容匹配"})]}),P.snippet&&t.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:P.snippet}),(P.partTitle||P.chapterTitle)&&t.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[P.partTitle," · ",P.chapterTitle]})]},P.id))]})]})]})}),t.jsx(ln,{value:"hooks",className:"space-y-4",children:t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"引流钩子配置"})}),t.jsxs(Ee,{className:"space-y-4",children:[t.jsxs("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[t.jsx(Z,{htmlFor:"hook-chapter",className:"text-gray-300",children:"触发章节"}),t.jsxs(id,{defaultValue:"3",children:[t.jsx(xi,{id:"hook-chapter",className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{placeholder:"选择章节"})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[t.jsx(jr,{value:"1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第一章"}),t.jsx(jr,{value:"2",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第二章"}),t.jsx(jr,{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(Z,{htmlFor:"message",className:"text-gray-300",children:"引流文案"}),t.jsx(Xr,{placeholder:"输入引导用户加群的文案...",id:"message",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",defaultValue:"阅读更多精彩内容,请加入Soul创业实验派对群..."})]}),t.jsx(oe,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:"保存配置"})]})]})})]})]})}var Hg=["PageUp","PageDown"],Kg=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Gg={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Gs="Slider",[_d,EC,PC]=eu(Gs),[Yg]=Rr(Gs,[PC]),[RC,Xi]=Yg(Gs),Qg=h.forwardRef((r,a)=>{const{name:l,min:o=0,max:c=100,step:u=1,orientation:f="horizontal",disabled:p=!1,minStepsBetweenThumbs:x=0,defaultValue:g=[o],value:v,onValueChange:y=()=>{},onValueCommit:E=()=>{},inverted:_=!1,form:k,...w}=r,j=h.useRef(new Set),b=h.useRef(0),N=f==="horizontal"?_C:TC,[A=[],$]=Jr({prop:v,defaultProp:g,onChange:K=>{var ce;(ce=[...j.current][b.current])==null||ce.focus(),y(K)}}),V=h.useRef(A);function R(K){const J=LC(A,K);Y(K,J)}function T(K){Y(K,b.current)}function F(){const K=V.current[b.current];A[b.current]!==K&&E(A)}function Y(K,J,{commit:ce}={commit:!1}){const X=$C(u),le=BC(Math.round((K-o)/u)*u+o,X),ee=ki(le,[o,c]);$((q=[])=>{const I=MC(q,ee,J);if(zC(I,x*u)){b.current=I.indexOf(ee);const Q=String(I)!==String(q);return Q&&ce&&E(I),Q?I:q}else return q})}return t.jsx(RC,{scope:r.__scopeSlider,name:l,disabled:p,min:o,max:c,valueIndexToChangeRef:b,thumbs:j.current,values:A,orientation:f,form:k,children:t.jsx(_d.Provider,{scope:r.__scopeSlider,children:t.jsx(_d.Slot,{scope:r.__scopeSlider,children:t.jsx(N,{"aria-disabled":p,"data-disabled":p?"":void 0,...w,ref:a,onPointerDown:Ae(w.onPointerDown,()=>{p||(V.current=A)}),min:o,max:c,inverted:_,onSlideStart:p?void 0:R,onSlideMove:p?void 0:T,onSlideEnd:p?void 0:F,onHomeKeyDown:()=>!p&&Y(o,0,{commit:!0}),onEndKeyDown:()=>!p&&Y(c,A.length-1,{commit:!0}),onStepKeyDown:({event:K,direction:J})=>{if(!p){const le=Hg.includes(K.key)||K.shiftKey&&Kg.includes(K.key)?10:1,ee=b.current,q=A[ee],I=u*le*J;Y(q+I,ee,{commit:!0})}}})})})})});Qg.displayName=Gs;var[qg,Xg]=Yg(Gs,{startEdge:"left",endEdge:"right",size:"width",direction:1}),_C=h.forwardRef((r,a)=>{const{min:l,max:o,dir:c,inverted:u,onSlideStart:f,onSlideMove:p,onSlideEnd:x,onStepKeyDown:g,...v}=r,[y,E]=h.useState(null),_=Ke(a,N=>E(N)),k=h.useRef(void 0),w=Bi(c),j=w==="ltr",b=j&&!u||!j&&u;function C(N){const A=k.current||y.getBoundingClientRect(),$=[0,A.width],R=fu($,b?[l,o]:[o,l]);return k.current=A,R(N-A.left)}return t.jsx(qg,{scope:r.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:t.jsx(Jg,{dir:w,"data-orientation":"horizontal",...v,ref:_,style:{...v.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:N=>{const A=C(N.clientX);f==null||f(A)},onSlideMove:N=>{const A=C(N.clientX);p==null||p(A)},onSlideEnd:()=>{k.current=void 0,x==null||x()},onStepKeyDown:N=>{const $=Gg[b?"from-left":"from-right"].includes(N.key);g==null||g({event:N,direction:$?-1:1})}})})}),TC=h.forwardRef((r,a)=>{const{min:l,max:o,inverted:c,onSlideStart:u,onSlideMove:f,onSlideEnd:p,onStepKeyDown:x,...g}=r,v=h.useRef(null),y=Ke(a,v),E=h.useRef(void 0),_=!c;function k(w){const j=E.current||v.current.getBoundingClientRect(),b=[0,j.height],N=fu(b,_?[o,l]:[l,o]);return E.current=j,N(w-j.top)}return t.jsx(qg,{scope:r.__scopeSlider,startEdge:_?"bottom":"top",endEdge:_?"top":"bottom",size:"height",direction:_?1:-1,children:t.jsx(Jg,{"data-orientation":"vertical",...g,ref:y,style:{...g.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const j=k(w.clientY);u==null||u(j)},onSlideMove:w=>{const j=k(w.clientY);f==null||f(j)},onSlideEnd:()=>{E.current=void 0,p==null||p()},onStepKeyDown:w=>{const b=Gg[_?"from-bottom":"from-top"].includes(w.key);x==null||x({event:w,direction:b?-1:1})}})})}),Jg=h.forwardRef((r,a)=>{const{__scopeSlider:l,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onHomeKeyDown:f,onEndKeyDown:p,onStepKeyDown:x,...g}=r,v=Xi(Gs,l);return t.jsx(Oe.span,{...g,ref:a,onKeyDown:Ae(r.onKeyDown,y=>{y.key==="Home"?(f(y),y.preventDefault()):y.key==="End"?(p(y),y.preventDefault()):Hg.concat(Kg).includes(y.key)&&(x(y),y.preventDefault())}),onPointerDown:Ae(r.onPointerDown,y=>{const E=y.target;E.setPointerCapture(y.pointerId),y.preventDefault(),v.thumbs.has(E)?E.focus():o(y)}),onPointerMove:Ae(r.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&c(y)}),onPointerUp:Ae(r.onPointerUp,y=>{const E=y.target;E.hasPointerCapture(y.pointerId)&&(E.releasePointerCapture(y.pointerId),u(y))})})}),Zg="SliderTrack",e0=h.forwardRef((r,a)=>{const{__scopeSlider:l,...o}=r,c=Xi(Zg,l);return t.jsx(Oe.span,{"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation,...o,ref:a})});e0.displayName=Zg;var Td="SliderRange",t0=h.forwardRef((r,a)=>{const{__scopeSlider:l,...o}=r,c=Xi(Td,l),u=Xg(Td,l),f=h.useRef(null),p=Ke(a,f),x=c.values.length,g=c.values.map(E=>s0(E,c.min,c.max)),v=x>1?Math.min(...g):0,y=100-Math.max(...g);return t.jsx(Oe.span,{"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,...o,ref:p,style:{...r.style,[u.startEdge]:v+"%",[u.endEdge]:y+"%"}})});t0.displayName=Td;var Id="SliderThumb",n0=h.forwardRef((r,a)=>{const l=EC(r.__scopeSlider),[o,c]=h.useState(null),u=Ke(a,p=>c(p)),f=h.useMemo(()=>o?l().findIndex(p=>p.ref.current===o):-1,[l,o]);return t.jsx(IC,{...r,ref:u,index:f})}),IC=h.forwardRef((r,a)=>{const{__scopeSlider:l,index:o,name:c,...u}=r,f=Xi(Id,l),p=Xg(Id,l),[x,g]=h.useState(null),v=Ke(a,C=>g(C)),y=x?f.form||!!x.closest("form"):!0,E=Zd(x),_=f.values[o],k=_===void 0?0:s0(_,f.min,f.max),w=DC(o,f.values.length),j=E==null?void 0:E[p.size],b=j?OC(j,k,p.direction):0;return h.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",[p.startEdge]:`calc(${k}% + ${b}px)`},children:[t.jsx(_d.ItemSlot,{scope:r.__scopeSlider,children:t.jsx(Oe.span,{role:"slider","aria-label":r["aria-label"]||w,"aria-valuemin":f.min,"aria-valuenow":_,"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:v,style:_===void 0?{display:"none"}:r.style,onFocus:Ae(r.onFocus,()=>{f.valueIndexToChangeRef.current=o})})}),y&&t.jsx(r0,{name:c??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:_},o)]})});n0.displayName=Id;var AC="RadioBubbleInput",r0=h.forwardRef(({__scopeSlider:r,value:a,...l},o)=>{const c=h.useRef(null),u=Ke(c,o),f=Jd(a);return h.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&v){const y=new Event("input",{bubbles:!0});v.call(p,a),p.dispatchEvent(y)}},[f,a]),t.jsx(Oe.input,{style:{display:"none"},...l,ref:u,defaultValue:a})});r0.displayName=AC;function MC(r=[],a,l){const o=[...r];return o[l]=a,o.sort((c,u)=>c-u)}function s0(r,a,l){const u=100/(l-a)*(r-a);return ki(u,[0,100])}function DC(r,a){return a>2?`Value ${r+1} of ${a}`:a===2?["Minimum","Maximum"][r]:void 0}function LC(r,a){if(r.length===1)return 0;const l=r.map(c=>Math.abs(c-a)),o=Math.min(...l);return l.indexOf(o)}function OC(r,a,l){const o=r/2,u=fu([0,50],[0,o]);return(o-u(a)*l)*l}function FC(r){return r.slice(0,-1).map((a,l)=>r[l+1]-a)}function zC(r,a){if(a>0){const l=FC(r);return Math.min(...l)>=a}return!0}function fu(r,a){return l=>{if(r[0]===r[1]||a[0]===a[1])return a[0];const o=(a[1]-a[0])/(r[1]-r[0]);return a[0]+o*(l-r[0])}}function $C(r){return(String(r).split(".")[1]||"").length}function BC(r,a){const l=Math.pow(10,a);return Math.round(r*l)/l}var UC=Qg,VC=e0,WC=t0,HC=n0;function KC({className:r,defaultValue:a,value:l,min:o=0,max:c=100,...u}){const f=h.useMemo(()=>Array.isArray(l)?l:Array.isArray(a)?a:[o,c],[l,a,o,c]);return t.jsxs(UC,{defaultValue:a,value:l,min:o,max:c,className:Ge("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",r),...u,children:[t.jsx(VC,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:t.jsx(WC,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:f.length},(p,x)=>t.jsx(HC,{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 GC={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function YC(){const[r,a]=h.useState(GC),[l,o]=h.useState(!0),[c,u]=h.useState(!1);h.useEffect(()=>{We("/api/admin/referral-settings").then(x=>{const g=x==null?void 0:x.data;g&&typeof g=="object"&&a({distributorShare:g.distributorShare??90,minWithdrawAmount:g.minWithdrawAmount??10,bindingDays:g.bindingDays??30,userDiscount:g.userDiscount??5,enableAutoWithdraw:g.enableAutoWithdraw??!1,vipOrderShareVip:g.vipOrderShareVip??20,vipOrderShareNonVip:g.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>o(!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},g=await jt("/api/admin/referral-settings",x);if(!g||g.success===!1){alert("保存失败: "+(g&&typeof g=="object"&&"error"in g?g.error:""));return}alert(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(x){console.error(x),alert("保存失败: "+(x instanceof Error?x.message:String(x)))}finally{u(!1)}},p=x=>g=>{const v=parseFloat(g.target.value||"0");a(y=>({...y,[x]:isNaN(v)?0:v}))};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(Os,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),t.jsxs(oe,{onClick:f,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"flex items-center gap-2 text-white",children:[t.jsx(EN,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),t.jsx(ot,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),t.jsx(Ee,{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(Z,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ni,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),t.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.userDiscount,onChange:p("userDiscount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(vn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(KC,{className:"flex-1",min:10,max:100,step:1,value:[r.distributorShare],onValueChange:([x])=>a(g=>({...g,distributorShare:x}))}),t.jsx(ne,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:r.distributorShare,onChange:p("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(Z,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ni,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),t.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.vipOrderShareVip,onChange:p("vipOrderShareVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ni,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),t.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.vipOrderShareNonVip,onChange:p("vipOrderShareNonVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(vn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),t.jsx(ne,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:r.bindingDays,onChange:p("bindingDays")}),t.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"flex items-center gap-2 text-white",children:[t.jsx(Os,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),t.jsx(ot,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),t.jsx(Ee,{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(Z,{className:"text-gray-300",children:"最低提现金额(元)"}),t.jsx(ne,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:r.minWithdrawAmount,onChange:p("minWithdrawAmount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",t.jsx(Me,{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(ht,{checked:r.enableAutoWithdraw,onCheckedChange:x=>a(g=>({...g,enableAutoWithdraw:x}))}),t.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx($e,{children:t.jsxs(Be,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[t.jsx(ni,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),t.jsxs(Ee,{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 Un={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function sp(r){return Array.isArray(r)?r.map(a=>a&&typeof a=="object"&&"label"in a&&"value"in a?{label:String(a.label),value:String(a.value)}:{label:"",value:""}).filter(a=>a.label||a.value):Un.stats}function ap(r){return Array.isArray(r)?r.map(a=>typeof a=="string"?a:String(a??"")).filter(Boolean):Un.highlights}function QC(){const[r,a]=h.useState(Un),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(!1),x=h.useRef(null);h.useEffect(()=>{We("/api/admin/author-settings").then(b=>{const C=b==null?void 0:b.data;C&&typeof C=="object"&&a({name:String(C.name??Un.name),avatar:String(C.avatar??Un.avatar),avatarImg:String(C.avatarImg??""),title:String(C.title??Un.title),bio:String(C.bio??Un.bio),stats:sp(C.stats).length?sp(C.stats):Un.stats,highlights:ap(C.highlights).length?ap(C.highlights):Un.highlights})}).catch(console.error).finally(()=>o(!1))},[]);const g=async()=>{u(!0);try{const b={name:r.name,avatar:r.avatar||"K",avatarImg:r.avatarImg,title:r.title,bio:r.bio,stats:r.stats.filter(A=>A.label||A.value),highlights:r.highlights.filter(Boolean)},C=await jt("/api/admin/author-settings",b);if(!C||C.success===!1){alert("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:""));return}u(!1);const N=document.createElement("div");N.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",N.textContent="作者设置已保存",document.body.appendChild(N),setTimeout(()=>N.remove(),2e3)}catch(b){console.error(b),alert("保存失败: "+(b instanceof Error?b.message:String(b)))}finally{u(!1)}},v=async b=>{var N;const C=(N=b.target.files)==null?void 0:N[0];if(C){p(!0);try{const A=new FormData;A.append("file",C),A.append("folder","avatars");const $=Bd(),V={};$&&(V.Authorization=`Bearer ${$}`);const T=await(await fetch(Fs("/api/upload"),{method:"POST",body:A,credentials:"include",headers:V})).json();T!=null&&T.success&&(T!=null&&T.url)?a(F=>({...F,avatarImg:T.url})):alert("上传失败: "+((T==null?void 0:T.error)||"未知错误"))}catch(A){console.error(A),alert("上传失败")}finally{p(!1),x.current&&(x.current.value="")}}},y=()=>a(b=>({...b,stats:[...b.stats,{label:"",value:""}]})),E=b=>a(C=>({...C,stats:C.stats.filter((N,A)=>A!==b)})),_=(b,C,N)=>a(A=>({...A,stats:A.stats.map(($,V)=>V===b?{...$,[C]:N}:$)})),k=()=>a(b=>({...b,highlights:[...b.highlights,""]})),w=b=>a(C=>({...C,highlights:C.highlights.filter((N,A)=>A!==b)})),j=(b,C)=>a(N=>({...N,highlights:N.highlights.map((A,$)=>$===b?C:A)}));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(qr,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),t.jsxs(oe,{onClick:g,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"flex items-center gap-2 text-white",children:[t.jsx(qr,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),t.jsx(ot,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),t.jsxs(Ee,{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(Z,{className:"text-gray-300",children:"姓名"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:r.name,onChange:b=>a(C=>({...C,name:b.target.value})),placeholder:"卡若"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:r.avatar,onChange:b=>a(C=>({...C,avatar:b.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Cp,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:r.avatarImg,onChange:b=>a(C=>({...C,avatarImg:b.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),t.jsx("input",{ref:x,type:"file",accept:"image/*",className:"hidden",onChange:v}),t.jsxs(oe,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:f,onClick:()=>{var b;return(b=x.current)==null?void 0:b.click()},children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),f?"上传中...":"上传"]})]}),r.avatarImg&&t.jsx("div",{className:"mt-2",children:t.jsx("img",{src:r.avatarImg.startsWith("http")?r.avatarImg:Fs(r.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"头衔"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:r.title,onChange:b=>a(C=>({...C,title:b.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"个人简介"}),t.jsx(Xr,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:r.bio,onChange:b=>a(C=>({...C,bio:b.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsx(Be,{className:"text-white",children:"统计数据"}),t.jsx(ot,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),t.jsxs(Ee,{className:"space-y-3",children:[r.stats.map((b,C)=>t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:b.label,onChange:N=>_(C,"label",N.target.value),placeholder:"标签"}),t.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:b.value,onChange:N=>_(C,"value",N.target.value),placeholder:"数值"}),t.jsx(oe,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>E(C),children:t.jsx(on,{className:"w-4 h-4"})})]},C)),t.jsxs(oe,{variant:"outline",size:"sm",onClick:y,className:"border-gray-600 text-gray-400",children:[t.jsx(Rn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsx(Be,{className:"text-white",children:"亮点标签"}),t.jsx(ot,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),t.jsxs(Ee,{className:"space-y-3",children:[r.highlights.map((b,C)=>t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:b,onChange:N=>j(C,N.target.value),placeholder:"5年私域运营经验"}),t.jsx(oe,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>w(C),children:t.jsx(on,{className:"w-4 h-4"})})]},C)),t.jsxs(oe,{variant:"outline",size:"sm",onClick:k,className:"border-gray-600 text-gray-400",children:[t.jsx(Rn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}const qC={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},XC={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},JC={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...XC}},ZC={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0};function e4(){const[r,a]=h.useState(JC),[l,o]=h.useState(ZC),[c,u]=h.useState(qC),[f,p]=h.useState(!1),[x,g]=h.useState(!0),[v,y]=h.useState(!1),[E,_]=h.useState(""),[k,w]=h.useState(""),[j,b]=h.useState(!1),[C,N]=h.useState(!1),A=(T,F,Y=!1)=>{_(T),w(F),b(Y),y(!0)};h.useEffect(()=>{(async()=>{try{const F=await We("/api/admin/settings");if(!F||F.success===!1)return;if(F.featureConfig&&Object.keys(F.featureConfig).length&&o(Y=>({...Y,...F.featureConfig})),F.mpConfig&&typeof F.mpConfig=="object"&&u(Y=>({...Y,...F.mpConfig})),F.siteSettings&&typeof F.siteSettings=="object"){const Y=F.siteSettings;a(K=>({...K,...typeof Y.sectionPrice=="number"&&{sectionPrice:Y.sectionPrice},...typeof Y.baseBookPrice=="number"&&{baseBookPrice:Y.baseBookPrice},...typeof Y.distributorShare=="number"&&{distributorShare:Y.distributorShare},...Y.authorInfo&&typeof Y.authorInfo=="object"&&{authorInfo:{...K.authorInfo,...Y.authorInfo}}}))}}catch(F){console.error("Load settings error:",F)}finally{g(!1)}})()},[]);const $=async(T,F)=>{N(!0);try{const Y=await jt("/api/admin/settings",{featureConfig:T});if(!Y||Y.success===!1){F(),A("保存失败",(Y==null?void 0:Y.error)??"未知错误",!0);return}A("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(Y){console.error("Save feature config error:",Y),F(),A("保存失败",Y instanceof Error?Y.message:String(Y),!0)}finally{N(!1)}},V=(T,F)=>{const Y=l,K={...Y,[T]:F};o(K),$(K,()=>o(Y))},R=async()=>{p(!0);try{const T=await jt("/api/admin/settings",{featureConfig:l,siteSettings:{sectionPrice:r.sectionPrice,baseBookPrice:r.baseBookPrice,distributorShare:r.distributorShare,authorInfo:r.authorInfo},mpConfig:{...c,appId:c.appId||"",withdrawSubscribeTmplId:c.withdrawSubscribeTmplId||"",mchId:c.mchId||"",minWithdraw:typeof c.minWithdraw=="number"?c.minWithdraw:10}});if(!T||T.success===!1){A("保存失败",(T==null?void 0:T.error)??"未知错误",!0);return}A("已保存","设置已保存成功。")}catch(T){console.error("Save settings error:",T),A("保存失败",T instanceof Error?T.message:String(T),!0)}finally{p(!1)}};return x?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(oe,{onClick:R,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(jm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),t.jsx(ot,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),t.jsxs(Ee,{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(Z,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(jm,{className:"w-3 h-3"}),"主理人名称"]}),t.jsx(ne,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:r.authorInfo.name??"",onChange:T=>a(F=>({...F,authorInfo:{...F.authorInfo,name:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(za,{className:"w-3 h-3"}),"开播日期"]}),t.jsx(ne,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:r.authorInfo.startDate??"",onChange:T=>a(F=>({...F,authorInfo:{...F.authorInfo,startDate:T.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(za,{className:"w-3 h-3"}),"直播时间"]}),t.jsx(ne,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:r.authorInfo.liveTime??"",onChange:T=>a(F=>({...F,authorInfo:{...F.authorInfo,liveTime:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(vN,{className:"w-3 h-3"}),"直播平台"]}),t.jsx(ne,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:r.authorInfo.platform??"",onChange:T=>a(F=>({...F,authorInfo:{...F.authorInfo,platform:T.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(Wn,{className:"w-3 h-3"}),"简介描述"]}),t.jsx(ne,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:r.authorInfo.description??"",onChange:T=>a(F=>({...F,authorInfo:{...F.authorInfo,description:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),t.jsx(Xr,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:r.authorInfo.bio??"",onChange:T=>a(F=>({...F,authorInfo:{...F.authorInfo,bio:T.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(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),t.jsx(Ee,{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(Z,{className:"text-gray-300",children:"单节价格 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:r.sectionPrice,onChange:T=>a(F=>({...F,sectionPrice:Number.parseFloat(T.target.value)||1}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"整本价格 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:r.baseBookPrice,onChange:T=>a(F=>({...F,baseBookPrice:Number.parseFloat(T.target.value)||9.9}))})]})]})})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(xd,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),t.jsx(ot,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),t.jsx(Ee,{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(Z,{className:"text-gray-300",children:"小程序 AppID"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:c.appId??"",onChange:T=>u(F=>({...F,appId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"提现订阅模板 ID"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:c.withdrawSubscribeTmplId??"",onChange:T=>u(F=>({...F,withdrawSubscribeTmplId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"微信支付商户号"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:c.mchId??"",onChange:T=>u(F=>({...F,mchId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"最低提现金额 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.minWithdraw??10,onChange:T=>u(F=>({...F,minWithdraw:Number.parseFloat(T.target.value)||10}))})]})]})})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(Ni,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),t.jsx(ot,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),t.jsxs(Ee,{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(vn,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(Z,{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(ht,{id:"match-enabled",checked:l.matchEnabled,disabled:C,onCheckedChange:T=>V("matchEnabled",T)})]}),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(qj,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(Z,{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(ht,{id:"referral-enabled",checked:l.referralEnabled,disabled:C,onCheckedChange:T=>V("referralEnabled",T)})]}),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(Wn,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(Z,{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(ht,{id:"search-enabled",checked:l.searchEnabled,disabled:C,onCheckedChange:T=>V("searchEnabled",T)})]}),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(Ni,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(Z,{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(ht,{id:"about-enabled",checked:l.aboutEnabled,disabled:C,onCheckedChange:T=>V("aboutEnabled",T)})]})]}),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(Bt,{open:v,onOpenChange:y,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[t.jsxs(Ut,{children:[t.jsx(Vt,{className:j?"text-red-400":"text-[#38bdac]",children:E}),t.jsx(U1,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:k})]}),t.jsx(qt,{className:"mt-4",children:t.jsx(oe,{onClick:()=>y(!1),className:j?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const lp={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 t4(){const[r,a]=h.useState(!1),[l,o]=h.useState(lp),[c,u]=h.useState(""),f=async()=>{a(!0);try{const b=await We("/api/config");b!=null&&b.paymentMethods&&o({...lp,...b.paymentMethods})}catch(b){console.error(b)}finally{a(!1)}};h.useEffect(()=>{f()},[]);const p=async()=>{a(!0);try{await jt("/api/db/config",{key:"payment_methods",value:l,description:"支付方式配置"}),alert("配置已保存!")}catch(b){console.error("保存失败:",b),alert("保存失败: "+(b instanceof Error?b.message:String(b)))}finally{a(!1)}},x=(b,C)=>{navigator.clipboard.writeText(b),u(C),setTimeout(()=>u(""),2e3)},g=(b,C)=>{o(N=>({...N,wechat:{...N.wechat,[b]:C}}))},v=(b,C)=>{o(N=>({...N,alipay:{...N.alipay,[b]:C}}))},y=(b,C)=>{o(N=>({...N,usdt:{...N.usdt,[b]:C}}))},E=(b,C)=>{o(N=>({...N,paypal:{...N.paypal,[b]:C}}))},_=l.wechat,k=l.alipay,w=l.usdt,j=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(oe,{variant:"outline",onClick:f,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`}),"同步配置"]}),t.jsxs(oe,{onClick:p,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{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(bp,{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(nu,{defaultValue:"wechat",className:"space-y-6",children:[t.jsxs(Vi,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[t.jsxs(an,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[t.jsx(xd,{className:"w-4 h-4 mr-2"}),"微信"]}),t.jsxs(an,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[t.jsx(hd,{className:"w-4 h-4 mr-2"}),"支付宝"]}),t.jsxs(an,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[t.jsx(vm,{className:"w-4 h-4 mr-2"}),"USDT"]}),t.jsxs(an,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[t.jsx(md,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),t.jsx(ln,{value:"wechat",className:"space-y-4",children:t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Be,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(xd,{className:"w-5 h-5"}),"微信支付配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),t.jsx(ht,{checked:!!_.enabled,onCheckedChange:b=>g("enabled",b)})]}),t.jsxs(Ee,{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(Z,{className:"text-gray-300",children:"网站AppID"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(_.websiteAppId??""),onChange:b=>g("websiteAppId",b.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"商户号"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(_.merchantId??""),onChange:b=>g("merchantId",b.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(ji,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"微信收款码/支付链接"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(_.qrCode??""),onChange:b=>g("qrCode",b.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(Z,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),t.jsx(ne,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(_.groupQrCode??""),onChange:b=>g("groupQrCode",b.target.value)}),t.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),t.jsx(ln,{value:"alipay",className:"space-y-4",children:t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Be,{className:"text-[#1677FF] flex items-center gap-2",children:[t.jsx(hd,{className:"w-5 h-5"}),"支付宝配置"]}),t.jsx(ot,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),t.jsx(ht,{checked:!!k.enabled,onCheckedChange:b=>v("enabled",b)})]}),t.jsxs(Ee,{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(Z,{className:"text-gray-300",children:"合作者身份 (PID)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(k.partnerId??""),onChange:b=>v("partnerId",b.target.value)}),t.jsx(oe,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>x(String(k.partnerId??""),"pid"),children:c==="pid"?t.jsx(Mi,{className:"w-4 h-4 text-green-500"}):t.jsx(Sp,{className:"w-4 h-4 text-gray-400"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"安全校验码 (Key)"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(k.securityKey??""),onChange:b=>v("securityKey",b.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(ji,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(k.qrCode??""),onChange:b=>v("qrCode",b.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),t.jsx(ln,{value:"usdt",className:"space-y-4",children:t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Be,{className:"text-[#26A17B] flex items-center gap-2",children:[t.jsx(vm,{className:"w-5 h-5"}),"USDT配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),t.jsx(ht,{checked:!!w.enabled,onCheckedChange:b=>y("enabled",b)})]}),t.jsxs(Ee,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{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(w.network??"TRC20"),onChange:b=>y("network",b.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(Z,{className:"text-gray-300",children:"收款地址"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(w.address??""),onChange:b=>y("address",b.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:b=>y("exchangeRate",Number.parseFloat(b.target.value)||7.2)})]})]})]})}),t.jsx(ln,{value:"paypal",className:"space-y-4",children:t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Be,{className:"text-[#169BD7] flex items-center gap-2",children:[t.jsx(md,{className:"w-5 h-5"}),"PayPal配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),t.jsx(ht,{checked:!!j.enabled,onCheckedChange:b=>E("enabled",b)})]}),t.jsxs(Ee,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"PayPal邮箱"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(j.email??""),onChange:b=>E("email",b.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:b=>E("exchangeRate",Number(b.target.value)||7.2)})]})]})]})})]})]})}const n4={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},r4={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},s4={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function a4(){const[r,a]=h.useState({siteConfig:{...n4},menuConfig:{...r4},pageConfig:{...s4}}),[l,o]=h.useState(!1),[c,u]=h.useState(!1);h.useEffect(()=>{We("/api/config").then(v=>{v!=null&&v.siteConfig&&a(y=>({...y,siteConfig:{...y.siteConfig,...v.siteConfig}})),v!=null&&v.menuConfig&&a(y=>({...y,menuConfig:{...y.menuConfig,...v.menuConfig}})),v!=null&&v.pageConfig&&a(y=>({...y,pageConfig:{...y.pageConfig,...v.pageConfig}}))}).catch(console.error)},[]);const f=async()=>{u(!0);try{await jt("/api/db/config",{key:"site_config",value:r.siteConfig,description:"网站基础配置"}),await jt("/api/db/config",{key:"menu_config",value:r.menuConfig,description:"底部菜单配置"}),await jt("/api/db/config",{key:"page_config",value:r.pageConfig,description:"页面标题配置"}),o(!0),setTimeout(()=>o(!1),2e3),alert("配置已保存")}catch(v){console.error(v),alert("保存失败: "+(v instanceof Error?v.message:String(v)))}finally{u(!1)}},p=r.siteConfig,x=r.menuConfig,g=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(oe,{onClick:f,disabled:c,className:`${l?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),c?"保存中...":l?"已保存":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(md,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),t.jsx(ot,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),t.jsxs(Ee,{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(Z,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),t.jsx(ne,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteName??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteName:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),t.jsx(ne,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteTitle??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteTitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),t.jsx(ne,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteDescription??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteDescription:v.target.value}}))})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),t.jsx(ne,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:p.logo??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,logo:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),t.jsx(ne,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:p.favicon??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,favicon:v.target.value}}))})]})]})]})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(SN,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),t.jsx(ot,{className:"text-gray-400",children:"配置网站主题色"})]}),t.jsx(Ee,{children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"space-y-2 flex-1",children:[t.jsx(Z,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ne,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:p.primaryColor??"#00CED1",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,primaryColor:v.target.value}}))}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:p.primaryColor??"#00CED1",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,primaryColor:v.target.value}}))})]})]}),t.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:p.primaryColor??"#00CED1"},children:"预览"})]})})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(jN,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),t.jsx(ot,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),t.jsx(Ee,{className:"space-y-4",children:Object.entries(x).map(([v,y])=>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(ht,{checked:(y==null?void 0:y.enabled)??!0,onCheckedChange:E=>a(_=>({..._,menuConfig:{..._.menuConfig,[v]:{...y,enabled:E}}}))}),t.jsx("span",{className:"text-gray-300 w-16 capitalize",children:v}),t.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(y==null?void 0:y.label)??"",onChange:E=>a(_=>({..._,menuConfig:{..._.menuConfig,[v]:{...y,label:E.target.value}}}))})]}),t.jsx("span",{className:`text-sm ${y!=null&&y.enabled?"text-green-400":"text-gray-500"}`,children:y!=null&&y.enabled?"显示":"隐藏"})]},v))})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(Kj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),t.jsxs(Ee,{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(Z,{className:"text-gray-300",children:"首页标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.homeTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,homeTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"首页副标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.homeSubtitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,homeSubtitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"目录页标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.chaptersTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,chaptersTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"匹配页标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.matchTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,matchTitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"我的页标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.myTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,myTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"关于作者标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.aboutTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,aboutTitle:v.target.value}}))})]})]})]})]})]})]})}function l4(){const[r,a]=h.useState(""),[l,o]=h.useState(""),[c,u]=h.useState(""),[f,p]=h.useState({}),x=async()=>{var _,k,w,j;try{const b=await We("/api/config"),C=(k=(_=b==null?void 0:b.liveQRCodes)==null?void 0:_[0])==null?void 0:k.urls;Array.isArray(C)&&a(C.join(` -`));const N=(j=(w=b==null?void 0:b.paymentMethods)==null?void 0:w.wechat)==null?void 0:j.groupQrCode;N&&o(N),p({paymentMethods:b==null?void 0:b.paymentMethods,liveQRCodes:b==null?void 0:b.liveQRCodes})}catch(b){console.error(b)}};h.useEffect(()=>{x()},[]);const g=(_,k)=>{navigator.clipboard.writeText(_),u(k),setTimeout(()=>u(""),2e3)},v=async()=>{try{const _=r.split(` -`).map(w=>w.trim()).filter(Boolean),k=[...f.liveQRCodes||[]];k[0]?k[0].urls=_:k.push({id:"live-1",name:"微信群活码",urls:_,clickCount:0}),await jt("/api/db/config",{key:"live_qr_codes",value:k,description:"群活码配置"}),alert("群活码配置已保存!"),await x()}catch(_){console.error(_),alert("保存失败: "+(_ instanceof Error?_.message:String(_)))}},y=async()=>{var _;try{await jt("/api/db/config",{key:"payment_methods",value:{...f.paymentMethods||{},wechat:{...((_=f.paymentMethods)==null?void 0:_.wechat)||{},groupQrCode:l}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await x()}catch(k){console.error(k),alert("保存失败: "+(k instanceof Error?k.message:String(k)))}},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(bp,{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(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(Sm,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),t.jsx(ot,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),t.jsxs(Ee,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(wm,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{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:_=>o(_.target.value)}),t.jsx(oe,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>g(l,"group"),children:c==="group"?t.jsx(Mi,{className:"w-4 h-4 text-green-500"}):t.jsx(Sp,{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(ji,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(oe,{onClick:y,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),"保存配置"]}),t.jsxs(oe,{onClick:E,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[t.jsx(ji,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(Sm,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),t.jsx(ot,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),t.jsxs(Ee,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(wm,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),t.jsx(Xr,{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:_=>a(_.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(oe,{onClick:v,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(bi,{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 ip={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}},i4=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function o4(){const[r,a]=h.useState(ip),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(!1),[x,g]=h.useState(null),[v,y]=h.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),E=async()=>{o(!0);try{const N=await We("/api/db/config/full?key=match_config"),A=(N==null?void 0:N.data)??(N==null?void 0:N.config);A&&a({...ip,...A})}catch(N){console.error("加载匹配配置失败:",N)}finally{o(!1)}};h.useEffect(()=>{E()},[]);const _=async()=>{u(!0);try{const N=await jt("/api/db/config",{key:"match_config",value:r,description:"匹配功能配置"});N&&N.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(N&&typeof N=="object"&&"error"in N?N.error:"未知错误"))}catch(N){console.error("保存配置失败:",N),alert("保存失败")}finally{u(!1)}},k=N=>{g(N),y({id:N.id,label:N.label,matchLabel:N.matchLabel,icon:N.icon,matchFromDB:N.matchFromDB,showJoinAfterMatch:N.showJoinAfterMatch,price:N.price,enabled:N.enabled}),p(!0)},w=()=>{g(null),y({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),p(!0)},j=()=>{if(!v.id||!v.label){alert("请填写类型ID和名称");return}const N=[...r.matchTypes];if(x){const A=N.findIndex($=>$.id===x.id);A!==-1&&(N[A]={...v})}else{if(N.some(A=>A.id===v.id)){alert("类型ID已存在");return}N.push({...v})}a({...r,matchTypes:N}),p(!1)},b=N=>{confirm("确定要删除这个匹配类型吗?")&&a({...r,matchTypes:r.matchTypes.filter(A=>A.id!==N)})},C=N=>{a({...r,matchTypes:r.matchTypes.map(A=>A.id===N?{...A,enabled:!A.enabled}:A)})};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(Ni,{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(oe,{variant:"outline",onClick:E,disabled:l,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]}),t.jsxs(oe,{onClick:_,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs($e,{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(ZN,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),t.jsxs(Ee,{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(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),t.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.freeMatchLimit,onChange:N=>a({...r,freeMatchLimit:parseInt(N.target.value,10)||0})}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),t.jsx(ne,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:r.matchPrice,onChange:N=>a({...r,matchPrice:parseFloat(N.target.value)||1})}),t.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),t.jsx(ne,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.settings.maxMatchesPerDay,onChange:N=>a({...r,settings:{...r.settings,maxMatchesPerDay:parseInt(N.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(ht,{checked:r.settings.enableFreeMatches,onCheckedChange:N=>a({...r,settings:{...r.settings,enableFreeMatches:N}})}),t.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:r.settings.enablePaidMatches,onCheckedChange:N=>a({...r,settings:{...r.settings,enablePaidMatches:N}})}),t.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),t.jsxs(ke,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs($e,{className:"flex flex-row items-center justify-between",children:[t.jsxs("div",{children:[t.jsxs(Be,{className:"text-white flex items-center gap-2",children:[t.jsx(vn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),t.jsx(ot,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),t.jsxs(oe,{onClick:w,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Rn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),t.jsx(Ee,{children:t.jsxs(Yn,{children:[t.jsx(Qn,{children:t.jsxs(rt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(Pe,{className:"text-gray-400",children:"图标"}),t.jsx(Pe,{className:"text-gray-400",children:"类型ID"}),t.jsx(Pe,{className:"text-gray-400",children:"显示名称"}),t.jsx(Pe,{className:"text-gray-400",children:"匹配标签"}),t.jsx(Pe,{className:"text-gray-400",children:"价格"}),t.jsx(Pe,{className:"text-gray-400",children:"数据库匹配"}),t.jsx(Pe,{className:"text-gray-400",children:"状态"}),t.jsx(Pe,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsx(qn,{children:r.matchTypes.map(N=>t.jsxs(rt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(we,{children:t.jsx("span",{className:"text-2xl",children:N.icon})}),t.jsx(we,{className:"font-mono text-gray-300",children:N.id}),t.jsx(we,{className:"text-white font-medium",children:N.label}),t.jsx(we,{className:"text-gray-300",children:N.matchLabel}),t.jsx(we,{children:t.jsxs(Me,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",N.price]})}),t.jsx(we,{children:N.matchFromDB?t.jsx(Me,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):t.jsx(Me,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),t.jsx(we,{children:t.jsx(ht,{checked:N.enabled,onCheckedChange:()=>C(N.id)})}),t.jsx(we,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>k(N),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:t.jsx(sn,{className:"w-4 h-4"})}),t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>b(N.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:t.jsx(Vn,{className:"w-4 h-4"})})]})})]},N.id))})]})})]}),t.jsx(Bt,{open:f,onOpenChange:p,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[t.jsx(Ut,{children:t.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[x?t.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(Rn,{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(Z,{className:"text-gray-300",children:"类型ID(英文)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:v.id,onChange:N=>y({...v,id:N.target.value}),disabled:!!x})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"图标"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:i4.map(N=>t.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${v.icon===N?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>y({...v,icon:N}),children:N},N))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"显示名称"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:v.label,onChange:N=>y({...v,label:N.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"匹配标签"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:v.matchLabel,onChange:N=>y({...v,matchLabel:N.target.value})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),t.jsx(ne,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:v.price,onChange:N=>y({...v,price:parseFloat(N.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(ht,{checked:v.matchFromDB,onCheckedChange:N=>y({...v,matchFromDB:N})}),t.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:v.showJoinAfterMatch,onCheckedChange:N=>y({...v,showJoinAfterMatch:N})}),t.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:v.enabled,onCheckedChange:N=>y({...v,enabled:N})}),t.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),t.jsxs(qt,{children:[t.jsx(oe,{variant:"outline",onClick:()=>p(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsxs(oe,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const op={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function c4(){const[r,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f,p]=h.useState(10),[x,g]=h.useState(""),[v,y]=h.useState(!0),[E,_]=h.useState(null);async function k(){y(!0),_(null);try{const j=new URLSearchParams({page:String(c),pageSize:String(f)});x&&j.set("matchType",x);const b=await We(`/api/db/match-records?${j}`);b!=null&&b.success?(a(b.records||[]),o(b.total??0)):_("加载匹配记录失败")}catch(j){console.error("加载匹配记录失败",j),_("加载失败,请检查网络后重试")}finally{y(!1)}}h.useEffect(()=>{k()},[c,x]);const w=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:()=>_(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:j=>{g(j.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(op).map(([j,b])=>t.jsx("option",{value:j,children:b},j))]}),t.jsxs("button",{type:"button",onClick:k,disabled:v,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(Ze,{className:`w-4 h-4 ${v?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Ee,{className:"p-0",children:v?t.jsxs("div",{className:"flex justify-center py-12",children:[t.jsx(Ze,{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(Yn,{children:[t.jsx(Qn,{children:t.jsxs(rt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(Pe,{className:"text-gray-400",children:"发起人"}),t.jsx(Pe,{className:"text-gray-400",children:"匹配到"}),t.jsx(Pe,{className:"text-gray-400",children:"类型"}),t.jsx(Pe,{className:"text-gray-400",children:"联系方式"}),t.jsx(Pe,{className:"text-gray-400",children:"匹配时间"})]})}),t.jsxs(qn,{children:[r.map(j=>t.jsxs(rt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(we,{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:[j.userAvatar?t.jsx("img",{src:j.userAvatar,alt:"",className:"w-full h-full object-cover",onError:b=>{b.currentTarget.style.display="none";const C=b.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,t.jsx("span",{className:j.userAvatar?"hidden":"",children:(j.userNickname||j.userId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:j.userNickname||j.userId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[j.userId.slice(0,16),"..."]})]})]})}),t.jsx(we,{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:[j.matchedUserAvatar?t.jsx("img",{src:j.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:b=>{b.currentTarget.style.display="none";const C=b.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,t.jsx("span",{className:j.matchedUserAvatar?"hidden":"",children:(j.matchedNickname||j.matchedUserId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:j.matchedNickname||j.matchedUserId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[j.matchedUserId.slice(0,16),"..."]})]})]})}),t.jsx(we,{children:t.jsx(Me,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:op[j.matchType]||j.matchType})}),t.jsxs(we,{className:"text-gray-400 text-sm",children:[j.phone&&t.jsxs("div",{children:["📱 ",j.phone]}),j.wechatId&&t.jsxs("div",{children:["💬 ",j.wechatId]}),!j.phone&&!j.wechatId&&"-"]}),t.jsx(we,{className:"text-gray-400",children:j.createdAt?new Date(j.createdAt).toLocaleString():"-"})]},j.id)),r.length===0&&t.jsx(rt,{children:t.jsx(we,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),t.jsx(Sr,{page:c,totalPages:w,total:l,pageSize:f,onPageChange:u,onPageSizeChange:j=>{p(j),u(1)}})]})})})]})}function d4(){const[r,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(null),[x,g]=h.useState(""),[v,y]=h.useState(0),[E,_]=h.useState(!1);async function k(){o(!0);try{const N=await We("/api/db/vip-roles");N!=null&&N.success&&N.data&&a(N.data)}catch(N){console.error("Load roles error:",N)}finally{o(!1)}}h.useEffect(()=>{k()},[]);const w=()=>{p(null),g(""),y(r.length>0?Math.max(...r.map(N=>N.sort))+1:0),u(!0)},j=N=>{p(N),g(N.name),y(N.sort),u(!0)},b=async()=>{if(!x.trim()){alert("角色名称不能为空");return}_(!0);try{if(f){const N=await Pt("/api/db/vip-roles",{id:f.id,name:x.trim(),sort:v});N!=null&&N.success?(u(!1),k()):alert("更新失败: "+(N==null?void 0:N.error))}else{const N=await jt("/api/db/vip-roles",{name:x.trim(),sort:v});N!=null&&N.success?(u(!1),k()):alert("新增失败: "+(N==null?void 0:N.error))}}catch(N){console.error("Save error:",N),alert("保存失败")}finally{_(!1)}},C=async N=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const A=await Wa(`/api/db/vip-roles?id=${N}`);A!=null&&A.success?k():alert("删除失败: "+(A==null?void 0:A.error))}catch(A){console.error("Delete error:",A),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(Li,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),t.jsxs(oe,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Rn,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Ee,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Yn,{children:[t.jsx(Qn,{children:t.jsxs(rt,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(Pe,{className:"text-gray-400",children:"ID"}),t.jsx(Pe,{className:"text-gray-400",children:"角色名称"}),t.jsx(Pe,{className:"text-gray-400",children:"排序"}),t.jsx(Pe,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(qn,{children:[r.map(N=>t.jsxs(rt,{className:"border-gray-700/50",children:[t.jsx(we,{className:"text-gray-300",children:N.id}),t.jsx(we,{className:"text-white",children:N.name}),t.jsx(we,{className:"text-gray-400",children:N.sort}),t.jsxs(we,{className:"text-right",children:[t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>j(N),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(sn,{className:"w-4 h-4"})}),t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>C(N.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Vn,{className:"w-4 h-4"})})]})]},N.id)),r.length===0&&t.jsx(rt,{children:t.jsx(we,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),t.jsx(Bt,{open:c,onOpenChange:u,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(Ut,{children:t.jsx(Vt,{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(Z,{className:"text-gray-300",children:"角色名称"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:x,onChange:N=>g(N.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:v,onChange:N=>y(parseInt(N.target.value,10)||0)})]})]}),t.jsxs(qt,{children:[t.jsxs(oe,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(on,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(oe,{onClick:b,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),E?"保存中...":"保存"]})]})]})})]})}function u4(){const[r,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(null),[x,g]=h.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[v,y]=h.useState(!1),[E,_]=h.useState(!1),k=h.useRef(null),w=async R=>{var F;const T=(F=R.target.files)==null?void 0:F[0];if(T){_(!0);try{const Y=new FormData;Y.append("file",T),Y.append("folder","mentors");const K=Bd(),J={};K&&(J.Authorization=`Bearer ${K}`);const X=await(await fetch(Fs("/api/upload"),{method:"POST",body:Y,credentials:"include",headers:J})).json();X!=null&&X.success&&(X!=null&&X.url)?g(le=>({...le,avatar:X.url})):alert("上传失败: "+((X==null?void 0:X.error)||"未知错误"))}catch(Y){console.error(Y),alert("上传失败")}finally{_(!1),k.current&&(k.current.value="")}}};async function j(){o(!0);try{const R=await We("/api/db/mentors");R!=null&&R.success&&R.data&&a(R.data)}catch(R){console.error("Load mentors error:",R)}finally{o(!1)}}h.useEffect(()=>{j()},[]);const b=()=>{g({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:r.length>0?Math.max(...r.map(R=>R.sort))+1:0,enabled:!0})},C=()=>{p(null),b(),u(!0)},N=R=>{p(R),g({name:R.name,avatar:R.avatar||"",intro:R.intro||"",tags:R.tags||"",priceSingle:R.priceSingle!=null?String(R.priceSingle):"",priceHalfYear:R.priceHalfYear!=null?String(R.priceHalfYear):"",priceYear:R.priceYear!=null?String(R.priceYear):"",quote:R.quote||"",whyFind:R.whyFind||"",offering:R.offering||"",judgmentStyle:R.judgmentStyle||"",sort:R.sort,enabled:R.enabled??!0}),u(!0)},A=async()=>{if(!x.name.trim()){alert("导师姓名不能为空");return}y(!0);try{const R=F=>F===""?void 0:parseFloat(F),T={name:x.name.trim(),avatar:x.avatar.trim()||void 0,intro:x.intro.trim()||void 0,tags:x.tags.trim()||void 0,priceSingle:R(x.priceSingle),priceHalfYear:R(x.priceHalfYear),priceYear:R(x.priceYear),quote:x.quote.trim()||void 0,whyFind:x.whyFind.trim()||void 0,offering:x.offering.trim()||void 0,judgmentStyle:x.judgmentStyle.trim()||void 0,sort:x.sort,enabled:x.enabled};if(f){const F=await Pt("/api/db/mentors",{id:f.id,...T});F!=null&&F.success?(u(!1),j()):alert("更新失败: "+(F==null?void 0:F.error))}else{const F=await jt("/api/db/mentors",T);F!=null&&F.success?(u(!1),j()):alert("新增失败: "+(F==null?void 0:F.error))}}catch(R){console.error("Save error:",R),alert("保存失败")}finally{y(!1)}},$=async R=>{if(confirm("确定删除该导师?"))try{const T=await Wa(`/api/db/mentors?id=${R}`);T!=null&&T.success?j():alert("删除失败: "+(T==null?void 0:T.error))}catch(T){console.error("Delete error:",T),alert("删除失败")}},V=R=>R!=null?`¥${R}`:"-";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(vn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),t.jsxs(oe,{onClick:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Rn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Ee,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Yn,{children:[t.jsx(Qn,{children:t.jsxs(rt,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(Pe,{className:"text-gray-400",children:"ID"}),t.jsx(Pe,{className:"text-gray-400",children:"姓名"}),t.jsx(Pe,{className:"text-gray-400",children:"简介"}),t.jsx(Pe,{className:"text-gray-400",children:"单次"}),t.jsx(Pe,{className:"text-gray-400",children:"半年"}),t.jsx(Pe,{className:"text-gray-400",children:"年度"}),t.jsx(Pe,{className:"text-gray-400",children:"排序"}),t.jsx(Pe,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(qn,{children:[r.map(R=>t.jsxs(rt,{className:"border-gray-700/50",children:[t.jsx(we,{className:"text-gray-300",children:R.id}),t.jsx(we,{className:"text-white",children:R.name}),t.jsx(we,{className:"text-gray-400 max-w-[200px] truncate",children:R.intro||"-"}),t.jsx(we,{className:"text-gray-400",children:V(R.priceSingle)}),t.jsx(we,{className:"text-gray-400",children:V(R.priceHalfYear)}),t.jsx(we,{className:"text-gray-400",children:V(R.priceYear)}),t.jsx(we,{className:"text-gray-400",children:R.sort}),t.jsxs(we,{className:"text-right",children:[t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>N(R),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(sn,{className:"w-4 h-4"})}),t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>$(R.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Vn,{className:"w-4 h-4"})})]})]},R.id)),r.length===0&&t.jsx(rt,{children:t.jsx(we,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),t.jsx(Bt,{open:c,onOpenChange:u,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsx(Ut,{children:t.jsx(Vt,{className:"text-white",children:f?"编辑导师":"新增导师"})}),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(Z,{className:"text-gray-300",children:"姓名 *"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:x.name,onChange:R=>g(T=>({...T,name:R.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"排序"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:x.sort,onChange:R=>g(T=>({...T,sort:parseInt(R.target.value,10)||0}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"头像"}),t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:x.avatar,onChange:R=>g(T=>({...T,avatar:R.target.value})),placeholder:"点击上传或粘贴图片地址"}),t.jsx("input",{ref:k,type:"file",accept:"image/*",className:"hidden",onChange:w}),t.jsxs(oe,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:E,onClick:()=>{var R;return(R=k.current)==null?void 0:R.click()},children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),E?"上传中...":"上传"]})]}),x.avatar&&t.jsx("div",{className:"mt-2",children:t.jsx("img",{src:x.avatar.startsWith("http")?x.avatar:Fs(x.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"简介"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:x.intro,onChange:R=>g(T=>({...T,intro:R.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:x.tags,onChange:R=>g(T=>({...T,tags:R.target.value}))})]}),t.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[t.jsx(Z,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),t.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:x.priceSingle,onChange:R=>g(T=>({...T,priceSingle:R.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),t.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:x.priceHalfYear,onChange:R=>g(T=>({...T,priceHalfYear:R.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),t.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:x.priceYear,onChange:R=>g(T=>({...T,priceYear:R.target.value}))})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"引言"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:x.quote,onChange:R=>g(T=>({...T,quote:R.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"为什么找(文本)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:x.whyFind,onChange:R=>g(T=>({...T,whyFind:R.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"提供什么(文本)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:x.offering,onChange:R=>g(T=>({...T,offering:R.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:x.judgmentStyle,onChange:R=>g(T=>({...T,judgmentStyle:R.target.value}))})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:"enabled",checked:x.enabled,onChange:R=>g(T=>({...T,enabled:R.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),t.jsx(Z,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),t.jsxs(qt,{children:[t.jsxs(oe,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(on,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(oe,{onClick:A,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存"]})]})]})})]})}function f4(){const[r,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState("");async function f(){o(!0);try{const g=c?`/api/db/mentor-consultations?status=${c}`:"/api/db/mentor-consultations",v=await We(g);v!=null&&v.success&&v.data&&a(v.data)}catch(g){console.error("Load consultations error:",g)}finally{o(!1)}}h.useEffect(()=>{f()},[c]);const p={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},x={single:"单次",half_year:"半年",year:"年度"};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(za,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("select",{value:c,onChange:g=>u(g.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[t.jsx("option",{value:"",children:"全部状态"}),Object.entries(p).map(([g,v])=>t.jsx("option",{value:g,children:v},g))]}),t.jsxs(oe,{onClick:f,disabled:l,variant:"outline",className:"border-gray-600 text-gray-300",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Ee,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Yn,{children:[t.jsx(Qn,{children:t.jsxs(rt,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(Pe,{className:"text-gray-400",children:"ID"}),t.jsx(Pe,{className:"text-gray-400",children:"用户ID"}),t.jsx(Pe,{className:"text-gray-400",children:"导师ID"}),t.jsx(Pe,{className:"text-gray-400",children:"类型"}),t.jsx(Pe,{className:"text-gray-400",children:"金额"}),t.jsx(Pe,{className:"text-gray-400",children:"状态"}),t.jsx(Pe,{className:"text-gray-400",children:"创建时间"})]})}),t.jsxs(qn,{children:[r.map(g=>t.jsxs(rt,{className:"border-gray-700/50",children:[t.jsx(we,{className:"text-gray-300",children:g.id}),t.jsx(we,{className:"text-gray-400",children:g.userId}),t.jsx(we,{className:"text-gray-400",children:g.mentorId}),t.jsx(we,{className:"text-gray-400",children:x[g.consultationType]||g.consultationType}),t.jsxs(we,{className:"text-white",children:["¥",g.amount]}),t.jsx(we,{className:"text-gray-400",children:p[g.status]||g.status}),t.jsx(we,{className:"text-gray-500 text-sm",children:g.createdAt})]},g.id)),r.length===0&&t.jsx(rt,{children:t.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function h4(){const[r,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f]=h.useState(10),[p,x]=h.useState(0),[g,v]=h.useState(""),y=Xd(g,300),[E,_]=h.useState(!0),[k,w]=h.useState(null),[j,b]=h.useState(!1),[C,N]=h.useState(null),[A,$]=h.useState(""),[V,R]=h.useState(""),[T,F]=h.useState(""),[Y,K]=h.useState("admin"),[J,ce]=h.useState("active"),[X,le]=h.useState(!1);async function ee(){var P;_(!0),w(null);try{const W=new URLSearchParams({page:String(c),pageSize:String(f)});y.trim()&&W.set("search",y.trim());const re=await We(`/api/admin/users?${W}`);re!=null&&re.success?(a(re.records||[]),o(re.total??0),x(re.totalPages??0)):w(re.error||"加载失败")}catch(W){const re=W;w(re.status===403?"无权限访问":((P=re==null?void 0:re.data)==null?void 0:P.error)||"加载失败"),a([])}finally{_(!1)}}h.useEffect(()=>{ee()},[c,f,y]);const q=()=>{N(null),$(""),R(""),F(""),K("admin"),ce("active"),b(!0)},I=P=>{N(P),$(P.username),R(""),F(P.name||""),K(P.role==="super_admin"?"super_admin":"admin"),ce(P.status==="disabled"?"disabled":"active"),b(!0)},Q=async()=>{var P;if(!A.trim()){w("用户名不能为空");return}if(!C&&!V){w("新建时密码必填,至少 6 位");return}if(V&&V.length<6){w("密码至少 6 位");return}w(null),le(!0);try{if(C){const W=await Pt("/api/admin/users",{id:C.id,password:V||void 0,name:T.trim(),role:Y,status:J});W!=null&&W.success?(b(!1),ee()):w((W==null?void 0:W.error)||"保存失败")}else{const W=await jt("/api/admin/users",{username:A.trim(),password:V,name:T.trim(),role:Y});W!=null&&W.success?(b(!1),ee()):w((W==null?void 0:W.error)||"保存失败")}}catch(W){const re=W;w(((P=re==null?void 0:re.data)==null?void 0:P.error)||"保存失败")}finally{le(!1)}},B=async P=>{var W;if(confirm("确定删除该管理员?"))try{const re=await Wa(`/api/admin/users?id=${P}`);re!=null&&re.success?ee():w((re==null?void 0:re.error)||"删除失败")}catch(re){const he=re;w(((W=he==null?void 0:he.data)==null?void 0:W.error)||"删除失败")}},D=P=>{if(!P)return"-";try{const W=new Date(P);return isNaN(W.getTime())?P:W.toLocaleString("zh-CN")}catch{return P}};return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-6",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(zd,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ne,{placeholder:"搜索用户名/昵称",value:g,onChange:P=>v(P.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),t.jsx(oe,{variant:"outline",size:"sm",onClick:ee,disabled:E,className:"border-gray-600 text-gray-300",children:t.jsx(Ze,{className:`w-4 h-4 ${E?"animate-spin":""}`})}),t.jsxs(oe,{onClick:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Rn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),k&&t.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[t.jsx("span",{children:k}),t.jsx("button",{type:"button",onClick:()=>w(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),t.jsx(ke,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Ee,{className:"p-0",children:E?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(t.Fragment,{children:[t.jsxs(Yn,{children:[t.jsx(Qn,{children:t.jsxs(rt,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(Pe,{className:"text-gray-400",children:"ID"}),t.jsx(Pe,{className:"text-gray-400",children:"用户名"}),t.jsx(Pe,{className:"text-gray-400",children:"昵称"}),t.jsx(Pe,{className:"text-gray-400",children:"角色"}),t.jsx(Pe,{className:"text-gray-400",children:"状态"}),t.jsx(Pe,{className:"text-gray-400",children:"创建时间"}),t.jsx(Pe,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(qn,{children:[r.map(P=>t.jsxs(rt,{className:"border-gray-700/50",children:[t.jsx(we,{className:"text-gray-300",children:P.id}),t.jsx(we,{className:"text-white font-medium",children:P.username}),t.jsx(we,{className:"text-gray-400",children:P.name||"-"}),t.jsx(we,{children:t.jsx(Me,{variant:"outline",className:P.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:P.role==="super_admin"?"超级管理员":"管理员"})}),t.jsx(we,{children:t.jsx(Me,{variant:"outline",className:P.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:P.status==="active"?"正常":"已禁用"})}),t.jsx(we,{className:"text-gray-500 text-sm",children:D(P.createdAt)}),t.jsxs(we,{className:"text-right",children:[t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>I(P),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(sn,{className:"w-4 h-4"})}),t.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>B(P.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Vn,{className:"w-4 h-4"})})]})]},P.id)),r.length===0&&!E&&t.jsx(rt,{children:t.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:k==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),p>1&&t.jsx("div",{className:"p-4 border-t border-gray-700/50",children:t.jsx(Sr,{page:c,pageSize:f,total:l,totalPages:p,onPageChange:u})})]})})}),t.jsx(Bt,{open:j,onOpenChange:b,children:t.jsxs(It,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(Ut,{children:t.jsx(Vt,{className:"text-white",children:C?"编辑管理员":"新增管理员"})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"用户名"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:A,onChange:P=>$(P.target.value),disabled:!!C}),C&&t.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:C?"新密码(留空不改)":"密码"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:C?"留空表示不修改":"至少 6 位",value:V,onChange:P=>R(P.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"昵称"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:T,onChange:P=>F(P.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"角色"}),t.jsxs("select",{value:Y,onChange:P=>K(P.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[t.jsx("option",{value:"admin",children:"管理员"}),t.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),C&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(Z,{className:"text-gray-300",children:"状态"}),t.jsxs("select",{value:J,onChange:P=>ce(P.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[t.jsx("option",{value:"active",children:"正常"}),t.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),t.jsxs(qt,{children:[t.jsxs(oe,{variant:"outline",onClick:()=>b(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(on,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(oe,{onClick:Q,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Wt,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})})]})}function m4(){return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t.jsx(Yr,{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(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"1. 接口总览"})}),t.jsxs(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"2. 书籍内容"})}),t.jsxs(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"3. 支付"})}),t.jsxs(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"4. 分销与用户"})}),t.jsxs(Ee,{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(ke,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx($e,{children:t.jsx(Be,{className:"text-white",children:"5. 管理后台"})}),t.jsxs(Ee,{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 p4(){const r=rs();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(_j,{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(oe,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:t.jsxs(fi,{to:"/",children:[t.jsx(aN,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function x4(){return t.jsxs(lj,{children:[t.jsx(nt,{path:"/login",element:t.jsx(nw,{})}),t.jsxs(nt,{path:"/",element:t.jsx(ab,{}),children:[t.jsx(nt,{index:!0,element:t.jsx(rj,{to:"/dashboard",replace:!0})}),t.jsx(nt,{path:"dashboard",element:t.jsx(sw,{})}),t.jsx(nt,{path:"orders",element:t.jsx(V1,{})}),t.jsx(nt,{path:"users",element:t.jsx(x2,{})}),t.jsx(nt,{path:"distribution",element:t.jsx(g2,{})}),t.jsx(nt,{path:"withdrawals",element:t.jsx(v2,{})}),t.jsx(nt,{path:"content",element:t.jsx(kC,{})}),t.jsx(nt,{path:"referral-settings",element:t.jsx(YC,{})}),t.jsx(nt,{path:"author-settings",element:t.jsx(QC,{})}),t.jsx(nt,{path:"vip-roles",element:t.jsx(d4,{})}),t.jsx(nt,{path:"mentors",element:t.jsx(u4,{})}),t.jsx(nt,{path:"mentor-consultations",element:t.jsx(f4,{})}),t.jsx(nt,{path:"admin-users",element:t.jsx(h4,{})}),t.jsx(nt,{path:"settings",element:t.jsx(e4,{})}),t.jsx(nt,{path:"payment",element:t.jsx(t4,{})}),t.jsx(nt,{path:"site",element:t.jsx(a4,{})}),t.jsx(nt,{path:"qrcodes",element:t.jsx(l4,{})}),t.jsx(nt,{path:"match",element:t.jsx(o4,{})}),t.jsx(nt,{path:"match-records",element:t.jsx(c4,{})}),t.jsx(nt,{path:"api-doc",element:t.jsx(m4,{})})]}),t.jsx(nt,{path:"*",element:t.jsx(p4,{})})]})}cy.createRoot(document.getElementById("root")).render(t.jsx(h.StrictMode,{children:t.jsx(hj,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:t.jsx(x4,{})})})); diff --git a/soul-admin/dist/assets/index-iq3PeMuM.js b/soul-admin/dist/assets/index-iq3PeMuM.js new file mode 100644 index 00000000..e7d4099a --- /dev/null +++ b/soul-admin/dist/assets/index-iq3PeMuM.js @@ -0,0 +1,470 @@ +function ty(n,a){for(var l=0;lo[c]})}}}return Object.freeze(Object.defineProperty(n,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"]'))o(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"&&o(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 o(c){if(c.ep)return;c.ep=!0;const u=l(c);fetch(c.href,u)}})();function cp(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Bc={exports:{}},Da={},Uc={exports:{}},$e={};/** + * @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 Zh;function ry(){if(Zh)return $e;Zh=1;var n=Symbol.for("react.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.iterator;function k(I){return I===null||typeof I!="object"?null:(I=y&&I[y]||I["@@iterator"],typeof I=="function"?I:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function w(I,L,X){this.props=I,this.context=L,this.refs=N,this.updater=X||R}w.prototype.isReactComponent={},w.prototype.setState=function(I,L){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,L,"setState")},w.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function S(){}S.prototype=w.prototype;function P(I,L,X){this.props=I,this.context=L,this.refs=N,this.updater=X||R}var j=P.prototype=new S;j.constructor=P,C(j,w.prototype),j.isPureReactComponent=!0;var _=Array.isArray,B=Object.prototype.hasOwnProperty,V={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function T(I,L,X){var ae,ve={},pe=null,le=null;if(L!=null)for(ae in L.ref!==void 0&&(le=L.ref),L.key!==void 0&&(pe=""+L.key),L)B.call(L,ae)&&!E.hasOwnProperty(ae)&&(ve[ae]=L[ae]);var ye=arguments.length-2;if(ye===1)ve.children=X;else if(1>>1,L=M[I];if(0>>1;Ic(ve,H))pec(le,ve)?(M[I]=le,M[pe]=H,I=pe):(M[I]=ve,M[ae]=H,I=ae);else if(pec(le,H))M[I]=le,M[pe]=H,I=pe;else break e}}return Q}function c(M,Q){var H=M.sortIndex-Q.sortIndex;return H!==0?H:M.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var x=[],g=[],v=1,y=null,k=3,R=!1,C=!1,N=!1,w=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(M){for(var Q=l(g);Q!==null;){if(Q.callback===null)o(g);else if(Q.startTime<=M)o(g),Q.sortIndex=Q.expirationTime,a(x,Q);else break;Q=l(g)}}function _(M){if(N=!1,j(M),!C)if(l(x)!==null)C=!0,te(B);else{var Q=l(g);Q!==null&&U(_,Q.startTime-M)}}function B(M,Q){C=!1,N&&(N=!1,S(T),T=-1),R=!0;var H=k;try{for(j(Q),y=l(x);y!==null&&(!(y.expirationTime>Q)||M&&!ue());){var I=y.callback;if(typeof I=="function"){y.callback=null,k=y.priorityLevel;var L=I(y.expirationTime<=Q);Q=n.unstable_now(),typeof L=="function"?y.callback=L:y===l(x)&&o(x),j(Q)}else o(x);y=l(x)}if(y!==null)var X=!0;else{var ae=l(g);ae!==null&&U(_,ae.startTime-Q),X=!1}return X}finally{y=null,k=H,R=!1}}var V=!1,E=null,T=-1,z=5,q=-1;function ue(){return!(n.unstable_now()-qM||125I?(M.sortIndex=H,a(g,M),l(x)===null&&M===l(g)&&(N?(S(T),T=-1):N=!0,U(_,H-I))):(M.sortIndex=L,a(x,M),C||R||(C=!0,te(B))),M},n.unstable_shouldYield=ue,n.unstable_wrapCallback=function(M){var Q=k;return function(){var H=k;k=Q;try{return M.apply(this,arguments)}finally{k=H}}}})(Hc)),Hc}var sm;function ly(){return sm||(sm=1,Wc.exports=ay()),Wc.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 am;function iy(){if(am)return Wt;am=1;var n=Ad(),a=ly();function l(e){for(var r="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,g=/^[: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]*$/,v={},y={};function k(e){return x.call(y,e)?!0:x.call(v,e)?!1:g.test(e)?y[e]=!0:(v[e]=!0,!1)}function R(e,r,s,i){if(s!==null&&s.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return i?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function C(e,r,s,i){if(r===null||typeof r>"u"||R(e,r,s,i))return!0;if(i)return!1;if(s!==null)switch(s.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function N(e,r,s,i,d,m,b){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=i,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=e,this.type=r,this.sanitizeURL=m,this.removeEmptyString=b}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){w[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var r=e[0];w[r]=new N(r,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){w[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){w[e]=new N(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){w[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){w[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){w[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){w[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){w[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function P(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 r=e.replace(S,P);w[r]=new N(r,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var r=e.replace(S,P);w[r]=new N(r,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var r=e.replace(S,P);w[r]=new N(r,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){w[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),w.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){w[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});function j(e,r,s,i){var d=w.hasOwnProperty(r)?w[r]:null;(d!==null?d.type!==0:i||!(2A||d[b]!==m[A]){var O=` +`+d[b].replace(" at new "," at ");return e.displayName&&O.includes("")&&(O=O.replace("",e.displayName)),O}while(1<=b&&0<=A);break}}}finally{X=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?L(e):""}function ve(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=ae(e.type,!1),e;case 11:return e=ae(e.type.render,!1),e;case 1:return e=ae(e.type,!0),e;default:return""}}function pe(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 E:return"Fragment";case V:return"Portal";case z:return"Profiler";case T:return"StrictMode";case ce:return"Suspense";case G:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ue:return(e.displayName||"Context")+".Consumer";case q:return(e._context.displayName||"Context")+".Provider";case ee:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return r=e.displayName||null,r!==null?r:pe(e.type)||"Memo";case te:r=e._payload,e=e._init;try{return pe(e(r))}catch{}}return null}function le(e){var r=e.type;switch(e.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=r.render,e=e.displayName||e.name||"",r.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return pe(r);case 8:return r===T?"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 r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function ye(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function D(e){var r=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function fe(e){var r=D(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,r),i=""+e[r];if(!e.hasOwnProperty(r)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,m=s.set;return Object.defineProperty(e,r,{configurable:!0,get:function(){return d.call(this)},set:function(b){i=""+b,m.call(this,b)}}),Object.defineProperty(e,r,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(b){i=""+b},stopTracking:function(){e._valueTracker=null,delete e[r]}}}}function F(e){e._valueTracker||(e._valueTracker=fe(e))}function re(e){if(!e)return!1;var r=e._valueTracker;if(!r)return!0;var s=r.getValue(),i="";return e&&(i=D(e)?e.checked?"true":"false":e.value),e=i,e!==s?(r.setValue(e),!0):!1}function je(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 xe(e,r){var s=r.checked;return H({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Oe(e,r){var s=r.defaultValue==null?"":r.defaultValue,i=r.checked!=null?r.checked:r.defaultChecked;s=ye(r.value!=null?r.value:s),e._wrapperState={initialChecked:i,initialValue:s,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function Xe(e,r){r=r.checked,r!=null&&j(e,"checked",r,!1)}function Be(e,r){Xe(e,r);var s=ye(r.value),i=r.type;if(s!=null)i==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}r.hasOwnProperty("value")?Ft(e,r.type,s):r.hasOwnProperty("defaultValue")&&Ft(e,r.type,ye(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(e.defaultChecked=!!r.defaultChecked)}function Ct(e,r,s){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var i=r.type;if(!(i!=="submit"&&i!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+e._wrapperState.initialValue,s||r===e.value||(e.value=r),e.defaultValue=r}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Ft(e,r,s){(r!=="number"||je(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var In=Array.isArray;function qr(e,r,s,i){if(e=e.options,r){r={};for(var d=0;d"+r.valueOf().toString()+"",r=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;r.firstChild;)e.appendChild(r.firstChild)}});function or(e,r){if(r){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=r;return}}e.textContent=r}var An={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},a0=["Webkit","ms","Moz","O"];Object.keys(An).forEach(function(e){a0.forEach(function(r){r=r+e.charAt(0).toUpperCase()+e.substring(1),An[r]=An[e]})});function hu(e,r,s){return r==null||typeof r=="boolean"||r===""?"":s||typeof r!="number"||r===0||An.hasOwnProperty(e)&&An[e]?(""+r).trim():r+"px"}function mu(e,r){e=e.style;for(var s in r)if(r.hasOwnProperty(s)){var i=s.indexOf("--")===0,d=hu(s,r[s],i);s==="float"&&(s="cssFloat"),i?e.setProperty(s,d):e[s]=d}}var l0=H({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 Ji(e,r){if(r){if(l0[e]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(l(137,e));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(l(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(l(61))}if(r.style!=null&&typeof r.style!="object")throw Error(l(62))}}function Zi(e,r){if(e.indexOf("-")===-1)return typeof r.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 eo=null;function to(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ro=null,as=null,ls=null;function pu(e){if(e=ja(e)){if(typeof ro!="function")throw Error(l(280));var r=e.stateNode;r&&(r=xl(r),ro(e.stateNode,e.type,r))}}function xu(e){as?ls?ls.push(e):ls=[e]:as=e}function gu(){if(as){var e=as,r=ls;if(ls=as=null,pu(e),r)for(e=0;e>>=0,e===0?32:31-(g0(e)/v0|0)|0}var Ja=64,Za=4194304;function ra(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 el(e,r){var s=e.pendingLanes;if(s===0)return 0;var i=0,d=e.suspendedLanes,m=e.pingedLanes,b=s&268435455;if(b!==0){var A=b&~d;A!==0?i=ra(A):(m&=b,m!==0&&(i=ra(m)))}else b=s&~d,b!==0?i=ra(b):m!==0&&(i=ra(m));if(i===0)return 0;if(r!==0&&r!==i&&(r&d)===0&&(d=i&-i,m=r&-r,d>=m||d===16&&(m&4194240)!==0))return r;if((i&4)!==0&&(i|=s&16),r=e.entangledLanes,r!==0)for(e=e.entanglements,r&=i;0s;s++)r.push(e);return r}function na(e,r,s){e.pendingLanes|=r,r!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,r=31-cr(r),e[r]=s}function b0(e,r){var s=e.pendingLanes&~r;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=r,e.mutableReadLanes&=r,e.entangledLanes&=r,r=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=ua),Hu=" ",Ku=!1;function Gu(e,r){switch(e){case"keyup":return q0.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cs=!1;function J0(e,r){switch(e){case"compositionend":return Yu(r);case"keypress":return r.which!==32?null:(Ku=!0,Hu);case"textInput":return e=r.data,e===Hu&&Ku?null:e;default:return null}}function Z0(e,r){if(cs)return e==="compositionend"||!No&&Gu(e,r)?(e=zu(),al=po=tn=null,cs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:s,offset:r-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=tf(s)}}function nf(e,r){return e&&r?e===r?!0:e&&e.nodeType===3?!1:r&&r.nodeType===3?nf(e,r.parentNode):"contains"in e?e.contains(r):e.compareDocumentPosition?!!(e.compareDocumentPosition(r)&16):!1:!1}function sf(){for(var e=window,r=je();r instanceof e.HTMLIFrameElement;){try{var s=typeof r.contentWindow.location.href=="string"}catch{s=!1}if(s)e=r.contentWindow;else break;r=je(e.document)}return r}function So(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r&&(r==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||r==="textarea"||e.contentEditable==="true")}function ov(e){var r=sf(),s=e.focusedElem,i=e.selectionRange;if(r!==s&&s&&s.ownerDocument&&nf(s.ownerDocument.documentElement,s)){if(i!==null&&So(s)){if(r=i.start,e=i.end,e===void 0&&(e=r),"selectionStart"in s)s.selectionStart=r,s.selectionEnd=Math.min(e,s.value.length);else if(e=(r=s.ownerDocument||document)&&r.defaultView||window,e.getSelection){e=e.getSelection();var d=s.textContent.length,m=Math.min(i.start,d);i=i.end===void 0?m:Math.min(i.end,d),!e.extend&&m>i&&(d=i,i=m,m=d),d=rf(s,m);var b=rf(s,i);d&&b&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==b.node||e.focusOffset!==b.offset)&&(r=r.createRange(),r.setStart(d.node,d.offset),e.removeAllRanges(),m>i?(e.addRange(r),e.extend(b.node,b.offset)):(r.setEnd(b.node,b.offset),e.addRange(r)))}}for(r=[],e=s;e=e.parentNode;)e.nodeType===1&&r.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,ds=null,Co=null,pa=null,ko=!1;function af(e,r,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;ko||ds==null||ds!==je(i)||(i=ds,"selectionStart"in i&&So(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),pa&&ma(pa,i)||(pa=i,i=hl(Co,"onSelect"),0ps||(e.current=Fo[ps],Fo[ps]=null,ps--)}function Je(e,r){ps++,Fo[ps]=e.current,e.current=r}var an={},kt=sn(an),zt=sn(!1),Ln=an;function xs(e,r){var s=e.type.contextTypes;if(!s)return an;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===r)return i.__reactInternalMemoizedMaskedChildContext;var d={},m;for(m in s)d[m]=r[m];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=d),d}function $t(e){return e=e.childContextTypes,e!=null}function gl(){tt(zt),tt(kt)}function Nf(e,r,s){if(kt.current!==an)throw Error(l(168));Je(kt,r),Je(zt,s)}function bf(e,r,s){var i=e.stateNode;if(r=r.childContextTypes,typeof i.getChildContext!="function")return s;i=i.getChildContext();for(var d in i)if(!(d in r))throw Error(l(108,le(e)||"Unknown",d));return H({},s,i)}function vl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||an,Ln=kt.current,Je(kt,e),Je(zt,zt.current),!0}function wf(e,r,s){var i=e.stateNode;if(!i)throw Error(l(169));s?(e=bf(e,r,Ln),i.__reactInternalMemoizedMergedChildContext=e,tt(zt),tt(kt),Je(kt,e)):tt(zt),Je(zt,s)}var Mr=null,yl=!1,zo=!1;function Sf(e){Mr===null?Mr=[e]:Mr.push(e)}function jv(e){yl=!0,Sf(e)}function ln(){if(!zo&&Mr!==null){zo=!0;var e=0,r=qe;try{var s=Mr;for(qe=1;e>=b,d-=b,Dr=1<<32-cr(r)+d|s<Me?(yt=Ae,Ae=null):yt=Ae.sibling;var Ge=oe(W,Ae,K[Me],me);if(Ge===null){Ae===null&&(Ae=yt);break}e&&Ae&&Ge.alternate===null&&r(W,Ae),$=m(Ge,$,Me),Ie===null?Pe=Ge:Ie.sibling=Ge,Ie=Ge,Ae=yt}if(Me===K.length)return s(W,Ae),rt&&Fn(W,Me),Pe;if(Ae===null){for(;MeMe?(yt=Ae,Ae=null):yt=Ae.sibling;var xn=oe(W,Ae,Ge.value,me);if(xn===null){Ae===null&&(Ae=yt);break}e&&Ae&&xn.alternate===null&&r(W,Ae),$=m(xn,$,Me),Ie===null?Pe=xn:Ie.sibling=xn,Ie=xn,Ae=yt}if(Ge.done)return s(W,Ae),rt&&Fn(W,Me),Pe;if(Ae===null){for(;!Ge.done;Me++,Ge=K.next())Ge=he(W,Ge.value,me),Ge!==null&&($=m(Ge,$,Me),Ie===null?Pe=Ge:Ie.sibling=Ge,Ie=Ge);return rt&&Fn(W,Me),Pe}for(Ae=i(W,Ae);!Ge.done;Me++,Ge=K.next())Ge=ge(Ae,W,Me,Ge.value,me),Ge!==null&&(e&&Ge.alternate!==null&&Ae.delete(Ge.key===null?Me:Ge.key),$=m(Ge,$,Me),Ie===null?Pe=Ge:Ie.sibling=Ge,Ie=Ge);return e&&Ae.forEach(function(ey){return r(W,ey)}),rt&&Fn(W,Me),Pe}function dt(W,$,K,me){if(typeof K=="object"&&K!==null&&K.type===E&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case B:e:{for(var Pe=K.key,Ie=$;Ie!==null;){if(Ie.key===Pe){if(Pe=K.type,Pe===E){if(Ie.tag===7){s(W,Ie.sibling),$=d(Ie,K.props.children),$.return=W,W=$;break e}}else if(Ie.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===te&&Tf(Pe)===Ie.type){s(W,Ie.sibling),$=d(Ie,K.props),$.ref=Na(W,Ie,K),$.return=W,W=$;break e}s(W,Ie);break}else r(W,Ie);Ie=Ie.sibling}K.type===E?($=Kn(K.props.children,W.mode,me,K.key),$.return=W,W=$):(me=Gl(K.type,K.key,K.props,null,W.mode,me),me.ref=Na(W,$,K),me.return=W,W=me)}return b(W);case V:e:{for(Ie=K.key;$!==null;){if($.key===Ie)if($.tag===4&&$.stateNode.containerInfo===K.containerInfo&&$.stateNode.implementation===K.implementation){s(W,$.sibling),$=d($,K.children||[]),$.return=W,W=$;break e}else{s(W,$);break}else r(W,$);$=$.sibling}$=Lc(K,W.mode,me),$.return=W,W=$}return b(W);case te:return Ie=K._init,dt(W,$,Ie(K._payload),me)}if(In(K))return we(W,$,K,me);if(Q(K))return Ee(W,$,K,me);wl(W,K)}return typeof K=="string"&&K!==""||typeof K=="number"?(K=""+K,$!==null&&$.tag===6?(s(W,$.sibling),$=d($,K),$.return=W,W=$):(s(W,$),$=Dc(K,W.mode,me),$.return=W,W=$),b(W)):s(W,$)}return dt}var js=_f(!0),If=_f(!1),Sl=sn(null),Cl=null,Ns=null,Ho=null;function Ko(){Ho=Ns=Cl=null}function Go(e){var r=Sl.current;tt(Sl),e._currentValue=r}function Yo(e,r,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&r)!==r?(e.childLanes|=r,i!==null&&(i.childLanes|=r)):i!==null&&(i.childLanes&r)!==r&&(i.childLanes|=r),e===s)break;e=e.return}}function bs(e,r){Cl=e,Ho=Ns=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&r)!==0&&(Bt=!0),e.firstContext=null)}function tr(e){var r=e._currentValue;if(Ho!==e)if(e={context:e,memoizedValue:r,next:null},Ns===null){if(Cl===null)throw Error(l(308));Ns=e,Cl.dependencies={lanes:0,firstContext:e}}else Ns=Ns.next=e;return r}var zn=null;function Qo(e){zn===null?zn=[e]:zn.push(e)}function Af(e,r,s,i){var d=r.interleaved;return d===null?(s.next=s,Qo(r)):(s.next=d.next,d.next=s),r.interleaved=s,Or(e,i)}function Or(e,r){e.lanes|=r;var s=e.alternate;for(s!==null&&(s.lanes|=r),s=e,e=e.return;e!==null;)e.childLanes|=r,s=e.alternate,s!==null&&(s.childLanes|=r),s=e,e=e.return;return s.tag===3?s.stateNode:null}var on=!1;function qo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(e,r){e=e.updateQueue,r.updateQueue===e&&(r.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Fr(e,r){return{eventTime:e,lane:r,tag:0,payload:null,callback:null,next:null}}function cn(e,r,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(He&2)!==0){var d=i.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),i.pending=r,Or(e,s)}return d=i.interleaved,d===null?(r.next=r,Qo(i)):(r.next=d.next,d.next=r),i.interleaved=r,Or(e,s)}function kl(e,r,s){if(r=r.updateQueue,r!==null&&(r=r.shared,(s&4194240)!==0)){var i=r.lanes;i&=e.pendingLanes,s|=i,r.lanes=s,co(e,s)}}function Df(e,r){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var d=null,m=null;if(s=s.firstBaseUpdate,s!==null){do{var b={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};m===null?d=m=b:m=m.next=b,s=s.next}while(s!==null);m===null?d=m=r:m=m.next=r}else d=m=r;s={baseState:i.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:i.shared,effects:i.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=r:e.next=r,s.lastBaseUpdate=r}function El(e,r,s,i){var d=e.updateQueue;on=!1;var m=d.firstBaseUpdate,b=d.lastBaseUpdate,A=d.shared.pending;if(A!==null){d.shared.pending=null;var O=A,Y=O.next;O.next=null,b===null?m=Y:b.next=Y,b=O;var de=e.alternate;de!==null&&(de=de.updateQueue,A=de.lastBaseUpdate,A!==b&&(A===null?de.firstBaseUpdate=Y:A.next=Y,de.lastBaseUpdate=O))}if(m!==null){var he=d.baseState;b=0,de=Y=O=null,A=m;do{var oe=A.lane,ge=A.eventTime;if((i&oe)===oe){de!==null&&(de=de.next={eventTime:ge,lane:0,tag:A.tag,payload:A.payload,callback:A.callback,next:null});e:{var we=e,Ee=A;switch(oe=r,ge=s,Ee.tag){case 1:if(we=Ee.payload,typeof we=="function"){he=we.call(ge,he,oe);break e}he=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ee.payload,oe=typeof we=="function"?we.call(ge,he,oe):we,oe==null)break e;he=H({},he,oe);break e;case 2:on=!0}}A.callback!==null&&A.lane!==0&&(e.flags|=64,oe=d.effects,oe===null?d.effects=[A]:oe.push(A))}else ge={eventTime:ge,lane:oe,tag:A.tag,payload:A.payload,callback:A.callback,next:null},de===null?(Y=de=ge,O=he):de=de.next=ge,b|=oe;if(A=A.next,A===null){if(A=d.shared.pending,A===null)break;oe=A,A=oe.next,oe.next=null,d.lastBaseUpdate=oe,d.shared.pending=null}}while(!0);if(de===null&&(O=he),d.baseState=O,d.firstBaseUpdate=Y,d.lastBaseUpdate=de,r=d.shared.interleaved,r!==null){d=r;do b|=d.lane,d=d.next;while(d!==r)}else m===null&&(d.shared.lanes=0);Un|=b,e.lanes=b,e.memoizedState=he}}function Lf(e,r,s){if(e=r.effects,r.effects=null,e!==null)for(r=0;rs?s:4,e(!0);var i=tc.transition;tc.transition={};try{e(!1),r()}finally{qe=s,tc.transition=i}}function th(){return rr().memoizedState}function Sv(e,r,s){var i=hn(e);if(s={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null},rh(e))nh(r,s);else if(s=Af(e,r,s,i),s!==null){var d=At();pr(s,e,i,d),sh(s,r,i)}}function Cv(e,r,s){var i=hn(e),d={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null};if(rh(e))nh(r,d);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=r.lastRenderedReducer,m!==null))try{var b=r.lastRenderedState,A=m(b,s);if(d.hasEagerState=!0,d.eagerState=A,dr(A,b)){var O=r.interleaved;O===null?(d.next=d,Qo(r)):(d.next=O.next,O.next=d),r.interleaved=d;return}}catch{}finally{}s=Af(e,r,d,i),s!==null&&(d=At(),pr(s,e,i,d),sh(s,r,i))}}function rh(e){var r=e.alternate;return e===lt||r!==null&&r===lt}function nh(e,r){Ca=Tl=!0;var s=e.pending;s===null?r.next=r:(r.next=s.next,s.next=r),e.pending=r}function sh(e,r,s){if((s&4194240)!==0){var i=r.lanes;i&=e.pendingLanes,s|=i,r.lanes=s,co(e,s)}}var Al={readContext:tr,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},kv={readContext:tr,useCallback:function(e,r){return Cr().memoizedState=[e,r===void 0?null:r],e},useContext:tr,useEffect:Gf,useImperativeHandle:function(e,r,s){return s=s!=null?s.concat([e]):null,_l(4194308,4,qf.bind(null,r,e),s)},useLayoutEffect:function(e,r){return _l(4194308,4,e,r)},useInsertionEffect:function(e,r){return _l(4,2,e,r)},useMemo:function(e,r){var s=Cr();return r=r===void 0?null:r,e=e(),s.memoizedState=[e,r],e},useReducer:function(e,r,s){var i=Cr();return r=s!==void 0?s(r):r,i.memoizedState=i.baseState=r,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=Sv.bind(null,lt,e),[i.memoizedState,e]},useRef:function(e){var r=Cr();return e={current:e},r.memoizedState=e},useState:Hf,useDebugValue:oc,useDeferredValue:function(e){return Cr().memoizedState=e},useTransition:function(){var e=Hf(!1),r=e[0];return e=wv.bind(null,e[1]),Cr().memoizedState=e,[r,e]},useMutableSource:function(){},useSyncExternalStore:function(e,r,s){var i=lt,d=Cr();if(rt){if(s===void 0)throw Error(l(407));s=s()}else{if(s=r(),vt===null)throw Error(l(349));(Bn&30)!==0||$f(i,r,s)}d.memoizedState=s;var m={value:s,getSnapshot:r};return d.queue=m,Gf(Uf.bind(null,i,m,e),[e]),i.flags|=2048,Pa(9,Bf.bind(null,i,m,s,r),void 0,null),s},useId:function(){var e=Cr(),r=vt.identifierPrefix;if(rt){var s=Lr,i=Dr;s=(i&~(1<<32-cr(i)-1)).toString(32)+s,r=":"+r+"R"+s,s=ka++,0<\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=b.createElement(s,{is:i.is}):(e=b.createElement(s),s==="select"&&(b=e,i.multiple?b.multiple=!0:i.size&&(b.size=i.size))):e=b.createElementNS(e,s),e[wr]=r,e[ya]=i,Sh(e,r,!1,!1),r.stateNode=e;e:{switch(b=Zi(s,i),s){case"dialog":et("cancel",e),et("close",e),d=i;break;case"iframe":case"object":case"embed":et("load",e),d=i;break;case"video":case"audio":for(d=0;dEs&&(r.flags|=128,i=!0,Ra(m,!1),r.lanes=4194304)}else{if(!i)if(e=Pl(b),e!==null){if(r.flags|=128,i=!0,s=e.updateQueue,s!==null&&(r.updateQueue=s,r.flags|=4),Ra(m,!0),m.tail===null&&m.tailMode==="hidden"&&!b.alternate&&!rt)return Pt(r),null}else 2*ct()-m.renderingStartTime>Es&&s!==1073741824&&(r.flags|=128,i=!0,Ra(m,!1),r.lanes=4194304);m.isBackwards?(b.sibling=r.child,r.child=b):(s=m.last,s!==null?s.sibling=b:r.child=b,m.last=b)}return m.tail!==null?(r=m.tail,m.rendering=r,m.tail=r.sibling,m.renderingStartTime=ct(),r.sibling=null,s=at.current,Je(at,i?s&1|2:s&1),r):(Pt(r),null);case 22:case 23:return Ic(),i=r.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(r.flags|=8192),i&&(r.mode&1)!==0?(qt&1073741824)!==0&&(Pt(r),r.subtreeFlags&6&&(r.flags|=8192)):Pt(r),null;case 24:return null;case 25:return null}throw Error(l(156,r.tag))}function Mv(e,r){switch(Bo(r),r.tag){case 1:return $t(r.type)&&gl(),e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 3:return ws(),tt(zt),tt(kt),ec(),e=r.flags,(e&65536)!==0&&(e&128)===0?(r.flags=e&-65537|128,r):null;case 5:return Jo(r),null;case 13:if(tt(at),e=r.memoizedState,e!==null&&e.dehydrated!==null){if(r.alternate===null)throw Error(l(340));ys()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 19:return tt(at),null;case 4:return ws(),null;case 10:return Go(r.type._context),null;case 22:case 23:return Ic(),null;case 24:return null;default:return null}}var Ol=!1,Rt=!1,Dv=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function Cs(e,r){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(i){it(e,r,i)}else s.current=null}function jc(e,r,s){try{s()}catch(i){it(e,r,i)}}var Eh=!1;function Lv(e,r){if(Io=nl,e=sf(),So(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var i=s.getSelection&&s.getSelection();if(i&&i.rangeCount!==0){s=i.anchorNode;var d=i.anchorOffset,m=i.focusNode;i=i.focusOffset;try{s.nodeType,m.nodeType}catch{s=null;break e}var b=0,A=-1,O=-1,Y=0,de=0,he=e,oe=null;t:for(;;){for(var ge;he!==s||d!==0&&he.nodeType!==3||(A=b+d),he!==m||i!==0&&he.nodeType!==3||(O=b+i),he.nodeType===3&&(b+=he.nodeValue.length),(ge=he.firstChild)!==null;)oe=he,he=ge;for(;;){if(he===e)break t;if(oe===s&&++Y===d&&(A=b),oe===m&&++de===i&&(O=b),(ge=he.nextSibling)!==null)break;he=oe,oe=he.parentNode}he=ge}s=A===-1||O===-1?null:{start:A,end:O}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ao={focusedElem:e,selectionRange:s},nl=!1,Ne=r;Ne!==null;)if(r=Ne,e=r.child,(r.subtreeFlags&1028)!==0&&e!==null)e.return=r,Ne=e;else for(;Ne!==null;){r=Ne;try{var we=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(we!==null){var Ee=we.memoizedProps,dt=we.memoizedState,W=r.stateNode,$=W.getSnapshotBeforeUpdate(r.elementType===r.type?Ee:fr(r.type,Ee),dt);W.__reactInternalSnapshotBeforeUpdate=$}break;case 3:var K=r.stateNode.containerInfo;K.nodeType===1?K.textContent="":K.nodeType===9&&K.documentElement&&K.removeChild(K.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(me){it(r,r.return,me)}if(e=r.sibling,e!==null){e.return=r.return,Ne=e;break}Ne=r.return}return we=Eh,Eh=!1,we}function Ta(e,r,s){var i=r.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&e)===e){var m=d.destroy;d.destroy=void 0,m!==void 0&&jc(r,s,m)}d=d.next}while(d!==i)}}function Fl(e,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.create;s.destroy=i()}s=s.next}while(s!==r)}}function Nc(e){var r=e.ref;if(r!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof r=="function"?r(e):r.current=e}}function Ph(e){var r=e.alternate;r!==null&&(e.alternate=null,Ph(r)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(r=e.stateNode,r!==null&&(delete r[wr],delete r[ya],delete r[Oo],delete r[vv],delete r[yv])),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 Rh(e){return e.tag===5||e.tag===3||e.tag===4}function Th(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rh(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 bc(e,r,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,r?s.nodeType===8?s.parentNode.insertBefore(e,r):s.insertBefore(e,r):(s.nodeType===8?(r=s.parentNode,r.insertBefore(e,s)):(r=s,r.appendChild(e)),s=s._reactRootContainer,s!=null||r.onclick!==null||(r.onclick=pl));else if(i!==4&&(e=e.child,e!==null))for(bc(e,r,s),e=e.sibling;e!==null;)bc(e,r,s),e=e.sibling}function wc(e,r,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,r?s.insertBefore(e,r):s.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(wc(e,r,s),e=e.sibling;e!==null;)wc(e,r,s),e=e.sibling}var bt=null,hr=!1;function dn(e,r,s){for(s=s.child;s!==null;)_h(e,r,s),s=s.sibling}function _h(e,r,s){if(br&&typeof br.onCommitFiberUnmount=="function")try{br.onCommitFiberUnmount(Xa,s)}catch{}switch(s.tag){case 5:Rt||Cs(s,r);case 6:var i=bt,d=hr;bt=null,dn(e,r,s),bt=i,hr=d,bt!==null&&(hr?(e=bt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):bt.removeChild(s.stateNode));break;case 18:bt!==null&&(hr?(e=bt,s=s.stateNode,e.nodeType===8?Lo(e.parentNode,s):e.nodeType===1&&Lo(e,s),oa(e)):Lo(bt,s.stateNode));break;case 4:i=bt,d=hr,bt=s.stateNode.containerInfo,hr=!0,dn(e,r,s),bt=i,hr=d;break;case 0:case 11:case 14:case 15:if(!Rt&&(i=s.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){d=i=i.next;do{var m=d,b=m.destroy;m=m.tag,b!==void 0&&((m&2)!==0||(m&4)!==0)&&jc(s,r,b),d=d.next}while(d!==i)}dn(e,r,s);break;case 1:if(!Rt&&(Cs(s,r),i=s.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=s.memoizedProps,i.state=s.memoizedState,i.componentWillUnmount()}catch(A){it(s,r,A)}dn(e,r,s);break;case 21:dn(e,r,s);break;case 22:s.mode&1?(Rt=(i=Rt)||s.memoizedState!==null,dn(e,r,s),Rt=i):dn(e,r,s);break;default:dn(e,r,s)}}function Ih(e){var r=e.updateQueue;if(r!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Dv),r.forEach(function(i){var d=Hv.bind(null,e,i);s.has(i)||(s.add(i),i.then(d,d))})}}function mr(e,r){var s=r.deletions;if(s!==null)for(var i=0;id&&(d=b),i&=~m}if(i=d,i=ct()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Fv(i/1960))-i,10e?16:e,fn===null)var i=!1;else{if(e=fn,fn=null,Vl=0,(He&6)!==0)throw Error(l(331));var d=He;for(He|=4,Ne=e.current;Ne!==null;){var m=Ne,b=m.child;if((Ne.flags&16)!==0){var A=m.deletions;if(A!==null){for(var O=0;Oct()-kc?Wn(e,0):Cc|=s),Vt(e,r)}function Hh(e,r){r===0&&((e.mode&1)===0?r=1:(r=Za,Za<<=1,(Za&130023424)===0&&(Za=4194304)));var s=At();e=Or(e,r),e!==null&&(na(e,r,s),Vt(e,s))}function Wv(e){var r=e.memoizedState,s=0;r!==null&&(s=r.retryLane),Hh(e,s)}function Hv(e,r){var s=0;switch(e.tag){case 13:var i=e.stateNode,d=e.memoizedState;d!==null&&(s=d.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(l(314))}i!==null&&i.delete(r),Hh(e,s)}var Kh;Kh=function(e,r,s){if(e!==null)if(e.memoizedProps!==r.pendingProps||zt.current)Bt=!0;else{if((e.lanes&s)===0&&(r.flags&128)===0)return Bt=!1,Iv(e,r,s);Bt=(e.flags&131072)!==0}else Bt=!1,rt&&(r.flags&1048576)!==0&&Cf(r,Nl,r.index);switch(r.lanes=0,r.tag){case 2:var i=r.type;Ll(e,r),e=r.pendingProps;var d=xs(r,kt.current);bs(r,s),d=nc(null,r,i,e,d,s);var m=sc();return r.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,$t(i)?(m=!0,vl(r)):m=!1,r.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,qo(r),d.updater=Ml,r.stateNode=d,d._reactInternals=r,dc(r,i,e,s),r=mc(null,r,i,!0,m,s)):(r.tag=0,rt&&m&&$o(r),It(null,r,d,s),r=r.child),r;case 16:i=r.elementType;e:{switch(Ll(e,r),e=r.pendingProps,d=i._init,i=d(i._payload),r.type=i,d=r.tag=Gv(i),e=fr(i,e),d){case 0:r=hc(null,r,i,e,s);break e;case 1:r=vh(null,r,i,e,s);break e;case 11:r=hh(null,r,i,e,s);break e;case 14:r=mh(null,r,i,fr(i.type,e),s);break e}throw Error(l(306,i,""))}return r;case 0:return i=r.type,d=r.pendingProps,d=r.elementType===i?d:fr(i,d),hc(e,r,i,d,s);case 1:return i=r.type,d=r.pendingProps,d=r.elementType===i?d:fr(i,d),vh(e,r,i,d,s);case 3:e:{if(yh(r),e===null)throw Error(l(387));i=r.pendingProps,m=r.memoizedState,d=m.element,Mf(e,r),El(r,i,null,s);var b=r.memoizedState;if(i=b.element,m.isDehydrated)if(m={element:i,isDehydrated:!1,cache:b.cache,pendingSuspenseBoundaries:b.pendingSuspenseBoundaries,transitions:b.transitions},r.updateQueue.baseState=m,r.memoizedState=m,r.flags&256){d=Ss(Error(l(423)),r),r=jh(e,r,i,s,d);break e}else if(i!==d){d=Ss(Error(l(424)),r),r=jh(e,r,i,s,d);break e}else for(Qt=nn(r.stateNode.containerInfo.firstChild),Yt=r,rt=!0,ur=null,s=If(r,null,i,s),r.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ys(),i===d){r=zr(e,r,s);break e}It(e,r,i,s)}r=r.child}return r;case 5:return Of(r),e===null&&Vo(r),i=r.type,d=r.pendingProps,m=e!==null?e.memoizedProps:null,b=d.children,Mo(i,d)?b=null:m!==null&&Mo(i,m)&&(r.flags|=32),gh(e,r),It(e,r,b,s),r.child;case 6:return e===null&&Vo(r),null;case 13:return Nh(e,r,s);case 4:return Xo(r,r.stateNode.containerInfo),i=r.pendingProps,e===null?r.child=js(r,null,i,s):It(e,r,i,s),r.child;case 11:return i=r.type,d=r.pendingProps,d=r.elementType===i?d:fr(i,d),hh(e,r,i,d,s);case 7:return It(e,r,r.pendingProps,s),r.child;case 8:return It(e,r,r.pendingProps.children,s),r.child;case 12:return It(e,r,r.pendingProps.children,s),r.child;case 10:e:{if(i=r.type._context,d=r.pendingProps,m=r.memoizedProps,b=d.value,Je(Sl,i._currentValue),i._currentValue=b,m!==null)if(dr(m.value,b)){if(m.children===d.children&&!zt.current){r=zr(e,r,s);break e}}else for(m=r.child,m!==null&&(m.return=r);m!==null;){var A=m.dependencies;if(A!==null){b=m.child;for(var O=A.firstContext;O!==null;){if(O.context===i){if(m.tag===1){O=Fr(-1,s&-s),O.tag=2;var Y=m.updateQueue;if(Y!==null){Y=Y.shared;var de=Y.pending;de===null?O.next=O:(O.next=de.next,de.next=O),Y.pending=O}}m.lanes|=s,O=m.alternate,O!==null&&(O.lanes|=s),Yo(m.return,s,r),A.lanes|=s;break}O=O.next}}else if(m.tag===10)b=m.type===r.type?null:m.child;else if(m.tag===18){if(b=m.return,b===null)throw Error(l(341));b.lanes|=s,A=b.alternate,A!==null&&(A.lanes|=s),Yo(b,s,r),b=m.sibling}else b=m.child;if(b!==null)b.return=m;else for(b=m;b!==null;){if(b===r){b=null;break}if(m=b.sibling,m!==null){m.return=b.return,b=m;break}b=b.return}m=b}It(e,r,d.children,s),r=r.child}return r;case 9:return d=r.type,i=r.pendingProps.children,bs(r,s),d=tr(d),i=i(d),r.flags|=1,It(e,r,i,s),r.child;case 14:return i=r.type,d=fr(i,r.pendingProps),d=fr(i.type,d),mh(e,r,i,d,s);case 15:return ph(e,r,r.type,r.pendingProps,s);case 17:return i=r.type,d=r.pendingProps,d=r.elementType===i?d:fr(i,d),Ll(e,r),r.tag=1,$t(i)?(e=!0,vl(r)):e=!1,bs(r,s),lh(r,i,d),dc(r,i,d,s),mc(null,r,i,!0,e,s);case 19:return wh(e,r,s);case 22:return xh(e,r,s)}throw Error(l(156,r.tag))};function Gh(e,r){return Cu(e,r)}function Kv(e,r,s,i){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=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sr(e,r,s,i){return new Kv(e,r,s,i)}function Mc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gv(e){if(typeof e=="function")return Mc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ee)return 11;if(e===Z)return 14}return 2}function pn(e,r){var s=e.alternate;return s===null?(s=sr(e.tag,r,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=r,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,r=e.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Gl(e,r,s,i,d,m){var b=2;if(i=e,typeof e=="function")Mc(e)&&(b=1);else if(typeof e=="string")b=5;else e:switch(e){case E:return Kn(s.children,d,m,r);case T:b=8,d|=8;break;case z:return e=sr(12,s,r,d|2),e.elementType=z,e.lanes=m,e;case ce:return e=sr(13,s,r,d),e.elementType=ce,e.lanes=m,e;case G:return e=sr(19,s,r,d),e.elementType=G,e.lanes=m,e;case U:return Yl(s,d,m,r);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:b=10;break e;case ue:b=9;break e;case ee:b=11;break e;case Z:b=14;break e;case te:b=16,i=null;break e}throw Error(l(130,e==null?e:typeof e,""))}return r=sr(b,s,r,d),r.elementType=e,r.type=i,r.lanes=m,r}function Kn(e,r,s,i){return e=sr(7,e,i,r),e.lanes=s,e}function Yl(e,r,s,i){return e=sr(22,e,i,r),e.elementType=U,e.lanes=s,e.stateNode={isHidden:!1},e}function Dc(e,r,s){return e=sr(6,e,null,r),e.lanes=s,e}function Lc(e,r,s){return r=sr(4,e.children!==null?e.children:[],e.key,r),r.lanes=s,r.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},r}function Yv(e,r,s,i,d){this.tag=r,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=oo(0),this.expirationTimes=oo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=oo(0),this.identifierPrefix=i,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Oc(e,r,s,i,d,m,b,A,O){return e=new Yv(e,r,s,A,O),r===1?(r=1,m===!0&&(r|=8)):r=0,m=sr(3,null,null,r),e.current=m,m.stateNode=e,m.memoizedState={element:i,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},qo(m),e}function Qv(e,r,s){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),Vc.exports=iy(),Vc.exports}var im;function oy(){if(im)return ti;im=1;var n=dp();return ti.createRoot=n.createRoot,ti.hydrateRoot=n.hydrateRoot,ti}var cy=oy(),Va=dp();const dy=cp(Va);/** + * @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 Fa(){return Fa=Object.assign?Object.assign.bind():function(n){for(var a=1;a"u")throw new Error(a)}function Md(n,a){if(!n){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function fy(){return Math.random().toString(36).substr(2,8)}function cm(n,a){return{usr:n.state,key:n.key,idx:a}}function dd(n,a,l,o){return l===void 0&&(l=null),Fa({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof a=="string"?Bs(a):a,{state:l,key:a&&a.key||o||fy()})}function vi(n){let{pathname:a="/",search:l="",hash:o=""}=n;return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(a+=o.charAt(0)==="#"?o:"#"+o),a}function Bs(n){let a={};if(n){let l=n.indexOf("#");l>=0&&(a.hash=n.substr(l),n=n.substr(0,l));let o=n.indexOf("?");o>=0&&(a.search=n.substr(o),n=n.substr(0,o)),n&&(a.pathname=n)}return a}function hy(n,a,l,o){o===void 0&&(o={});let{window:c=document.defaultView,v5Compat:u=!1}=o,f=c.history,p=Nn.Pop,x=null,g=v();g==null&&(g=0,f.replaceState(Fa({},f.state,{idx:g}),""));function v(){return(f.state||{idx:null}).idx}function y(){p=Nn.Pop;let w=v(),S=w==null?null:w-g;g=w,x&&x({action:p,location:N.location,delta:S})}function k(w,S){p=Nn.Push;let P=dd(N.location,w,S);g=v()+1;let j=cm(P,g),_=N.createHref(P);try{f.pushState(j,"",_)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;c.location.assign(_)}u&&x&&x({action:p,location:N.location,delta:1})}function R(w,S){p=Nn.Replace;let P=dd(N.location,w,S);g=v();let j=cm(P,g),_=N.createHref(P);f.replaceState(j,"",_),u&&x&&x({action:p,location:N.location,delta:0})}function C(w){let S=c.location.origin!=="null"?c.location.origin:c.location.href,P=typeof w=="string"?w:vi(w);return P=P.replace(/ $/,"%20"),ut(S,"No window.location.(origin|href) available to create URL for href: "+P),new URL(P,S)}let N={get action(){return p},get location(){return n(c,f)},listen(w){if(x)throw new Error("A history only accepts one active listener");return c.addEventListener(om,y),x=w,()=>{c.removeEventListener(om,y),x=null}},createHref(w){return a(c,w)},createURL:C,encodeLocation(w){let S=C(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:k,replace:R,go(w){return f.go(w)}};return N}var dm;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(dm||(dm={}));function my(n,a,l){return l===void 0&&(l="/"),py(n,a,l)}function py(n,a,l,o){let c=typeof a=="string"?Bs(a):a,u=Dd(c.pathname||"/",l);if(u==null)return null;let f=up(n);xy(f);let p=null;for(let x=0;p==null&&x{let x={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};x.relativePath.startsWith("/")&&(ut(x.relativePath.startsWith(o),'Absolute route path "'+x.relativePath+'" nested under path '+('"'+o+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),x.relativePath=x.relativePath.slice(o.length));let g=bn([o,x.relativePath]),v=l.concat(x);u.children&&u.children.length>0&&(ut(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),up(u.children,a,v,g)),!(u.path==null&&!u.index)&&a.push({path:g,score:wy(g,u.index),routesMeta:v})};return n.forEach((u,f)=>{var p;if(u.path===""||!((p=u.path)!=null&&p.includes("?")))c(u,f);else for(let x of fp(u.path))c(u,f,x)}),a}function fp(n){let a=n.split("/");if(a.length===0)return[];let[l,...o]=a,c=l.endsWith("?"),u=l.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let f=fp(o.join("/")),p=[];return p.push(...f.map(x=>x===""?u:[u,x].join("/"))),c&&p.push(...f),p.map(x=>n.startsWith("/")&&x===""?"/":x)}function xy(n){n.sort((a,l)=>a.score!==l.score?l.score-a.score:Sy(a.routesMeta.map(o=>o.childrenIndex),l.routesMeta.map(o=>o.childrenIndex)))}const gy=/^:[\w-]+$/,vy=3,yy=2,jy=1,Ny=10,by=-2,um=n=>n==="*";function wy(n,a){let l=n.split("/"),o=l.length;return l.some(um)&&(o+=by),a&&(o+=yy),l.filter(c=>!um(c)).reduce((c,u)=>c+(gy.test(u)?vy:u===""?jy:Ny),o)}function Sy(n,a){return n.length===a.length&&n.slice(0,-1).every((o,c)=>o===a[c])?n[n.length-1]-a[a.length-1]:0}function Cy(n,a,l){let{routesMeta:o}=n,c={},u="/",f=[];for(let p=0;p{let{paramName:k,isOptional:R}=v;if(k==="*"){let N=p[y]||"";f=u.slice(0,u.length-N.length).replace(/(.)\/+$/,"$1")}const C=p[y];return R&&!C?g[k]=void 0:g[k]=(C||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:f,pattern:n}}function Ey(n,a,l){a===void 0&&(a=!1),l===void 0&&(l=!0),Md(n==="*"||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".'));let o=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,p,x)=>(o.push({paramName:p,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(o.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),o]}function Py(n){try{return n.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Md(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),n}}function Dd(n,a){if(a==="/")return n;if(!n.toLowerCase().startsWith(a.toLowerCase()))return null;let l=a.endsWith("/")?a.length-1:a.length,o=n.charAt(l);return o&&o!=="/"?null:n.slice(l)||"/"}const Ry=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ty=n=>Ry.test(n);function _y(n,a){a===void 0&&(a="/");let{pathname:l,search:o="",hash:c=""}=typeof n=="string"?Bs(n):n,u;if(l)if(Ty(l))u=l;else{if(l.includes("//")){let f=l;l=l.replace(/\/\/+/g,"/"),Md(!1,"Pathnames cannot have embedded double slashes - normalizing "+(f+" -> "+l))}l.startsWith("/")?u=fm(l.substring(1),"/"):u=fm(l,a)}else u=a;return{pathname:u,search:My(o),hash:Dy(c)}}function fm(n,a){let l=a.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?l.length>1&&l.pop():c!=="."&&l.push(c)}),l.length>1?l.join("/"):"/"}function Kc(n,a,l,o){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(o)+"]. 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 Iy(n){return n.filter((a,l)=>l===0||a.route.path&&a.route.path.length>0)}function Ld(n,a){let l=Iy(n);return a?l.map((o,c)=>c===l.length-1?o.pathname:o.pathnameBase):l.map(o=>o.pathnameBase)}function Od(n,a,l,o){o===void 0&&(o=!1);let c;typeof n=="string"?c=Bs(n):(c=Fa({},n),ut(!c.pathname||!c.pathname.includes("?"),Kc("?","pathname","search",c)),ut(!c.pathname||!c.pathname.includes("#"),Kc("#","pathname","hash",c)),ut(!c.search||!c.search.includes("#"),Kc("#","search","hash",c)));let u=n===""||c.pathname==="",f=u?"/":c.pathname,p;if(f==null)p=l;else{let y=a.length-1;if(!o&&f.startsWith("..")){let k=f.split("/");for(;k[0]==="..";)k.shift(),y-=1;c.pathname=k.join("/")}p=y>=0?a[y]:"/"}let x=_y(c,p),g=f&&f!=="/"&&f.endsWith("/"),v=(u||f===".")&&l.endsWith("/");return!x.pathname.endsWith("/")&&(g||v)&&(x.pathname+="/"),x}const bn=n=>n.join("/").replace(/\/\/+/g,"/"),Ay=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),My=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,Dy=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;function Ly(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const hp=["post","put","patch","delete"];new Set(hp);const Oy=["get",...hp];new Set(Oy);/** + * 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 za(){return za=Object.assign?Object.assign.bind():function(n){for(var a=1;a{p.current=!0}),h.useCallback(function(g,v){if(v===void 0&&(v={}),!p.current)return;if(typeof g=="number"){o.go(g);return}let y=Od(g,JSON.parse(f),u,v.relative==="path");n==null&&a!=="/"&&(y.pathname=y.pathname==="/"?a:bn([a,y.pathname])),(v.replace?o.replace:o.push)(y,v.state,v)},[a,o,f,u,n])}const By=h.createContext(null);function Uy(n){let a=h.useContext(Kr).outlet;return a&&h.createElement(By.Provider,{value:n},a)}function xp(n,a){let{relative:l}=a===void 0?{}:a,{future:o}=h.useContext(Pn),{matches:c}=h.useContext(Kr),{pathname:u}=ns(),f=JSON.stringify(Ld(c,o.v7_relativeSplatPath));return h.useMemo(()=>Od(n,JSON.parse(f),u,l==="path"),[n,f,u,l])}function Vy(n,a){return Wy(n,a)}function Wy(n,a,l,o){Us()||ut(!1);let{navigator:c}=h.useContext(Pn),{matches:u}=h.useContext(Kr),f=u[u.length-1],p=f?f.params:{};f&&f.pathname;let x=f?f.pathnameBase:"/";f&&f.route;let g=ns(),v;if(a){var y;let w=typeof a=="string"?Bs(a):a;x==="/"||(y=w.pathname)!=null&&y.startsWith(x)||ut(!1),v=w}else v=g;let k=v.pathname||"/",R=k;if(x!=="/"){let w=x.replace(/^\//,"").split("/");R="/"+k.replace(/^\//,"").split("/").slice(w.length).join("/")}let C=my(n,{pathname:R}),N=Qy(C&&C.map(w=>Object.assign({},w,{params:Object.assign({},p,w.params),pathname:bn([x,c.encodeLocation?c.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?x:bn([x,c.encodeLocation?c.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),u,l,o);return a&&N?h.createElement(Ai.Provider,{value:{location:za({pathname:"/",search:"",hash:"",state:null,key:"default"},v),navigationType:Nn.Pop}},N):N}function Hy(){let n=Zy(),a=Ly(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),l=n instanceof Error?n.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},a),l?h.createElement("pre",{style:c},l):null,null)}const Ky=h.createElement(Hy,null);class Gy extends h.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?h.createElement(Kr.Provider,{value:this.props.routeContext},h.createElement(mp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Yy(n){let{routeContext:a,match:l,children:o}=n,c=h.useContext(Fd);return c&&c.static&&c.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=l.route.id),h.createElement(Kr.Provider,{value:a},o)}function Qy(n,a,l,o){var c;if(a===void 0&&(a=[]),l===void 0&&(l=null),o===void 0&&(o=null),n==null){var u;if(!l)return null;if(l.errors)n=l.matches;else if((u=o)!=null&&u.v7_partialHydration&&a.length===0&&!l.initialized&&l.matches.length>0)n=l.matches;else return null}let f=n,p=(c=l)==null?void 0:c.errors;if(p!=null){let v=f.findIndex(y=>y.route.id&&(p==null?void 0:p[y.route.id])!==void 0);v>=0||ut(!1),f=f.slice(0,Math.min(f.length,v+1))}let x=!1,g=-1;if(l&&o&&o.v7_partialHydration)for(let v=0;v=0?f=f.slice(0,g+1):f=[f[0]];break}}}return f.reduceRight((v,y,k)=>{let R,C=!1,N=null,w=null;l&&(R=p&&y.route.id?p[y.route.id]:void 0,N=y.route.errorElement||Ky,x&&(g<0&&k===0?(tj("route-fallback"),C=!0,w=null):g===k&&(C=!0,w=y.route.hydrateFallbackElement||null)));let S=a.concat(f.slice(0,k+1)),P=()=>{let j;return R?j=N:C?j=w:y.route.Component?j=h.createElement(y.route.Component,null):y.route.element?j=y.route.element:j=v,h.createElement(Yy,{match:y,routeContext:{outlet:v,matches:S,isDataRoute:l!=null},children:j})};return l&&(y.route.ErrorBoundary||y.route.errorElement||k===0)?h.createElement(Gy,{location:l.location,revalidation:l.revalidation,component:N,error:R,children:P(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):P()},null)}var gp=(function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n})(gp||{}),vp=(function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n})(vp||{});function qy(n){let a=h.useContext(Fd);return a||ut(!1),a}function Xy(n){let a=h.useContext(Fy);return a||ut(!1),a}function Jy(n){let a=h.useContext(Kr);return a||ut(!1),a}function yp(n){let a=Jy(),l=a.matches[a.matches.length-1];return l.route.id||ut(!1),l.route.id}function Zy(){var n;let a=h.useContext(mp),l=Xy(),o=yp();return a!==void 0?a:(n=l.errors)==null?void 0:n[o]}function ej(){let{router:n}=qy(gp.UseNavigateStable),a=yp(vp.UseNavigateStable),l=h.useRef(!1);return pp(()=>{l.current=!0}),h.useCallback(function(c,u){u===void 0&&(u={}),l.current&&(typeof c=="number"?n.navigate(c):n.navigate(c,za({fromRouteId:a},u)))},[n,a])}const hm={};function tj(n,a,l){hm[n]||(hm[n]=!0)}function rj(n,a){n==null||n.v7_startTransition,n==null||n.v7_relativeSplatPath}function nj(n){let{to:a,replace:l,state:o,relative:c}=n;Us()||ut(!1);let{future:u,static:f}=h.useContext(Pn),{matches:p}=h.useContext(Kr),{pathname:x}=ns(),g=Wa(),v=Od(a,Ld(p,u.v7_relativeSplatPath),x,c==="path"),y=JSON.stringify(v);return h.useEffect(()=>g(JSON.parse(y),{replace:l,state:o,relative:c}),[g,y,c,l,o]),null}function sj(n){return Uy(n.context)}function nt(n){ut(!1)}function aj(n){let{basename:a="/",children:l=null,location:o,navigationType:c=Nn.Pop,navigator:u,static:f=!1,future:p}=n;Us()&&ut(!1);let x=a.replace(/^\/*/,"/"),g=h.useMemo(()=>({basename:x,navigator:u,static:f,future:za({v7_relativeSplatPath:!1},p)}),[x,p,u,f]);typeof o=="string"&&(o=Bs(o));let{pathname:v="/",search:y="",hash:k="",state:R=null,key:C="default"}=o,N=h.useMemo(()=>{let w=Dd(v,x);return w==null?null:{location:{pathname:w,search:y,hash:k,state:R,key:C},navigationType:c}},[x,v,y,k,R,C,c]);return N==null?null:h.createElement(Pn.Provider,{value:g},h.createElement(Ai.Provider,{children:l,value:N}))}function lj(n){let{children:a,location:l}=n;return Vy(ud(a),l)}new Promise(()=>{});function ud(n,a){a===void 0&&(a=[]);let l=[];return h.Children.forEach(n,(o,c)=>{if(!h.isValidElement(o))return;let u=[...a,c];if(o.type===h.Fragment){l.push.apply(l,ud(o.props.children,u));return}o.type!==nt&&ut(!1),!o.props.index||!o.props.children||ut(!1);let f={id:o.props.id||u.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,loader:o.props.loader,action:o.props.action,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(f.children=ud(o.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 fd(){return fd=Object.assign?Object.assign.bind():function(n){for(var a=1;a=0)&&(l[c]=n[c]);return l}function oj(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function cj(n,a){return n.button===0&&(!a||a==="_self")&&!oj(n)}const dj=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],uj="6";try{window.__reactRouterVersion=uj}catch{}const fj="startTransition",mm=Ii[fj];function hj(n){let{basename:a,children:l,future:o,window:c}=n,u=h.useRef();u.current==null&&(u.current=uy({window:c,v5Compat:!0}));let f=u.current,[p,x]=h.useState({action:f.action,location:f.location}),{v7_startTransition:g}=o||{},v=h.useCallback(y=>{g&&mm?mm(()=>x(y)):x(y)},[x,g]);return h.useLayoutEffect(()=>f.listen(v),[f,v]),h.useEffect(()=>rj(o),[o]),h.createElement(aj,{basename:a,children:l,location:p.location,navigationType:p.action,navigator:f,future:o})}const mj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fi=h.forwardRef(function(a,l){let{onClick:o,relative:c,reloadDocument:u,replace:f,state:p,target:x,to:g,preventScrollReset:v,viewTransition:y}=a,k=ij(a,dj),{basename:R}=h.useContext(Pn),C,N=!1;if(typeof g=="string"&&pj.test(g)&&(C=g,mj))try{let j=new URL(window.location.href),_=g.startsWith("//")?new URL(j.protocol+g):new URL(g),B=Dd(_.pathname,R);_.origin===j.origin&&B!=null?g=B+_.search+_.hash:N=!0}catch{}let w=zy(g,{relative:c}),S=xj(g,{replace:f,state:p,target:x,preventScrollReset:v,relative:c,viewTransition:y});function P(j){o&&o(j),j.defaultPrevented||S(j)}return h.createElement("a",fd({},k,{href:C||w,onClick:N||u?o:P,ref:l,target:x}))});var pm;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(pm||(pm={}));var xm;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(xm||(xm={}));function xj(n,a){let{target:l,replace:o,state:c,preventScrollReset:u,relative:f,viewTransition:p}=a===void 0?{}:a,x=Wa(),g=ns(),v=xp(n,{relative:f});return h.useCallback(y=>{if(cj(y,l)){y.preventDefault();let k=o!==void 0?o:vi(g)===vi(v);x(n,{replace:k,state:c,preventScrollReset:u,relative:f,viewTransition:p})}},[g,x,v,o,c,l,n,u,f,p])}/** + * @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 gj=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vj=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,l,o)=>o?o.toUpperCase():l.toLowerCase()),gm=n=>{const a=vj(n);return a.charAt(0).toUpperCase()+a.slice(1)},jp=(...n)=>n.filter((a,l,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===l).join(" ").trim(),yj=n=>{for(const a in n)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 jj={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 Nj=h.forwardRef(({color:n="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:f,...p},x)=>h.createElement("svg",{ref:x,...jj,width:a,height:a,stroke:n,strokeWidth:o?Number(l)*24/Number(a):l,className:jp("lucide",c),...!u&&!yj(p)&&{"aria-hidden":"true"},...p},[...f.map(([g,v])=>h.createElement(g,v)),...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 be=(n,a)=>{const l=h.forwardRef(({className:o,...c},u)=>h.createElement(Nj,{ref:u,iconNode:a,className:jp(`lucide-${gj(gm(n))}`,`lucide-${n}`,o),...c}));return l.displayName=gm(n),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 bj=[["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"}]],vm=be("bitcoin",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 wj=[["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"}]],Vr=be("book-open",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 Sj=[["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"}]],$a=be("calendar",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 Cj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mi=be("check",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 kj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Di=be("chevron-down",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 Ej=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],As=be("chevron-right",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 Pj=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Np=be("chevron-up",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=[["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"}]],Tj=be("circle-alert",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:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ym=be("circle-check-big",_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=[["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"}]],bp=be("circle-question-mark",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=[["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"}]],jm=be("circle-user",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=[["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"}]],Dj=be("circle-x",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 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wp=be("clock",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=[["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"}]],Sp=be("copy",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 Fj=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],hd=be("credit-card",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:"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"}]],Li=be("crown",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=[["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"}]],yi=be("dollar-sign",$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:"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"}]],Uj=be("download",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 Vj=[["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"}]],ji=be("external-link",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 Wj=[["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"}]],Ms=be("eye",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 Hj=[["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"}]],Kj=be("file-text",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 Gj=[["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"}]],Yj=be("funnel",Gj);/** + * @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 Qj=[["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"}]],qj=be("gift",Qj);/** + * @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=[["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"}]],Jj=be("git-merge",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 Zj=[["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"}]],md=be("globe",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 eN=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],tN=be("graduation-cap",eN);/** + * @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 rN=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Gc=be("grip-vertical",rN);/** + * @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 nN=[["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"}]],Nm=be("history",nN);/** + * @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 sN=[["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"}]],aN=be("house",sN);/** + * @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 lN=[["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"}]],Cp=be("image",lN);/** + * @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 iN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ri=be("info",iN);/** + * @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 oN=[["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"}]],bm=be("key",oN);/** + * @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 cN=[["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"}]],dN=be("layout-dashboard",cN);/** + * @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 uN=[["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"}]],Yn=be("link-2",uN);/** + * @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 fN=[["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"}]],wm=be("link",fN);/** + * @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 hN=[["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"}]],mN=be("lock",hN);/** + * @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 pN=[["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"}]],xN=be("log-out",pN);/** + * @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 gN=[["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"}]],vN=be("map-pin",gN);/** + * @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 yN=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],jN=be("menu",yN);/** + * @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 NN=[["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"}]],bN=be("message-circle",NN);/** + * @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 wN=[["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"}]],SN=be("palette",wN);/** + * @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 CN=[["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"}]],Ht=be("pen-line",CN);/** + * @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 kN=[["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"}]],EN=be("percent",kN);/** + * @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 PN=[["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"}]],RN=be("phone",PN);/** + * @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 TN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gr=be("plus",TN);/** + * @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 _N=[["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"}]],Sm=be("qr-code",_N);/** + * @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 IN=[["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"}]],Ze=be("refresh-cw",IN);/** + * @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 AN=[["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"}]],Ot=be("save",AN);/** + * @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 MN=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qn=be("search",MN);/** + * @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 DN=[["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"}]],Ni=be("settings",DN);/** + * @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 LN=[["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"}]],ON=be("settings-2",LN);/** + * @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 FN=[["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"}]],zd=be("shield-check",FN);/** + * @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 zN=[["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"}]],pd=be("shopping-bag",zN);/** + * @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 $N=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],xd=be("smartphone",$N);/** + * @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 BN=[["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"}]],UN=be("tag",BN);/** + * @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 VN=[["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"}]],Er=be("trash-2",VN);/** + * @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 WN=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],gd=be("trending-up",WN);/** + * @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 HN=[["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"}]],kp=be("undo-2",HN);/** + * @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 KN=[["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"}]],bi=be("upload",KN);/** + * @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 GN=[["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"}]],Cm=be("user-plus",GN);/** + * @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 YN=[["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"}]],qn=be("user",YN);/** + * @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 QN=[["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"}]],vr=be("users",QN);/** + * @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 qN=[["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"}]],Os=be("wallet",qN);/** + * @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 XN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ir=be("x",XN);/** + * @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 JN=[["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"}]],ZN=be("zap",JN),$d="admin_token";function Bd(){try{return localStorage.getItem($d)}catch{return null}}function eb(n){try{localStorage.setItem($d,n)}catch{}}function tb(){try{localStorage.removeItem($d)}catch{}}const rb="https://soulapi.quwanzhi.com",nb=()=>{const n="https://soulapi.quwanzhi.com";return n.length>0?n.replace(/\/$/,""):rb};function Fs(n){const a=nb(),l=n.startsWith("/")?n:`/${n}`;return a?`${a}${l}`:l}async function Oi(n,a={}){const{data:l,...o}=a,c=Fs(n),u=new Headers(o.headers),f=Bd();f&&u.set("Authorization",`Bearer ${f}`),l!=null&&!u.has("Content-Type")&&u.set("Content-Type","application/json");const p=l!=null?JSON.stringify(l):o.body,x=await fetch(c,{...o,headers:u,body:p,credentials:"include"}),v=(x.headers.get("Content-Type")||"").includes("application/json")?await x.json():x;if(!x.ok){const y=new Error((v==null?void 0:v.error)||`HTTP ${x.status}`);throw y.status=x.status,y.data=v,y}return v}function Ke(n,a){return Oi(n,{...a,method:"GET"})}function jt(n,a,l){return Oi(n,{...l,method:"POST",data:a})}function St(n,a,l){return Oi(n,{...l,method:"PUT",data:a})}function zs(n,a){return Oi(n,{...a,method:"DELETE"})}const sb=[{icon:dN,label:"数据概览",href:"/dashboard"},{icon:Vr,label:"内容管理",href:"/content"},{icon:vr,label:"用户管理",href:"/users"}],km=[{icon:Li,label:"VIP 角色",href:"/vip-roles"},{icon:qn,label:"作者详情",href:"/author-settings"},{icon:zd,label:"管理员",href:"/admin-users"},{icon:tN,label:"导师管理",href:"/mentors"},{icon:$a,label:"导师预约",href:"/mentor-consultations"},{icon:Os,label:"推广中心",href:"/distribution"},{icon:Jj,label:"匹配记录",href:"/match-records"},{icon:hd,label:"推广设置",href:"/referral-settings"}];function ab(){const n=ns(),a=Wa(),[l,o]=h.useState(!1),[c,u]=h.useState(!1),[f,p]=h.useState(!1);h.useEffect(()=>{o(!0)},[]),h.useEffect(()=>{km.some(v=>n.pathname===v.href)&&p(!0)},[n.pathname]),h.useEffect(()=>{if(!l)return;u(!1);let g=!1;return Ke("/api/admin").then(v=>{g||(v&&v.success!==!1?u(!0):a("/login",{replace:!0}))}).catch(()=>{g||a("/login",{replace:!0})}),()=>{g=!0}},[l,a]);const x=async()=>{tb();try{await jt("/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.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[sb.map(g=>{const v=n.pathname===g.href;return t.jsxs(fi,{to:g.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${v?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(g.icon,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:g.label})]},g.href)}),t.jsx("button",{type:"button",onClick:()=>p(!f),className:"w-full flex items-center justify-between gap-3 px-4 py-3 text-gray-400 hover:bg-gray-700/50 hover:text-white rounded-lg transition-colors",children:t.jsxs("span",{className:"flex items-center gap-3",children:[f?t.jsx(Np,{className:"w-5 h-5"}):t.jsx(Di,{className:"w-5 h-5"}),t.jsx("span",{className:"text-sm",children:"更多"})]})}),f&&t.jsx("div",{className:"space-y-1 pl-4",children:km.map(g=>{const v=n.pathname===g.href;return t.jsxs(fi,{to:g.href,className:`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${v?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(g.icon,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:g.label})]},g.href)})}),t.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:t.jsxs(fi,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${n.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(Ni,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),t.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:t.jsxs("button",{type:"button",onClick:x,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(xN,{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(sj,{})})})]})}function Em(n,a){if(typeof n=="function")return n(a);n!=null&&(n.current=a)}function Ud(...n){return a=>{let l=!1;const o=n.map(c=>{const u=Em(c,a);return!l&&typeof u=="function"&&(l=!0),u});if(l)return()=>{for(let c=0;c{let{children:u,...f}=o;Ep(u)&&typeof wi=="function"&&(u=wi(u._payload));const p=h.Children.toArray(u),x=p.find(db);if(x){const g=x.props.children,v=p.map(y=>y===x?h.Children.count(g)>1?h.Children.only(null):h.isValidElement(g)?g.props.children:null:y);return t.jsx(a,{...f,ref:c,children:h.isValidElement(g)?h.cloneElement(g,void 0,v):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${n}.Slot`,l}var Rp=Pp("Slot");function ob(n){const a=h.forwardRef((l,o)=>{let{children:c,...u}=l;if(Ep(c)&&typeof wi=="function"&&(c=wi(c._payload)),h.isValidElement(c)){const f=fb(c),p=ub(u,c.props);return c.type!==h.Fragment&&(p.ref=o?Ud(o,f):f),h.cloneElement(c,p)}return h.Children.count(c)>1?h.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var cb=Symbol("radix.slottable");function db(n){return h.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===cb}function ub(n,a){const l={...a};for(const o in a){const c=n[o],u=a[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...p)=>{const x=u(...p);return c(...p),x}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...n,...l}}function fb(n){var o,c;let a=(o=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?n.ref:(a=(c=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?n.props.ref:n.props.ref||n.ref)}function Tp(n){var a,l,o="";if(typeof n=="string"||typeof n=="number")o+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(a=0;atypeof n=="boolean"?`${n}`:n===0?"0":n,Rm=_p,Ip=(n,a)=>l=>{var o;if((a==null?void 0:a.variants)==null)return Rm(n,l==null?void 0:l.class,l==null?void 0:l.className);const{variants:c,defaultVariants:u}=a,f=Object.keys(c).map(g=>{const v=l==null?void 0:l[g],y=u==null?void 0:u[g];if(v===null)return null;const k=Pm(v)||Pm(y);return c[g][k]}),p=l&&Object.entries(l).reduce((g,v)=>{let[y,k]=v;return k===void 0||(g[y]=k),g},{}),x=a==null||(o=a.compoundVariants)===null||o===void 0?void 0:o.reduce((g,v)=>{let{class:y,className:k,...R}=v;return Object.entries(R).every(C=>{let[N,w]=C;return Array.isArray(w)?w.includes({...u,...p}[N]):{...u,...p}[N]===w})?[...g,y,k]:g},[]);return Rm(n,f,x,l==null?void 0:l.class,l==null?void 0:l.className)},hb=(n,a)=>{const l=new Array(n.length+a.length);for(let o=0;o({classGroupId:n,validator:a}),Ap=(n=new Map,a=null,l)=>({nextPart:n,validators:a,classGroupId:l}),Si="-",Tm=[],pb="arbitrary..",xb=n=>{const a=vb(n),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=n;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return gb(f);const p=f.split(Si),x=p[0]===""&&p.length>1?1:0;return Mp(p,x,a)},getConflictingClassGroupIds:(f,p)=>{if(p){const x=o[f],g=l[f];return x?g?hb(g,x):x:g||Tm}return l[f]||Tm}}},Mp=(n,a,l)=>{if(n.length-a===0)return l.classGroupId;const c=n[a],u=l.nextPart.get(c);if(u){const g=Mp(n,a+1,u);if(g)return g}const f=l.validators;if(f===null)return;const p=a===0?n.join(Si):n.slice(a).join(Si),x=f.length;for(let g=0;gn.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=n.slice(1,-1),l=a.indexOf(":"),o=a.slice(0,l);return o?pb+o:void 0})(),vb=n=>{const{theme:a,classGroups:l}=n;return yb(l,a)},yb=(n,a)=>{const l=Ap();for(const o in n){const c=n[o];Vd(c,l,o,a)}return l},Vd=(n,a,l,o)=>{const c=n.length;for(let u=0;u{if(typeof n=="string"){Nb(n,a,l);return}if(typeof n=="function"){bb(n,a,l,o);return}wb(n,a,l,o)},Nb=(n,a,l)=>{const o=n===""?a:Dp(a,n);o.classGroupId=l},bb=(n,a,l,o)=>{if(Sb(n)){Vd(n(o),a,l,o);return}a.validators===null&&(a.validators=[]),a.validators.push(mb(l,n))},wb=(n,a,l,o)=>{const c=Object.entries(n),u=c.length;for(let f=0;f{let l=n;const o=a.split(Si),c=o.length;for(let u=0;u"isThemeGetter"in n&&n.isThemeGetter===!0,Cb=n=>{if(n<1)return{get:()=>{},set:()=>{}};let a=0,l=Object.create(null),o=Object.create(null);const c=(u,f)=>{l[u]=f,a++,a>n&&(a=0,o=l,l=Object.create(null))};return{get(u){let f=l[u];if(f!==void 0)return f;if((f=o[u])!==void 0)return c(u,f),f},set(u,f){u in l?l[u]=f:c(u,f)}}},vd="!",_m=":",kb=[],Im=(n,a,l,o,c)=>({modifiers:n,hasImportantModifier:a,baseClassName:l,maybePostfixModifierPosition:o,isExternal:c}),Eb=n=>{const{prefix:a,experimentalParseClassName:l}=n;let o=c=>{const u=[];let f=0,p=0,x=0,g;const v=c.length;for(let N=0;Nx?g-x:void 0;return Im(u,R,k,C)};if(a){const c=a+_m,u=o;o=f=>f.startsWith(c)?u(f.slice(c.length)):Im(kb,!1,f,void 0,!0)}if(l){const c=o;o=u=>l({className:u,parseClassName:c})}return o},Pb=n=>{const a=new Map;return n.orderSensitiveModifiers.forEach((l,o)=>{a.set(l,1e6+o)}),l=>{const o=[];let c=[];for(let u=0;u0&&(c.sort(),o.push(...c),c=[]),o.push(f)):c.push(f)}return c.length>0&&(c.sort(),o.push(...c)),o}},Rb=n=>({cache:Cb(n.cacheSize),parseClassName:Eb(n),sortModifiers:Pb(n),...xb(n)}),Tb=/\s+/,_b=(n,a)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:u}=a,f=[],p=n.trim().split(Tb);let x="";for(let g=p.length-1;g>=0;g-=1){const v=p[g],{isExternal:y,modifiers:k,hasImportantModifier:R,baseClassName:C,maybePostfixModifierPosition:N}=l(v);if(y){x=v+(x.length>0?" "+x:x);continue}let w=!!N,S=o(w?C.substring(0,N):C);if(!S){if(!w){x=v+(x.length>0?" "+x:x);continue}if(S=o(C),!S){x=v+(x.length>0?" "+x:x);continue}w=!1}const P=k.length===0?"":k.length===1?k[0]:u(k).join(":"),j=R?P+vd:P,_=j+S;if(f.indexOf(_)>-1)continue;f.push(_);const B=c(S,w);for(let V=0;V0?" "+x:x)}return x},Ib=(...n)=>{let a=0,l,o,c="";for(;a{if(typeof n=="string")return n;let a,l="";for(let o=0;o{let l,o,c,u;const f=x=>{const g=a.reduce((v,y)=>y(v),n());return l=Rb(g),o=l.cache.get,c=l.cache.set,u=p,p(x)},p=x=>{const g=o(x);if(g)return g;const v=_b(x,l);return c(x,v),v};return u=f,(...x)=>u(Ib(...x))},Mb=[],xt=n=>{const a=l=>l[n]||Mb;return a.isThemeGetter=!0,a},Op=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Db=/^\d+\/\d+$/,Lb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ob=/\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$/,Fb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$b=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rs=n=>Db.test(n),Fe=n=>!!n&&!Number.isNaN(Number(n)),gn=n=>!!n&&Number.isInteger(Number(n)),Yc=n=>n.endsWith("%")&&Fe(n.slice(0,-1)),Br=n=>Lb.test(n),Bb=()=>!0,Ub=n=>Ob.test(n)&&!Fb.test(n),zp=()=>!1,Vb=n=>zb.test(n),Wb=n=>$b.test(n),Hb=n=>!Se(n)&&!Ce(n),Kb=n=>Vs(n,Up,zp),Se=n=>Op.test(n),Gn=n=>Vs(n,Vp,Ub),Qc=n=>Vs(n,Xb,Fe),Am=n=>Vs(n,$p,zp),Gb=n=>Vs(n,Bp,Wb),ni=n=>Vs(n,Wp,Vb),Ce=n=>Fp.test(n),La=n=>Ws(n,Vp),Yb=n=>Ws(n,Jb),Mm=n=>Ws(n,$p),Qb=n=>Ws(n,Up),qb=n=>Ws(n,Bp),si=n=>Ws(n,Wp,!0),Vs=(n,a,l)=>{const o=Op.exec(n);return o?o[1]?a(o[1]):l(o[2]):!1},Ws=(n,a,l=!1)=>{const o=Fp.exec(n);return o?o[1]?a(o[1]):l:!1},$p=n=>n==="position"||n==="percentage",Bp=n=>n==="image"||n==="url",Up=n=>n==="length"||n==="size"||n==="bg-size",Vp=n=>n==="length",Xb=n=>n==="number",Jb=n=>n==="family-name",Wp=n=>n==="shadow",Zb=()=>{const n=xt("color"),a=xt("font"),l=xt("text"),o=xt("font-weight"),c=xt("tracking"),u=xt("leading"),f=xt("breakpoint"),p=xt("container"),x=xt("spacing"),g=xt("radius"),v=xt("shadow"),y=xt("inset-shadow"),k=xt("text-shadow"),R=xt("drop-shadow"),C=xt("blur"),N=xt("perspective"),w=xt("aspect"),S=xt("ease"),P=xt("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[..._(),Ce,Se],V=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],T=()=>[Ce,Se,x],z=()=>[Rs,"full","auto",...T()],q=()=>[gn,"none","subgrid",Ce,Se],ue=()=>["auto",{span:["full",gn,Ce,Se]},gn,Ce,Se],ee=()=>[gn,"auto",Ce,Se],ce=()=>["auto","min","max","fr",Ce,Se],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...T()],U=()=>[Rs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],M=()=>[n,Ce,Se],Q=()=>[..._(),Mm,Am,{position:[Ce,Se]}],H=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",Qb,Kb,{size:[Ce,Se]}],L=()=>[Yc,La,Gn],X=()=>["","none","full",g,Ce,Se],ae=()=>["",Fe,La,Gn],ve=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[Fe,Yc,Mm,Am],ye=()=>["","none",C,Ce,Se],D=()=>["none",Fe,Ce,Se],fe=()=>["none",Fe,Ce,Se],F=()=>[Fe,Ce,Se],re=()=>[Rs,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Br],breakpoint:[Br],color:[Bb],container:[Br],"drop-shadow":[Br],ease:["in","out","in-out"],font:[Hb],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Br],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Br],shadow:[Br],spacing:["px",Fe],text:[Br],"text-shadow":[Br],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rs,Se,Ce,w]}],container:["container"],columns:[{columns:[Fe,Se,Ce,p]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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:V()}],"overflow-x":[{"overflow-x":V()}],"overflow-y":[{"overflow-y":V()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[gn,"auto",Ce,Se]}],basis:[{basis:[Rs,"full","auto",p,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,Rs,"auto","initial","none",Se]}],grow:[{grow:["",Fe,Ce,Se]}],shrink:[{shrink:["",Fe,Ce,Se]}],order:[{order:[gn,"first","last","none",Ce,Se]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:ue()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:ue()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[p,"screen",...U()]}],"min-w":[{"min-w":[p,"screen","none",...U()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[f]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",l,La,Gn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Ce,Qc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Yc,Se]}],"font-family":[{font:[Yb,Se,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,Ce,Se]}],"line-clamp":[{"line-clamp":[Fe,"none",Ce,Qc]}],leading:[{leading:[u,...T()]}],"list-image":[{"list-image":["none",Ce,Se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,Se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",Ce,Gn]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Fe,"auto",Ce,Se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,Se]}],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",Ce,Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:H()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gn,Ce,Se],radial:["",Ce,Se],conic:[gn,Ce,Se]},qb,Gb]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,Ce,Se]}],"outline-w":[{outline:["",Fe,La,Gn]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",v,si,ni]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",y,si,ni]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Fe,Gn]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",k,si,ni]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Fe,Ce,Se]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"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":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Ce,Se]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":_()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:H()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,Se]}],filter:[{filter:["","none",Ce,Se]}],blur:[{blur:ye()}],brightness:[{brightness:[Fe,Ce,Se]}],contrast:[{contrast:[Fe,Ce,Se]}],"drop-shadow":[{"drop-shadow":["","none",R,si,ni]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Fe,Ce,Se]}],"hue-rotate":[{"hue-rotate":[Fe,Ce,Se]}],invert:[{invert:["",Fe,Ce,Se]}],saturate:[{saturate:[Fe,Ce,Se]}],sepia:[{sepia:["",Fe,Ce,Se]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,Se]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,Ce,Se]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,Ce,Se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,Ce,Se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,Ce,Se]}],"backdrop-invert":[{"backdrop-invert":["",Fe,Ce,Se]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,Ce,Se]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,Ce,Se]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,Ce,Se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,Se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",Ce,Se]}],ease:[{ease:["linear","initial",S,Ce,Se]}],delay:[{delay:[Fe,Ce,Se]}],animate:[{animate:["none",P,Ce,Se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,Ce,Se]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:D()}],"rotate-x":[{"rotate-x":D()}],"rotate-y":[{"rotate-y":D()}],"rotate-z":[{"rotate-z":D()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Ce,Se,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Ce,Se]}],"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":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",Ce,Se]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Fe,La,Gn,Qc]}],stroke:[{stroke:["none",...M()]}],"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"]}},ew=Ab(Zb);function Qe(...n){return ew(_p(n))}const tw=Ip("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 ie({className:n,variant:a,size:l,asChild:o=!1,...c}){const u=o?Rp:"button";return t.jsx(u,{"data-slot":"button",className:Qe(tw({variant:a,size:l,className:n})),...c})}function se({className:n,type:a,...l}){return t.jsx("input",{type:a,"data-slot":"input",className:Qe("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",n),...l})}function rw(){const n=Wa(),[a,l]=h.useState(""),[o,c]=h.useState(""),[u,f]=h.useState(""),[p,x]=h.useState(!1),g=async()=>{f(""),x(!0);try{const v=await jt("/api/admin",{username:a.trim(),password:o});if((v==null?void 0:v.success)!==!1&&(v!=null&&v.token)){eb(v.token),n("/dashboard",{replace:!0});return}f(v.error||"用户名或密码错误")}catch(v){const y=v;f(y.status===401?"用户名或密码错误":(y==null?void 0:y.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(zd,{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(qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(se,{type:"text",value:a,onChange:v=>l(v.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(mN,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(se,{type:"password",value:o,onChange:v=>c(v.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:v=>v.key==="Enter"&&g()})]})]}),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(ie,{onClick:g,disabled:p,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:p?"登录中...":"登录"})]})]}),t.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Re=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{ref:l,className:Qe("rounded-xl border bg-card text-card-foreground shadow",n),...a}));Re.displayName="Card";const Ue=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{ref:l,className:Qe("flex flex-col space-y-1.5 p-6",n),...a}));Ue.displayName="CardHeader";const Ve=h.forwardRef(({className:n,...a},l)=>t.jsx("h3",{ref:l,className:Qe("font-semibold leading-none tracking-tight",n),...a}));Ve.displayName="CardTitle";const ot=h.forwardRef(({className:n,...a},l)=>t.jsx("p",{ref:l,className:Qe("text-sm text-muted-foreground",n),...a}));ot.displayName="CardDescription";const Te=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{ref:l,className:Qe("p-6 pt-0",n),...a}));Te.displayName="CardContent";const nw=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{ref:l,className:Qe("flex items-center p-6 pt-0",n),...a}));nw.displayName="CardFooter";function sw(){const n=Wa(),[a,l]=h.useState(!0),[o,c]=h.useState([]),[u,f]=h.useState([]);async function p(){l(!0);try{const[C,N]=await Promise.all([Ke("/api/db/users"),Ke("/api/orders")]);C!=null&&C.success&&C.users&&c(C.users),N!=null&&N.success&&N.orders&&f(N.orders)}catch(C){console.error("加载数据失败",C)}finally{l(!1)}}if(h.useEffect(()=>{p()},[]),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(Ze,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),t.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const g=u.filter(C=>C.status==="paid"||C.status==="completed"||C.status==="success").reduce((C,N)=>C+Number(N.amount||0),0),v=o.length,y=u.length,k=C=>{const N=C.productType||"",w=C.description||"";if(w){if(N==="section"&&w.includes("章节")){if(w.includes("-")){const S=w.split("-");if(S.length>=3)return{title:`第${S[1]}章 第${S[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:w,subtitle:"章节购买"}}return N==="fullbook"||w.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:N==="match"||w.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:w,subtitle:N==="section"?"单章":N==="fullbook"?"全书":"其他"}}return N==="section"?{title:`章节 ${C.productId||""}`,subtitle:"单章购买"}:N==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:N==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:N||"其他"}},R=[{title:"总用户数",value:v,icon:vr,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${Number(g).toFixed(2)}`,icon:gd,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:y,icon:pd,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${v>0?(y/v*100).toFixed(1):0}%`,icon:Vr,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:R.map((C,N)=>t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>C.link&&n(C.link),children:[t.jsxs(Ue,{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(Te,{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(As,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},N))}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"最近订单"})}),t.jsx(Te,{children:t.jsxs("div",{className:"space-y-3",children:[u.slice(-5).reverse().map(C=>{var j;const N=C.referrerId?o.find(_=>_.id===C.referrerId):void 0,w=C.referralCode||(N==null?void 0:N.referralCode)||(N==null?void 0:N.nickname)||(C.referrerId?String(C.referrerId).slice(0,8):""),S=k(C),P=C.userNickname||((j=o.find(_=>_.id===C.userId))==null?void 0:j.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:P,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:_=>{_.currentTarget.style.display="none";const B=_.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:P.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:P}),t.jsx("span",{className:"text-gray-600",children:"·"}),t.jsx("span",{className:"text-sm font-medium text-white truncate",children:S.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:S.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"})})]}),w&&t.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",w]})]})]}),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(pd,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"新注册用户"})}),t.jsx(Te,{children:t.jsxs("div",{className:"space-y-3",children:[o.slice(-5).reverse().map(C=>{var N;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:((N=C.nickname)==null?void 0:N.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)}),o.length===0&&t.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]})]})}const Gr=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{className:"relative w-full overflow-auto",children:t.jsx("table",{ref:l,className:Qe("w-full caption-bottom text-sm",n),...a})}));Gr.displayName="Table";const Yr=h.forwardRef(({className:n,...a},l)=>t.jsx("thead",{ref:l,className:Qe("[&_tr]:border-b",n),...a}));Yr.displayName="TableHeader";const Qr=h.forwardRef(({className:n,...a},l)=>t.jsx("tbody",{ref:l,className:Qe("[&_tr:last-child]:border-0",n),...a}));Qr.displayName="TableBody";const st=h.forwardRef(({className:n,...a},l)=>t.jsx("tr",{ref:l,className:Qe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n),...a}));st.displayName="TableRow";const _e=h.forwardRef(({className:n,...a},l)=>t.jsx("th",{ref:l,className:Qe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n),...a}));_e.displayName="TableHead";const ke=h.forwardRef(({className:n,...a},l)=>t.jsx("td",{ref:l,className:Qe("p-4 align-middle [&:has([role=checkbox])]:pr-0",n),...a}));ke.displayName="TableCell";const aw=Ip("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:n,variant:a,asChild:l=!1,...o}){const c=l?Rp:"span";return t.jsx(c,{className:Qe(aw({variant:a}),n),...o})}function De(n,a,{checkForDefaultPrevented:l=!0}={}){return function(c){if(n==null||n(c),l===!1||!c.defaultPrevented)return a==null?void 0:a(c)}}function lw(n,a){const l=h.createContext(a),o=u=>{const{children:f,...p}=u,x=h.useMemo(()=>p,Object.values(p));return t.jsx(l.Provider,{value:x,children:f})};o.displayName=n+"Provider";function c(u){const f=h.useContext(l);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${n}\``)}return[o,c]}function Rn(n,a=[]){let l=[];function o(u,f){const p=h.createContext(f),x=l.length;l=[...l,f];const g=y=>{var S;const{scope:k,children:R,...C}=y,N=((S=k==null?void 0:k[n])==null?void 0:S[x])||p,w=h.useMemo(()=>C,Object.values(C));return t.jsx(N.Provider,{value:w,children:R})};g.displayName=u+"Provider";function v(y,k){var N;const R=((N=k==null?void 0:k[n])==null?void 0:N[x])||p,C=h.useContext(R);if(C)return C;if(f!==void 0)return f;throw new Error(`\`${y}\` must be used within \`${u}\``)}return[g,v]}const c=()=>{const u=l.map(f=>h.createContext(f));return function(p){const x=(p==null?void 0:p[n])||u;return h.useMemo(()=>({[`__scope${n}`]:{...p,[n]:x}}),[p,x])}};return c.scopeName=n,[o,iw(c,...a)]}function iw(...n){const a=n[0];if(n.length===1)return a;const l=()=>{const o=n.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const f=o.reduce((p,{useScope:x,scopeName:g})=>{const y=x(u)[`__scope${g}`];return{...p,...y}},{});return h.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return l.scopeName=a.scopeName,l}var _t=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},ow=Ii[" useId ".trim().toString()]||(()=>{}),cw=0;function wn(n){const[a,l]=h.useState(ow());return _t(()=>{l(o=>o??String(cw++))},[n]),a?`radix-${a}`:""}var dw=Ii[" useInsertionEffect ".trim().toString()]||_t;function Jn({prop:n,defaultProp:a,onChange:l=()=>{},caller:o}){const[c,u,f]=uw({defaultProp:a,onChange:l}),p=n!==void 0,x=p?n:c;{const v=h.useRef(n!==void 0);h.useEffect(()=>{const y=v.current;y!==p&&console.warn(`${o} is changing from ${y?"controlled":"uncontrolled"} to ${p?"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.`),v.current=p},[p,o])}const g=h.useCallback(v=>{var y;if(p){const k=fw(v)?v(n):v;k!==n&&((y=f.current)==null||y.call(f,k))}else u(v)},[p,n,u,f]);return[x,g]}function uw({defaultProp:n,onChange:a}){const[l,o]=h.useState(n),c=h.useRef(l),u=h.useRef(a);return dw(()=>{u.current=a},[a]),h.useEffect(()=>{var f;c.current!==l&&((f=u.current)==null||f.call(u,l),c.current=l)},[l,c]),[l,o,u]}function fw(n){return typeof n=="function"}function Ba(n){const a=hw(n),l=h.forwardRef((o,c)=>{const{children:u,...f}=o,p=h.Children.toArray(u),x=p.find(pw);if(x){const g=x.props.children,v=p.map(y=>y===x?h.Children.count(g)>1?h.Children.only(null):h.isValidElement(g)?g.props.children:null:y);return t.jsx(a,{...f,ref:c,children:h.isValidElement(g)?h.cloneElement(g,void 0,v):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${n}.Slot`,l}function hw(n){const a=h.forwardRef((l,o)=>{const{children:c,...u}=l;if(h.isValidElement(c)){const f=gw(c),p=xw(u,c.props);return c.type!==h.Fragment&&(p.ref=o?Ud(o,f):f),h.cloneElement(c,p)}return h.Children.count(c)>1?h.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var mw=Symbol("radix.slottable");function pw(n){return h.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===mw}function xw(n,a){const l={...a};for(const o in a){const c=n[o],u=a[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...p)=>{const x=u(...p);return c(...p),x}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...n,...l}}function gw(n){var o,c;let a=(o=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?n.ref:(a=(c=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?n.props.ref:n.props.ref||n.ref)}var vw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=vw.reduce((n,a)=>{const l=Ba(`Primitive.${a}`),o=h.forwardRef((c,u)=>{const{asChild:f,...p}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...p,ref:u})});return o.displayName=`Primitive.${a}`,{...n,[a]:o}},{});function yw(n,a){n&&Va.flushSync(()=>n.dispatchEvent(a))}function Cn(n){const a=h.useRef(n);return h.useEffect(()=>{a.current=n}),h.useMemo(()=>(...l)=>{var o;return(o=a.current)==null?void 0:o.call(a,...l)},[])}function jw(n,a=globalThis==null?void 0:globalThis.document){const l=Cn(n);h.useEffect(()=>{const o=c=>{c.key==="Escape"&&l(c)};return a.addEventListener("keydown",o,{capture:!0}),()=>a.removeEventListener("keydown",o,{capture:!0})},[l,a])}var Nw="DismissableLayer",yd="dismissableLayer.update",bw="dismissableLayer.pointerDownOutside",ww="dismissableLayer.focusOutside",Dm,Hp=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wd=h.forwardRef((n,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,onDismiss:p,...x}=n,g=h.useContext(Hp),[v,y]=h.useState(null),k=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,R]=h.useState({}),C=Ye(a,E=>y(E)),N=Array.from(g.layers),[w]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),S=N.indexOf(w),P=v?N.indexOf(v):-1,j=g.layersWithOutsidePointerEventsDisabled.size>0,_=P>=S,B=kw(E=>{const T=E.target,z=[...g.branches].some(q=>q.contains(T));!_||z||(c==null||c(E),f==null||f(E),E.defaultPrevented||p==null||p())},k),V=Ew(E=>{const T=E.target;[...g.branches].some(q=>q.contains(T))||(u==null||u(E),f==null||f(E),E.defaultPrevented||p==null||p())},k);return jw(E=>{P===g.layers.size-1&&(o==null||o(E),!E.defaultPrevented&&p&&(E.preventDefault(),p()))},k),h.useEffect(()=>{if(v)return l&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Dm=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),Lm(),()=>{l&&g.layersWithOutsidePointerEventsDisabled.size===1&&(k.body.style.pointerEvents=Dm)}},[v,k,l,g]),h.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),Lm())},[v,g]),h.useEffect(()=>{const E=()=>R({});return document.addEventListener(yd,E),()=>document.removeEventListener(yd,E)},[]),t.jsx(ze.div,{...x,ref:C,style:{pointerEvents:j?_?"auto":"none":void 0,...n.style},onFocusCapture:De(n.onFocusCapture,V.onFocusCapture),onBlurCapture:De(n.onBlurCapture,V.onBlurCapture),onPointerDownCapture:De(n.onPointerDownCapture,B.onPointerDownCapture)})});Wd.displayName=Nw;var Sw="DismissableLayerBranch",Cw=h.forwardRef((n,a)=>{const l=h.useContext(Hp),o=h.useRef(null),c=Ye(a,o);return h.useEffect(()=>{const u=o.current;if(u)return l.branches.add(u),()=>{l.branches.delete(u)}},[l.branches]),t.jsx(ze.div,{...n,ref:c})});Cw.displayName=Sw;function kw(n,a=globalThis==null?void 0:globalThis.document){const l=Cn(n),o=h.useRef(!1),c=h.useRef(()=>{});return h.useEffect(()=>{const u=p=>{if(p.target&&!o.current){let x=function(){Kp(bw,l,g,{discrete:!0})};const g={originalEvent:p};p.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=x,a.addEventListener("click",c.current,{once:!0})):x()}else a.removeEventListener("click",c.current);o.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:()=>o.current=!0}}function Ew(n,a=globalThis==null?void 0:globalThis.document){const l=Cn(n),o=h.useRef(!1);return h.useEffect(()=>{const c=u=>{u.target&&!o.current&&Kp(ww,l,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,l]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Lm(){const n=new CustomEvent(yd);document.dispatchEvent(n)}function Kp(n,a,l,{discrete:o}){const c=l.originalEvent.target,u=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:l});a&&c.addEventListener(n,a,{once:!0}),o?yw(c,u):c.dispatchEvent(u)}var qc="focusScope.autoFocusOnMount",Xc="focusScope.autoFocusOnUnmount",Om={bubbles:!1,cancelable:!0},Pw="FocusScope",Hd=h.forwardRef((n,a)=>{const{loop:l=!1,trapped:o=!1,onMountAutoFocus:c,onUnmountAutoFocus:u,...f}=n,[p,x]=h.useState(null),g=Cn(c),v=Cn(u),y=h.useRef(null),k=Ye(a,N=>x(N)),R=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(o){let N=function(j){if(R.paused||!p)return;const _=j.target;p.contains(_)?y.current=_:yn(y.current,{select:!0})},w=function(j){if(R.paused||!p)return;const _=j.relatedTarget;_!==null&&(p.contains(_)||yn(y.current,{select:!0}))},S=function(j){if(document.activeElement===document.body)for(const B of j)B.removedNodes.length>0&&yn(p)};document.addEventListener("focusin",N),document.addEventListener("focusout",w);const P=new MutationObserver(S);return p&&P.observe(p,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",w),P.disconnect()}}},[o,p,R.paused]),h.useEffect(()=>{if(p){zm.add(R);const N=document.activeElement;if(!p.contains(N)){const S=new CustomEvent(qc,Om);p.addEventListener(qc,g),p.dispatchEvent(S),S.defaultPrevented||(Rw(Mw(Gp(p)),{select:!0}),document.activeElement===N&&yn(p))}return()=>{p.removeEventListener(qc,g),setTimeout(()=>{const S=new CustomEvent(Xc,Om);p.addEventListener(Xc,v),p.dispatchEvent(S),S.defaultPrevented||yn(N??document.body,{select:!0}),p.removeEventListener(Xc,v),zm.remove(R)},0)}}},[p,g,v,R]);const C=h.useCallback(N=>{if(!l&&!o||R.paused)return;const w=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,S=document.activeElement;if(w&&S){const P=N.currentTarget,[j,_]=Tw(P);j&&_?!N.shiftKey&&S===_?(N.preventDefault(),l&&yn(j,{select:!0})):N.shiftKey&&S===j&&(N.preventDefault(),l&&yn(_,{select:!0})):S===P&&N.preventDefault()}},[l,o,R.paused]);return t.jsx(ze.div,{tabIndex:-1,...f,ref:k,onKeyDown:C})});Hd.displayName=Pw;function Rw(n,{select:a=!1}={}){const l=document.activeElement;for(const o of n)if(yn(o,{select:a}),document.activeElement!==l)return}function Tw(n){const a=Gp(n),l=Fm(a,n),o=Fm(a.reverse(),n);return[l,o]}function Gp(n){const a=[],l=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;l.nextNode();)a.push(l.currentNode);return a}function Fm(n,a){for(const l of n)if(!_w(l,{upTo:a}))return l}function _w(n,{upTo:a}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(a!==void 0&&n===a)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function Iw(n){return n instanceof HTMLInputElement&&"select"in n}function yn(n,{select:a=!1}={}){if(n&&n.focus){const l=document.activeElement;n.focus({preventScroll:!0}),n!==l&&Iw(n)&&a&&n.select()}}var zm=Aw();function Aw(){let n=[];return{add(a){const l=n[0];a!==l&&(l==null||l.pause()),n=$m(n,a),n.unshift(a)},remove(a){var l;n=$m(n,a),(l=n[0])==null||l.resume()}}}function $m(n,a){const l=[...n],o=l.indexOf(a);return o!==-1&&l.splice(o,1),l}function Mw(n){return n.filter(a=>a.tagName!=="A")}var Dw="Portal",Kd=h.forwardRef((n,a)=>{var p;const{container:l,...o}=n,[c,u]=h.useState(!1);_t(()=>u(!0),[]);const f=l||c&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return f?dy.createPortal(t.jsx(ze.div,{...o,ref:a}),f):null});Kd.displayName=Dw;function Lw(n,a){return h.useReducer((l,o)=>a[l][o]??l,n)}var Ha=n=>{const{present:a,children:l}=n,o=Ow(a),c=typeof l=="function"?l({present:o.isPresent}):h.Children.only(l),u=Ye(o.ref,Fw(c));return typeof l=="function"||o.isPresent?h.cloneElement(c,{ref:u}):null};Ha.displayName="Presence";function Ow(n){const[a,l]=h.useState(),o=h.useRef(null),c=h.useRef(n),u=h.useRef("none"),f=n?"mounted":"unmounted",[p,x]=Lw(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const g=ai(o.current);u.current=p==="mounted"?g:"none"},[p]),_t(()=>{const g=o.current,v=c.current;if(v!==n){const k=u.current,R=ai(g);n?x("MOUNT"):R==="none"||(g==null?void 0:g.display)==="none"?x("UNMOUNT"):x(v&&k!==R?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,x]),_t(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,y=R=>{const N=ai(o.current).includes(CSS.escape(R.animationName));if(R.target===a&&N&&(x("ANIMATION_END"),!c.current)){const w=a.style.animationFillMode;a.style.animationFillMode="forwards",g=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=w)})}},k=R=>{R.target===a&&(u.current=ai(o.current))};return a.addEventListener("animationstart",k),a.addEventListener("animationcancel",y),a.addEventListener("animationend",y),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",k),a.removeEventListener("animationcancel",y),a.removeEventListener("animationend",y)}}else x("ANIMATION_END")},[a,x]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:h.useCallback(g=>{o.current=g?getComputedStyle(g):null,l(g)},[])}}function ai(n){return(n==null?void 0:n.animationName)||"none"}function Fw(n){var o,c;let a=(o=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?n.ref:(a=(c=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?n.props.ref:n.props.ref||n.ref)}var Jc=0;function Yp(){h.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??Bm()),document.body.insertAdjacentElement("beforeend",n[1]??Bm()),Jc++,()=>{Jc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Jc--}},[])}function Bm(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var Pr=function(){return Pr=Object.assign||function(a){for(var l,o=1,c=arguments.length;o"u")return t1;var a=r1(n),l=document.documentElement.clientWidth,o=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,o-l+a[2]-a[0])}},s1=Jp(),Ds="data-scroll-locked",a1=function(n,a,l,o){var c=n.left,u=n.top,f=n.right,p=n.gap;return l===void 0&&(l="margin"),` + .`.concat($w,` { + overflow: hidden `).concat(o,`; + padding-right: `).concat(p,"px ").concat(o,`; + } + body[`).concat(Ds,`] { + overflow: hidden `).concat(o,`; + overscroll-behavior: contain; + `).concat([a&&"position: relative ".concat(o,";"),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(p,"px ").concat(o,`; + `),l==="padding"&&"padding-right: ".concat(p,"px ").concat(o,";")].filter(Boolean).join(""),` + } + + .`).concat(hi,` { + right: `).concat(p,"px ").concat(o,`; + } + + .`).concat(mi,` { + margin-right: `).concat(p,"px ").concat(o,`; + } + + .`).concat(hi," .").concat(hi,` { + right: 0 `).concat(o,`; + } + + .`).concat(mi," .").concat(mi,` { + margin-right: 0 `).concat(o,`; + } + + body[`).concat(Ds,`] { + `).concat(Bw,": ").concat(p,`px; + } +`)},Vm=function(){var n=parseInt(document.body.getAttribute(Ds)||"0",10);return isFinite(n)?n:0},l1=function(){h.useEffect(function(){return document.body.setAttribute(Ds,(Vm()+1).toString()),function(){var n=Vm()-1;n<=0?document.body.removeAttribute(Ds):document.body.setAttribute(Ds,n.toString())}},[])},i1=function(n){var a=n.noRelative,l=n.noImportant,o=n.gapMode,c=o===void 0?"margin":o;l1();var u=h.useMemo(function(){return n1(c)},[c]);return h.createElement(s1,{styles:a1(u,!a,c,l?"":"!important")})},jd=!1;if(typeof window<"u")try{var li=Object.defineProperty({},"passive",{get:function(){return jd=!0,!0}});window.addEventListener("test",li,li),window.removeEventListener("test",li,li)}catch{jd=!1}var Ts=jd?{passive:!1}:!1,o1=function(n){return n.tagName==="TEXTAREA"},Zp=function(n,a){if(!(n instanceof Element))return!1;var l=window.getComputedStyle(n);return l[a]!=="hidden"&&!(l.overflowY===l.overflowX&&!o1(n)&&l[a]==="visible")},c1=function(n){return Zp(n,"overflowY")},d1=function(n){return Zp(n,"overflowX")},Wm=function(n,a){var l=a.ownerDocument,o=a;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var c=ex(n,o);if(c){var u=tx(n,o),f=u[1],p=u[2];if(f>p)return!0}o=o.parentNode}while(o&&o!==l.body);return!1},u1=function(n){var a=n.scrollTop,l=n.scrollHeight,o=n.clientHeight;return[a,l,o]},f1=function(n){var a=n.scrollLeft,l=n.scrollWidth,o=n.clientWidth;return[a,l,o]},ex=function(n,a){return n==="v"?c1(a):d1(a)},tx=function(n,a){return n==="v"?u1(a):f1(a)},h1=function(n,a){return n==="h"&&a==="rtl"?-1:1},m1=function(n,a,l,o,c){var u=h1(n,window.getComputedStyle(a).direction),f=u*o,p=l.target,x=a.contains(p),g=!1,v=f>0,y=0,k=0;do{if(!p)break;var R=tx(n,p),C=R[0],N=R[1],w=R[2],S=N-w-u*C;(C||S)&&ex(n,p)&&(y+=S,k+=C);var P=p.parentNode;p=P&&P.nodeType===Node.DOCUMENT_FRAGMENT_NODE?P.host:P}while(!x&&p!==document.body||x&&(a.contains(p)||a===p));return(v&&Math.abs(y)<1||!v&&Math.abs(k)<1)&&(g=!0),g},ii=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Hm=function(n){return[n.deltaX,n.deltaY]},Km=function(n){return n&&"current"in n?n.current:n},p1=function(n,a){return n[0]===a[0]&&n[1]===a[1]},x1=function(n){return` + .block-interactivity-`.concat(n,` {pointer-events: none;} + .allow-interactivity-`).concat(n,` {pointer-events: all;} +`)},g1=0,_s=[];function v1(n){var a=h.useRef([]),l=h.useRef([0,0]),o=h.useRef(),c=h.useState(g1++)[0],u=h.useState(Jp)[0],f=h.useRef(n);h.useEffect(function(){f.current=n},[n]),h.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(c));var N=zw([n.lockRef.current],(n.shards||[]).map(Km),!0).filter(Boolean);return N.forEach(function(w){return w.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),N.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var p=h.useCallback(function(N,w){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!f.current.allowPinchZoom;var S=ii(N),P=l.current,j="deltaX"in N?N.deltaX:P[0]-S[0],_="deltaY"in N?N.deltaY:P[1]-S[1],B,V=N.target,E=Math.abs(j)>Math.abs(_)?"h":"v";if("touches"in N&&E==="h"&&V.type==="range")return!1;var T=window.getSelection(),z=T&&T.anchorNode,q=z?z===V||z.contains(V):!1;if(q)return!1;var ue=Wm(E,V);if(!ue)return!0;if(ue?B=E:(B=E==="v"?"h":"v",ue=Wm(E,V)),!ue)return!1;if(!o.current&&"changedTouches"in N&&(j||_)&&(o.current=B),!B)return!0;var ee=o.current||B;return m1(ee,w,N,ee==="h"?j:_)},[]),x=h.useCallback(function(N){var w=N;if(!(!_s.length||_s[_s.length-1]!==u)){var S="deltaY"in w?Hm(w):ii(w),P=a.current.filter(function(B){return B.name===w.type&&(B.target===w.target||w.target===B.shadowParent)&&p1(B.delta,S)})[0];if(P&&P.should){w.cancelable&&w.preventDefault();return}if(!P){var j=(f.current.shards||[]).map(Km).filter(Boolean).filter(function(B){return B.contains(w.target)}),_=j.length>0?p(w,j[0]):!f.current.noIsolation;_&&w.cancelable&&w.preventDefault()}}},[]),g=h.useCallback(function(N,w,S,P){var j={name:N,delta:w,target:S,should:P,shadowParent:y1(S)};a.current.push(j),setTimeout(function(){a.current=a.current.filter(function(_){return _!==j})},1)},[]),v=h.useCallback(function(N){l.current=ii(N),o.current=void 0},[]),y=h.useCallback(function(N){g(N.type,Hm(N),N.target,p(N,n.lockRef.current))},[]),k=h.useCallback(function(N){g(N.type,ii(N),N.target,p(N,n.lockRef.current))},[]);h.useEffect(function(){return _s.push(u),n.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:k}),document.addEventListener("wheel",x,Ts),document.addEventListener("touchmove",x,Ts),document.addEventListener("touchstart",v,Ts),function(){_s=_s.filter(function(N){return N!==u}),document.removeEventListener("wheel",x,Ts),document.removeEventListener("touchmove",x,Ts),document.removeEventListener("touchstart",v,Ts)}},[]);var R=n.removeScrollBar,C=n.inert;return h.createElement(h.Fragment,null,C?h.createElement(u,{styles:x1(c)}):null,R?h.createElement(i1,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function y1(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const j1=Yw(Xp,v1);var Gd=h.forwardRef(function(n,a){return h.createElement(Fi,Pr({},n,{ref:a,sideCar:j1}))});Gd.classNames=Fi.classNames;var N1=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},Is=new WeakMap,oi=new WeakMap,ci={},rd=0,rx=function(n){return n&&(n.host||rx(n.parentNode))},b1=function(n,a){return a.map(function(l){if(n.contains(l))return l;var o=rx(l);return o&&n.contains(o)?o:(console.error("aria-hidden",l,"in not contained inside",n,". Doing nothing"),null)}).filter(function(l){return!!l})},w1=function(n,a,l,o){var c=b1(a,Array.isArray(n)?n:[n]);ci[l]||(ci[l]=new WeakMap);var u=ci[l],f=[],p=new Set,x=new Set(c),g=function(y){!y||p.has(y)||(p.add(y),g(y.parentNode))};c.forEach(g);var v=function(y){!y||x.has(y)||Array.prototype.forEach.call(y.children,function(k){if(p.has(k))v(k);else try{var R=k.getAttribute(o),C=R!==null&&R!=="false",N=(Is.get(k)||0)+1,w=(u.get(k)||0)+1;Is.set(k,N),u.set(k,w),f.push(k),N===1&&C&&oi.set(k,!0),w===1&&k.setAttribute(l,"true"),C||k.setAttribute(o,"true")}catch(S){console.error("aria-hidden: cannot operate on ",k,S)}})};return v(a),p.clear(),rd++,function(){f.forEach(function(y){var k=Is.get(y)-1,R=u.get(y)-1;Is.set(y,k),u.set(y,R),k||(oi.has(y)||y.removeAttribute(o),oi.delete(y)),R||y.removeAttribute(l)}),rd--,rd||(Is=new WeakMap,Is=new WeakMap,oi=new WeakMap,ci={})}},nx=function(n,a,l){l===void 0&&(l="data-aria-hidden");var o=Array.from(Array.isArray(n)?n:[n]),c=N1(n);return c?(o.push.apply(o,Array.from(c.querySelectorAll("[aria-live], script"))),w1(o,c,l,"aria-hidden")):function(){return null}},zi="Dialog",[sx]=Rn(zi),[S1,Nr]=sx(zi),ax=n=>{const{__scopeDialog:a,children:l,open:o,defaultOpen:c,onOpenChange:u,modal:f=!0}=n,p=h.useRef(null),x=h.useRef(null),[g,v]=Jn({prop:o,defaultProp:c??!1,onChange:u,caller:zi});return t.jsx(S1,{scope:a,triggerRef:p,contentRef:x,contentId:wn(),titleId:wn(),descriptionId:wn(),open:g,onOpenChange:v,onOpenToggle:h.useCallback(()=>v(y=>!y),[v]),modal:f,children:l})};ax.displayName=zi;var lx="DialogTrigger",C1=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(lx,l),u=Ye(a,c.triggerRef);return t.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":qd(c.open),...o,ref:u,onClick:De(n.onClick,c.onOpenToggle)})});C1.displayName=lx;var Yd="DialogPortal",[k1,ix]=sx(Yd,{forceMount:void 0}),ox=n=>{const{__scopeDialog:a,forceMount:l,children:o,container:c}=n,u=Nr(Yd,a);return t.jsx(k1,{scope:a,forceMount:l,children:h.Children.map(o,f=>t.jsx(Ha,{present:l||u.open,children:t.jsx(Kd,{asChild:!0,container:c,children:f})}))})};ox.displayName=Yd;var Ci="DialogOverlay",cx=h.forwardRef((n,a)=>{const l=ix(Ci,n.__scopeDialog),{forceMount:o=l.forceMount,...c}=n,u=Nr(Ci,n.__scopeDialog);return u.modal?t.jsx(Ha,{present:o||u.open,children:t.jsx(P1,{...c,ref:a})}):null});cx.displayName=Ci;var E1=Ba("DialogOverlay.RemoveScroll"),P1=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(Ci,l);return t.jsx(Gd,{as:E1,allowPinchZoom:!0,shards:[c.contentRef],children:t.jsx(ze.div,{"data-state":qd(c.open),...o,ref:a,style:{pointerEvents:"auto",...o.style}})})}),Zn="DialogContent",dx=h.forwardRef((n,a)=>{const l=ix(Zn,n.__scopeDialog),{forceMount:o=l.forceMount,...c}=n,u=Nr(Zn,n.__scopeDialog);return t.jsx(Ha,{present:o||u.open,children:u.modal?t.jsx(R1,{...c,ref:a}):t.jsx(T1,{...c,ref:a})})});dx.displayName=Zn;var R1=h.forwardRef((n,a)=>{const l=Nr(Zn,n.__scopeDialog),o=h.useRef(null),c=Ye(a,l.contentRef,o);return h.useEffect(()=>{const u=o.current;if(u)return nx(u)},[]),t.jsx(ux,{...n,ref:c,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:De(n.onCloseAutoFocus,u=>{var f;u.preventDefault(),(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:De(n.onPointerDownOutside,u=>{const f=u.detail.originalEvent,p=f.button===0&&f.ctrlKey===!0;(f.button===2||p)&&u.preventDefault()}),onFocusOutside:De(n.onFocusOutside,u=>u.preventDefault())})}),T1=h.forwardRef((n,a)=>{const l=Nr(Zn,n.__scopeDialog),o=h.useRef(!1),c=h.useRef(!1);return t.jsx(ux,{...n,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var f,p;(f=n.onCloseAutoFocus)==null||f.call(n,u),u.defaultPrevented||(o.current||(p=l.triggerRef.current)==null||p.focus(),u.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:u=>{var x,g;(x=n.onInteractOutside)==null||x.call(n,u),u.defaultPrevented||(o.current=!0,u.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const f=u.target;((g=l.triggerRef.current)==null?void 0:g.contains(f))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&c.current&&u.preventDefault()}})}),ux=h.forwardRef((n,a)=>{const{__scopeDialog:l,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:u,...f}=n,p=Nr(Zn,l),x=h.useRef(null),g=Ye(a,x);return Yp(),t.jsxs(t.Fragment,{children:[t.jsx(Hd,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:u,children:t.jsx(Wd,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionId,"aria-labelledby":p.titleId,"data-state":qd(p.open),...f,ref:g,onDismiss:()=>p.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(_1,{titleId:p.titleId}),t.jsx(A1,{contentRef:x,descriptionId:p.descriptionId})]})]})}),Qd="DialogTitle",fx=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(Qd,l);return t.jsx(ze.h2,{id:c.titleId,...o,ref:a})});fx.displayName=Qd;var hx="DialogDescription",mx=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(hx,l);return t.jsx(ze.p,{id:c.descriptionId,...o,ref:a})});mx.displayName=hx;var px="DialogClose",xx=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(px,l);return t.jsx(ze.button,{type:"button",...o,ref:a,onClick:De(n.onClick,()=>c.onOpenChange(!1))})});xx.displayName=px;function qd(n){return n?"open":"closed"}var gx="DialogTitleWarning",[g4,vx]=lw(gx,{contentName:Zn,titleName:Qd,docsSlug:"dialog"}),_1=({titleId:n})=>{const a=vx(gx),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 h.useEffect(()=>{n&&(document.getElementById(n)||console.error(l))},[l,n]),null},I1="DialogDescriptionWarning",A1=({contentRef:n,descriptionId:a})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vx(I1).contentName}}.`;return h.useEffect(()=>{var u;const c=(u=n.current)==null?void 0:u.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(o))},[o,n,a]),null},M1=ax,D1=ox,L1=cx,O1=dx,F1=fx,z1=mx,$1=xx;function Mt(n){return t.jsx(M1,{"data-slot":"dialog",...n})}function B1(n){return t.jsx(D1,{...n})}const yx=h.forwardRef(({className:n,...a},l)=>t.jsx(L1,{ref:l,className:Qe("fixed inset-0 z-50 bg-black/50",n),...a}));yx.displayName="DialogOverlay";const Tt=h.forwardRef(({className:n,children:a,showCloseButton:l=!0,...o},c)=>t.jsxs(B1,{children:[t.jsx(yx,{}),t.jsxs(O1,{ref:c,"aria-describedby":void 0,className:Qe("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",n),...o,children:[a,l&&t.jsxs($1,{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(ir,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Tt.displayName="DialogContent";function Dt({className:n,...a}){return t.jsx("div",{className:Qe("flex flex-col gap-2 text-center sm:text-left",n),...a})}function Kt({className:n,...a}){return t.jsx("div",{className:Qe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...a})}function Lt(n){return t.jsx(F1,{className:"text-lg font-semibold leading-none",...n})}function U1(n){return t.jsx(z1,{className:"text-sm text-muted-foreground",...n})}function Xd(n,a){const[l,o]=h.useState(n);return h.useEffect(()=>{const c=setTimeout(()=>o(n),a);return()=>clearTimeout(c)},[n,a]),l}function Sn({page:n,totalPages:a,total:l,pageSize:o,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:o,onChange:p=>u(Number(p.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:f.map(p=>t.jsxs("option",{value:p,children:[p," 条/页"]},p))})]}),a>1&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>c(1),disabled:n<=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(n-1),disabled:n<=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:[n," / ",a]}),t.jsx("button",{type:"button",onClick:()=>c(n+1),disabled:n>=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:n>=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 V1(){const[n,a]=h.useState([]),[l,o]=h.useState([]),[c,u]=h.useState(0),[f,p]=h.useState(0),[x,g]=h.useState(0),[v,y]=h.useState(1),[k,R]=h.useState(10),[C,N]=h.useState(""),w=Xd(C,300),[S,P]=h.useState("all"),[j,_]=h.useState(!0),[B,V]=h.useState(null),[E,T]=h.useState(null),[z,q]=h.useState(""),[ue,ee]=h.useState(!1);async function ce(){_(!0),V(null);try{const H=S==="all"?"":S==="completed"?"completed":S,I=new URLSearchParams({page:String(v),pageSize:String(k),...H&&{status:H},...w&&{search:w}}),[L,X]=await Promise.all([Ke(`/api/orders?${I}`),Ke("/api/db/users?page=1&pageSize=500")]);L!=null&&L.success&&(a(L.orders||[]),u(L.total??0),p(L.totalRevenue??0),g(L.todayRevenue??0)),X!=null&&X.success&&X.users&&o(X.users)}catch(H){console.error("加载订单失败",H),V("加载订单失败,请检查网络后重试")}finally{_(!1)}}h.useEffect(()=>{y(1)},[w,S]),h.useEffect(()=>{ce()},[v,k,w,S]);const G=H=>{var I;return H.userNickname||((I=l.find(L=>L.id===H.userId))==null?void 0:I.nickname)||"匿名用户"},Z=H=>{var I;return((I=l.find(L=>L.id===H))==null?void 0:I.phone)||"-"},te=H=>{const I=H.productType||H.type||"",L=H.description||"";if(L){if(I==="section"&&L.includes("章节")){if(L.includes("-")){const X=L.split("-");if(X.length>=3)return{name:`第${X[1]}章 第${X[2]}节`,type:"《一场Soul的创业实验》"}}return{name:L,type:"章节购买"}}return I==="fullbook"||L.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:I==="vip"||L.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:I==="match"||L.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:L,type:"其他"}}return I==="section"?{name:`章节 ${H.productId||H.sectionId||""}`,type:"单章"}:I==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:I==="vip"?{name:"VIP年度会员",type:"VIP"}:I==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:I||"其他"}},U=Math.ceil(c/k)||1;async function M(){var H;if(!(!(E!=null&&E.orderSn)&&!(E!=null&&E.id))){ee(!0),V(null);try{const I=await St("/api/admin/orders/refund",{orderSn:E.orderSn||E.id,reason:z||void 0});I!=null&&I.success?(T(null),q(""),ce()):V((I==null?void 0:I.error)||"退款失败")}catch(I){const L=I;V(((H=L==null?void 0:L.data)==null?void 0:H.error)||"退款失败,请检查网络后重试")}finally{ee(!1)}}}function Q(){if(n.length===0){alert("暂无数据可导出");return}const H=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],I=n.map(pe=>{const le=te(pe);return[pe.orderSn||pe.id||"",G(pe),Z(pe.userId),le.name,Number(pe.amount||0).toFixed(2),pe.paymentMethod==="wechat"?"微信支付":pe.paymentMethod==="alipay"?"支付宝":pe.paymentMethod||"微信支付",pe.status==="refunded"?"已退款":pe.status==="paid"||pe.status==="completed"?"已完成":pe.status==="pending"||pe.status==="created"?"待支付":"已失败",pe.status==="refunded"&&pe.refundReason?pe.refundReason:"-",pe.referrerEarnings?Number(pe.referrerEarnings).toFixed(2):"-",pe.createdAt?new Date(pe.createdAt).toLocaleString("zh-CN"):""].join(",")}),L="\uFEFF"+[H.join(","),...I].join(` +`),X=new Blob([L],{type:"text/csv;charset=utf-8"}),ae=URL.createObjectURL(X),ve=document.createElement("a");ve.href=ae,ve.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,ve.click(),URL.revokeObjectURL(ae)}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:()=>V(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:["共 ",n.length," 笔订单"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(ie,{variant:"outline",onClick:ce,disabled:j,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${j?"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(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(se,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:C,onChange:H=>N(H.target.value)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Yj,{className:"w-4 h-4 text-gray-400"}),t.jsxs("select",{value:S,onChange:H=>P(H.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(ie,{variant:"outline",onClick:Q,disabled:n.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Uj,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Te,{className:"p-0",children:j?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{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(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{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(Qr,{children:[n.map(H=>{const I=te(H);return t.jsxs(st,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsxs(ke,{className:"font-mono text-xs text-gray-400",children:[(H.orderSn||H.id||"").slice(0,12),"..."]}),t.jsx(ke,{children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:G(H)}),t.jsx("p",{className:"text-gray-500 text-xs",children:Z(H.userId)})]})}),t.jsx(ke,{children:t.jsxs("div",{children:[t.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[I.name,(H.productType||H.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:I.type})]})}),t.jsxs(ke,{className:"text-[#38bdac] font-bold",children:["¥",Number(H.amount||0).toFixed(2)]}),t.jsx(ke,{className:"text-gray-300",children:H.paymentMethod==="wechat"?"微信支付":H.paymentMethod==="alipay"?"支付宝":H.paymentMethod||"微信支付"}),t.jsx(ke,{children:H.status==="refunded"?t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):H.status==="paid"||H.status==="completed"?t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):H.status==="pending"||H.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(ke,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:H.refundReason,children:H.status==="refunded"&&H.refundReason?H.refundReason:"-"}),t.jsx(ke,{className:"text-[#FFD700]",children:H.referrerEarnings?`¥${Number(H.referrerEarnings).toFixed(2)}`:"-"}),t.jsx(ke,{className:"text-gray-400 text-sm",children:new Date(H.createdAt).toLocaleString("zh-CN")}),t.jsx(ke,{children:(H.status==="paid"||H.status==="completed")&&t.jsxs(ie,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{T(H),q("")},children:[t.jsx(kp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},H.id)}),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),t.jsx(Sn,{page:v,totalPages:U,total:c,pageSize:k,onPageChange:y,onPageSizeChange:H=>{R(H),y(1)}})]})})}),t.jsx(Mt,{open:!!E,onOpenChange:H=>!H&&T(null),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:"订单退款"})}),E&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",E.orderSn||E.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(E.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(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:z,onChange:H=>q(H.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>T(null),disabled:ue,children:"取消"}),t.jsx(ie,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:M,disabled:ue,children:ue?"退款中...":"确认退款"})]})]})})]})}var W1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],H1=W1.reduce((n,a)=>{const l=Pp(`Primitive.${a}`),o=h.forwardRef((c,u)=>{const{asChild:f,...p}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...p,ref:u})});return o.displayName=`Primitive.${a}`,{...n,[a]:o}},{}),K1="Label",jx=h.forwardRef((n,a)=>t.jsx(H1.label,{...n,ref:a,onMouseDown:l=>{var c;l.target.closest("button, input, select, textarea")||((c=n.onMouseDown)==null||c.call(n,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}}));jx.displayName=K1;var Nx=jx;const J=h.forwardRef(({className:n,...a},l)=>t.jsx(Nx,{ref:l,className:Qe("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",n),...a}));J.displayName=Nx.displayName;function Jd(n){const a=h.useRef({value:n,previous:n});return h.useMemo(()=>(a.current.value!==n&&(a.current.previous=a.current.value,a.current.value=n),a.current.previous),[n])}function Zd(n){const[a,l]=h.useState(void 0);return _t(()=>{if(n){l({width:n.offsetWidth,height:n.offsetHeight});const o=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const u=c[0];let f,p;if("borderBoxSize"in u){const x=u.borderBoxSize,g=Array.isArray(x)?x[0]:x;f=g.inlineSize,p=g.blockSize}else f=n.offsetWidth,p=n.offsetHeight;l({width:f,height:p})});return o.observe(n,{box:"border-box"}),()=>o.unobserve(n)}else l(void 0)},[n]),a}var $i="Switch",[G1]=Rn($i),[Y1,Q1]=G1($i),bx=h.forwardRef((n,a)=>{const{__scopeSwitch:l,name:o,checked:c,defaultChecked:u,required:f,disabled:p,value:x="on",onCheckedChange:g,form:v,...y}=n,[k,R]=h.useState(null),C=Ye(a,j=>R(j)),N=h.useRef(!1),w=k?v||!!k.closest("form"):!0,[S,P]=Jn({prop:c,defaultProp:u??!1,onChange:g,caller:$i});return t.jsxs(Y1,{scope:l,checked:S,disabled:p,children:[t.jsx(ze.button,{type:"button",role:"switch","aria-checked":S,"aria-required":f,"data-state":kx(S),"data-disabled":p?"":void 0,disabled:p,value:x,...y,ref:C,onClick:De(n.onClick,j=>{P(_=>!_),w&&(N.current=j.isPropagationStopped(),N.current||j.stopPropagation())})}),w&&t.jsx(Cx,{control:k,bubbles:!N.current,name:o,value:x,checked:S,required:f,disabled:p,form:v,style:{transform:"translateX(-100%)"}})]})});bx.displayName=$i;var wx="SwitchThumb",Sx=h.forwardRef((n,a)=>{const{__scopeSwitch:l,...o}=n,c=Q1(wx,l);return t.jsx(ze.span,{"data-state":kx(c.checked),"data-disabled":c.disabled?"":void 0,...o,ref:a})});Sx.displayName=wx;var q1="SwitchBubbleInput",Cx=h.forwardRef(({__scopeSwitch:n,control:a,checked:l,bubbles:o=!0,...c},u)=>{const f=h.useRef(null),p=Ye(f,u),x=Jd(l),g=Zd(a);return h.useEffect(()=>{const v=f.current;if(!v)return;const y=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(y,"checked").set;if(x!==l&&R){const C=new Event("click",{bubbles:o});R.call(v,l),v.dispatchEvent(C)}},[x,l,o]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:l,...c,tabIndex:-1,ref:p,style:{...c.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Cx.displayName=q1;function kx(n){return n?"checked":"unchecked"}var Ex=bx,X1=Sx;const ht=h.forwardRef(({className:n,...a},l)=>t.jsx(Ex,{className:Qe("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]",n),...a,ref:l,children:t.jsx(X1,{className:Qe("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")})}));ht.displayName=Ex.displayName;function eu(n){const a=n+"CollectionProvider",[l,o]=Rn(a),[c,u]=l(a,{collectionRef:{current:null},itemMap:new Map}),f=N=>{const{scope:w,children:S}=N,P=vn.useRef(null),j=vn.useRef(new Map).current;return t.jsx(c,{scope:w,itemMap:j,collectionRef:P,children:S})};f.displayName=a;const p=n+"CollectionSlot",x=Ba(p),g=vn.forwardRef((N,w)=>{const{scope:S,children:P}=N,j=u(p,S),_=Ye(w,j.collectionRef);return t.jsx(x,{ref:_,children:P})});g.displayName=p;const v=n+"CollectionItemSlot",y="data-radix-collection-item",k=Ba(v),R=vn.forwardRef((N,w)=>{const{scope:S,children:P,...j}=N,_=vn.useRef(null),B=Ye(w,_),V=u(v,S);return vn.useEffect(()=>(V.itemMap.set(_,{ref:_,...j}),()=>void V.itemMap.delete(_))),t.jsx(k,{[y]:"",ref:B,children:P})});R.displayName=v;function C(N){const w=u(n+"CollectionConsumer",N);return vn.useCallback(()=>{const P=w.collectionRef.current;if(!P)return[];const j=Array.from(P.querySelectorAll(`[${y}]`));return Array.from(w.itemMap.values()).sort((V,E)=>j.indexOf(V.ref.current)-j.indexOf(E.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:f,Slot:g,ItemSlot:R},C,o]}var J1=h.createContext(void 0);function Bi(n){const a=h.useContext(J1);return n||a||"ltr"}var nd="rovingFocusGroup.onEntryFocus",Z1={bubbles:!1,cancelable:!0},Ka="RovingFocusGroup",[Nd,Px,e2]=eu(Ka),[t2,Rx]=Rn(Ka,[e2]),[r2,n2]=t2(Ka),Tx=h.forwardRef((n,a)=>t.jsx(Nd.Provider,{scope:n.__scopeRovingFocusGroup,children:t.jsx(Nd.Slot,{scope:n.__scopeRovingFocusGroup,children:t.jsx(s2,{...n,ref:a})})}));Tx.displayName=Ka;var s2=h.forwardRef((n,a)=>{const{__scopeRovingFocusGroup:l,orientation:o,loop:c=!1,dir:u,currentTabStopId:f,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:x,onEntryFocus:g,preventScrollOnEntryFocus:v=!1,...y}=n,k=h.useRef(null),R=Ye(a,k),C=Bi(u),[N,w]=Jn({prop:f,defaultProp:p??null,onChange:x,caller:Ka}),[S,P]=h.useState(!1),j=Cn(g),_=Px(l),B=h.useRef(!1),[V,E]=h.useState(0);return h.useEffect(()=>{const T=k.current;if(T)return T.addEventListener(nd,j),()=>T.removeEventListener(nd,j)},[j]),t.jsx(r2,{scope:l,orientation:o,dir:C,loop:c,currentTabStopId:N,onItemFocus:h.useCallback(T=>w(T),[w]),onItemShiftTab:h.useCallback(()=>P(!0),[]),onFocusableItemAdd:h.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:h.useCallback(()=>E(T=>T-1),[]),children:t.jsx(ze.div,{tabIndex:S||V===0?-1:0,"data-orientation":o,...y,ref:R,style:{outline:"none",...n.style},onMouseDown:De(n.onMouseDown,()=>{B.current=!0}),onFocus:De(n.onFocus,T=>{const z=!B.current;if(T.target===T.currentTarget&&z&&!S){const q=new CustomEvent(nd,Z1);if(T.currentTarget.dispatchEvent(q),!q.defaultPrevented){const ue=_().filter(te=>te.focusable),ee=ue.find(te=>te.active),ce=ue.find(te=>te.id===N),Z=[ee,ce,...ue].filter(Boolean).map(te=>te.ref.current);Ax(Z,v)}}B.current=!1}),onBlur:De(n.onBlur,()=>P(!1))})})}),_x="RovingFocusGroupItem",Ix=h.forwardRef((n,a)=>{const{__scopeRovingFocusGroup:l,focusable:o=!0,active:c=!1,tabStopId:u,children:f,...p}=n,x=wn(),g=u||x,v=n2(_x,l),y=v.currentTabStopId===g,k=Px(l),{onFocusableItemAdd:R,onFocusableItemRemove:C,currentTabStopId:N}=v;return h.useEffect(()=>{if(o)return R(),()=>C()},[o,R,C]),t.jsx(Nd.ItemSlot,{scope:l,id:g,focusable:o,active:c,children:t.jsx(ze.span,{tabIndex:y?0:-1,"data-orientation":v.orientation,...p,ref:a,onMouseDown:De(n.onMouseDown,w=>{o?v.onItemFocus(g):w.preventDefault()}),onFocus:De(n.onFocus,()=>v.onItemFocus(g)),onKeyDown:De(n.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){v.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const S=i2(w,v.orientation,v.dir);if(S!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let j=k().filter(_=>_.focusable).map(_=>_.ref.current);if(S==="last")j.reverse();else if(S==="prev"||S==="next"){S==="prev"&&j.reverse();const _=j.indexOf(w.currentTarget);j=v.loop?o2(j,_+1):j.slice(_+1)}setTimeout(()=>Ax(j))}}),children:typeof f=="function"?f({isCurrentTabStop:y,hasTabStop:N!=null}):f})})});Ix.displayName=_x;var a2={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function l2(n,a){return a!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function i2(n,a,l){const o=l2(n.key,l);if(!(a==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(a==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return a2[o]}function Ax(n,a=!1){const l=document.activeElement;for(const o of n)if(o===l||(o.focus({preventScroll:a}),document.activeElement!==l))return}function o2(n,a){return n.map((l,o)=>n[(a+o)%n.length])}var c2=Tx,d2=Ix,Ui="Tabs",[u2]=Rn(Ui,[Rx]),Mx=Rx(),[f2,tu]=u2(Ui),Dx=h.forwardRef((n,a)=>{const{__scopeTabs:l,value:o,onValueChange:c,defaultValue:u,orientation:f="horizontal",dir:p,activationMode:x="automatic",...g}=n,v=Bi(p),[y,k]=Jn({prop:o,onChange:c,defaultProp:u??"",caller:Ui});return t.jsx(f2,{scope:l,baseId:wn(),value:y,onValueChange:k,orientation:f,dir:v,activationMode:x,children:t.jsx(ze.div,{dir:v,"data-orientation":f,...g,ref:a})})});Dx.displayName=Ui;var Lx="TabsList",Ox=h.forwardRef((n,a)=>{const{__scopeTabs:l,loop:o=!0,...c}=n,u=tu(Lx,l),f=Mx(l);return t.jsx(c2,{asChild:!0,...f,orientation:u.orientation,dir:u.dir,loop:o,children:t.jsx(ze.div,{role:"tablist","aria-orientation":u.orientation,...c,ref:a})})});Ox.displayName=Lx;var Fx="TabsTrigger",zx=h.forwardRef((n,a)=>{const{__scopeTabs:l,value:o,disabled:c=!1,...u}=n,f=tu(Fx,l),p=Mx(l),x=Ux(f.baseId,o),g=Vx(f.baseId,o),v=o===f.value;return t.jsx(d2,{asChild:!0,...p,focusable:!c,active:v,children:t.jsx(ze.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":g,"data-state":v?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:x,...u,ref:a,onMouseDown:De(n.onMouseDown,y=>{!c&&y.button===0&&y.ctrlKey===!1?f.onValueChange(o):y.preventDefault()}),onKeyDown:De(n.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&f.onValueChange(o)}),onFocus:De(n.onFocus,()=>{const y=f.activationMode!=="manual";!v&&!c&&y&&f.onValueChange(o)})})})});zx.displayName=Fx;var $x="TabsContent",Bx=h.forwardRef((n,a)=>{const{__scopeTabs:l,value:o,forceMount:c,children:u,...f}=n,p=tu($x,l),x=Ux(p.baseId,o),g=Vx(p.baseId,o),v=o===p.value,y=h.useRef(v);return h.useEffect(()=>{const k=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(k)},[]),t.jsx(Ha,{present:c||v,children:({present:k})=>t.jsx(ze.div,{"data-state":v?"active":"inactive","data-orientation":p.orientation,role:"tabpanel","aria-labelledby":x,hidden:!k,id:g,tabIndex:0,...f,ref:a,style:{...n.style,animationDuration:y.current?"0s":void 0},children:k&&u})})});Bx.displayName=$x;function Ux(n,a){return`${n}-trigger-${a}`}function Vx(n,a){return`${n}-content-${a}`}var h2=Dx,Wx=Ox,Hx=zx,Kx=Bx;const ru=h2,Vi=h.forwardRef(({className:n,...a},l)=>t.jsx(Wx,{ref:l,className:Qe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",n),...a}));Vi.displayName=Wx.displayName;const ar=h.forwardRef(({className:n,...a},l)=>t.jsx(Hx,{ref:l,className:Qe("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",n),...a}));ar.displayName=Hx.displayName;const lr=h.forwardRef(({className:n,...a},l)=>t.jsx(Kx,{ref:l,className:Qe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...a}));lr.displayName=Kx.displayName;function m2({open:n,onClose:a,userId:l,onUserUpdated:o}){var te;const[c,u]=h.useState(null),[f,p]=h.useState([]),[x,g]=h.useState([]),[v,y]=h.useState(!1),[k,R]=h.useState(!1),[C,N]=h.useState(!1),[w,S]=h.useState("info"),[P,j]=h.useState(""),[_,B]=h.useState(""),[V,E]=h.useState([]),[T,z]=h.useState("");h.useEffect(()=>{n&&l&&q()},[n,l]);async function q(){if(l){y(!0);try{const U=await Ke(`/api/db/users?id=${encodeURIComponent(l)}`);if(U!=null&&U.success&&U.user){const M=U.user;u(M),j(M.phone||""),B(M.nickname||""),E(typeof M.tags=="string"?JSON.parse(M.tags||"[]"):[])}try{const M=await Ke(`/api/user/track?userId=${encodeURIComponent(l)}&limit=50`);M!=null&&M.success&&M.tracks&&p(M.tracks)}catch{p([])}try{const M=await Ke(`/api/db/users/referrals?userId=${encodeURIComponent(l)}`);M!=null&&M.success&&M.referrals&&g(M.referrals)}catch{g([])}}catch(U){console.error("Load user detail error:",U)}finally{y(!1)}}}async function ue(){if(!(c!=null&&c.phone)){alert("用户未绑定手机号,无法同步");return}R(!0);try{const U=await jt("/api/ckb/sync",{action:"full_sync",phone:c.phone,userId:c.id});U!=null&&U.success?(alert("同步成功"),q()):alert("同步失败: "+(U==null?void 0:U.error))}catch(U){console.error("Sync CKB error:",U),alert("同步失败")}finally{R(!1)}}async function ee(){if(c){N(!0);try{const U={id:c.id,phone:P||void 0,nickname:_||void 0,tags:JSON.stringify(V)},M=await St("/api/db/users",U);M!=null&&M.success?(alert("保存成功"),q(),o==null||o()):alert("保存失败: "+(M==null?void 0:M.error))}catch(U){console.error("Save user error:",U),alert("保存失败")}finally{N(!1)}}}const ce=()=>{T&&!V.includes(T)&&(E([...V,T]),z(""))},G=U=>{E(V.filter(M=>M!==U))},Z=U=>{const Q={view_chapter:Vr,purchase:pd,match:vr,login:qn,register:qn,share:Yn,bind_phone:RN,bind_wechat:bN}[U]||Nm;return t.jsx(Q,{className:"w-4 h-4"})};return n?t.jsx(Mt,{open:n,onOpenChange:()=>a(),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(qn,{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:"已绑定手机"})]})}),v?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(Ze,{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:""}):((te=c.nickname)==null?void 0:te.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(ru,{value:w,onValueChange:S,className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs(Vi,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-4",children:[t.jsx(ar,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"基础信息"}),t.jsx(ar,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"标签体系"}),t.jsx(ar,{value:"tracks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"行为轨迹"}),t.jsx(ar,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"关系链路"})]}),t.jsxs(lr,{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(J,{className:"text-gray-300",children:"手机号"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:P,onChange:U=>j(U.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"昵称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:_,onChange:U=>B(U.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(Yn,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),t.jsx(ie,{size:"sm",onClick:ue,disabled:k||!c.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Ze,{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(lr,{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(UN,{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:[V.map((U,M)=>t.jsxs(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[U,t.jsx("button",{type:"button",onClick:()=>G(U),className:"ml-1 hover:text-red-400",children:t.jsx(ir,{className:"w-3 h-3"})})]},M)),V.length===0&&t.jsx("span",{className:"text-gray-500 text-sm",children:"暂无标签"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(se,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"添加新标签",value:T,onChange:U=>z(U.target.value),onKeyDown:U=>U.key==="Enter"&&ce()}),t.jsx(ie,{onClick:ce,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})}),t.jsx(lr,{value:"tracks",className:"flex-1 overflow-auto",children:t.jsx("div",{className:"space-y-2",children:f.length>0?f.map(U=>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:Z(U.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:U.actionLabel}),U.chapterTitle&&t.jsxs("span",{className:"text-gray-400 text-sm",children:["- ",U.chapterTitle]})]}),t.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:[t.jsx(wp,{className:"w-3 h-3 inline mr-1"}),U.timeAgo," · ",new Date(U.createdAt).toLocaleString()]})]})]},U.id)):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Nm,{className:"w-10 h-10 text-[#38bdac]/40 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-400",children:"暂无行为轨迹"})]})})}),t.jsx(lr,{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(Yn,{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((U,M)=>{var H;const Q=U;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:((H=Q.nickname)==null?void 0:H.charAt(0))||"?"}),t.jsx("span",{className:"text-white text-sm",children:Q.nickname})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[Q.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:Q.createdAt?new Date(Q.createdAt).toLocaleDateString():""})]})]},Q.id||M)}):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(ie,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"关闭"]}),t.jsxs(ie,{onClick:ee,disabled:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),C?"保存中...":"保存修改"]})]})]}):t.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}const sd={isVip:!1,vipExpireDate:"",vipSort:"",vipRole:"",vipRoleCustom:"",vipName:"",vipProject:"",vipContact:"",vipBio:""};function p2({open:n,onClose:a,userId:l,userNickname:o="",onSaved:c}){const[u,f]=h.useState(sd),[p,x]=h.useState([]),[g,v]=h.useState(!1),[y,k]=h.useState(!1);h.useEffect(()=>{if(!n){f(sd);return}let C=!1;return v(!0),Promise.all([Ke("/api/db/vip-roles"),l?Ke(`/api/db/users?id=${encodeURIComponent(l)}`):Promise.resolve(null)]).then(([N,w])=>{if(C)return;const S=N!=null&&N.success&&N.data?N.data:[];x(S);const P=w&&w.user?w.user:null;if(P){const j=String(P.vipRole??""),_=S.some(B=>B.name===j);f({isVip:!!(P.isVip??!1),vipExpireDate:P.vipExpireDate?String(P.vipExpireDate).slice(0,10):"",vipSort:typeof P.vipSort=="number"?P.vipSort:"",vipRole:_?j:j?"__custom__":"",vipRoleCustom:_?"":j,vipName:String(P.vipName??""),vipProject:String(P.vipProject??""),vipContact:String(P.vipContact??""),vipBio:String(P.vipBio??"")})}else f(sd)}).catch(N=>{C||console.error("Load error:",N)}).finally(()=>{C||v(!1)}),()=>{C=!0}},[n,l]);async function R(){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}}k(!0);try{const C=u.vipRole==="__custom__"?u.vipRoleCustom.trim():u.vipRole,N={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},w=await St("/api/db/users",N);w!=null&&w.success?(alert("VIP 设置已保存"),c==null||c(),a()):alert("保存失败: "+(w==null?void 0:w.error))}catch(C){console.error("Save VIP error:",C),alert("保存失败")}finally{k(!1)}}}return n?t.jsx(Mt,{open:n,onOpenChange:()=>a(),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(Li,{className:"w-5 h-5 text-amber-400"}),"设置 VIP - ",o||l]})}),g?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(J,{className:"text-gray-300",children:"VIP 会员"}),t.jsx(ht,{checked:u.isVip,onCheckedChange:C=>f(N=>({...N,isVip:C}))})]}),u.isVip&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300",children:["到期日 (YYYY-MM-DD) ",t.jsx("span",{className:"text-amber-400",children:"*"})]}),t.jsx(se,{type:"date",className:"bg-[#0a1628] border-gray-700 text-white",value:u.vipExpireDate,onChange:C=>f(N=>({...N,vipExpireDate:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"排序"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"数字越小越靠前,留空按时间",value:u.vipSort===""?"":u.vipSort,onChange:C=>{const N=C.target.value;f(w=>({...w,vipSort:N===""?"":parseInt(N,10)||0}))}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{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(N=>({...N,vipRole:C.target.value})),children:[t.jsx("option",{value:"",children:"请选择或下方手动填写"}),p.map(C=>t.jsx("option",{value:C.name,children:C.name},C.id)),t.jsx("option",{value:"__custom__",children:"其他(手动填写)"})]}),u.vipRole==="__custom__"&&t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"输入自定义角色",value:u.vipRoleCustom,onChange:C=>f(N=>({...N,vipRoleCustom:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"VIP 展示名"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创业老板排行展示名",value:u.vipName,onChange:C=>f(N=>({...N,vipName:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"项目/公司"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"项目名称",value:u.vipProject,onChange:C=>f(N=>({...N,vipProject:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"联系方式"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"微信号或手机",value:u.vipContact,onChange:C=>f(N=>({...N,vipContact:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"一句话简介"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"简要描述业务",value:u.vipBio,onChange:C=>f(N=>({...N,vipBio:C.target.value}))})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:R,disabled:y||g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),y?"保存中...":"保存"]})]})]})}):null}function x2(){var ss,Qs,qs,Xs,Js;const[n,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f,p]=h.useState(10),[x,g]=h.useState(""),v=Xd(x,300),[y,k]=h.useState("all"),[R,C]=h.useState(!0),[N,w]=h.useState(null),[S,P]=h.useState(!1),[j,_]=h.useState(!1),[B,V]=h.useState(null),[E,T]=h.useState(""),[z,q]=h.useState(""),[ue,ee]=h.useState(!1),[ce,G]=h.useState(!1),[Z,te]=h.useState({referrals:[],stats:{}}),[U,M]=h.useState(!1),[Q,H]=h.useState(null),[I,L]=h.useState(!1),[X,ae]=h.useState(null),[ve,pe]=h.useState(!1),[le,ye]=h.useState(null),[D,fe]=h.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1});async function F(){C(!0),w(null);try{const ne=new URLSearchParams({page:String(c),pageSize:String(f),search:v,...y==="vip"&&{vip:"true"}}),We=await Ke(`/api/db/users?${ne}`);We!=null&&We.success?(a(We.users||[]),o(We.total??0)):w((We==null?void 0:We.error)||"加载失败")}catch(ne){console.error("Load users error:",ne),w("网络错误,请检查连接")}finally{C(!1)}}h.useEffect(()=>{u(1)},[v,y]),h.useEffect(()=>{F()},[c,f,v,y]);const re=Math.ceil(l/f)||1;async function je(ne){if(confirm("确定要删除这个用户吗?"))try{const We=await zs(`/api/db/users?id=${encodeURIComponent(ne)}`);We!=null&&We.success?F():alert("删除失败: "+((We==null?void 0:We.error)||"未知错误"))}catch(We){console.error("Delete user error:",We),alert("删除失败")}}const xe=ne=>{V(ne),fe({phone:ne.phone||"",nickname:ne.nickname||"",password:"",isAdmin:!!(ne.isAdmin??!1),hasFullBook:!!(ne.hasFullBook??!1)}),P(!0)},Oe=()=>{V(null),fe({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),P(!0)};async function Xe(){if(!D.phone||!D.nickname){alert("请填写手机号和昵称");return}ee(!0);try{if(B){const ne=await St("/api/db/users",{id:B.id,nickname:D.nickname,isAdmin:D.isAdmin,hasFullBook:D.hasFullBook,...D.password&&{password:D.password}});if(!(ne!=null&&ne.success)){alert("更新失败: "+((ne==null?void 0:ne.error)||"未知错误"));return}}else{const ne=await jt("/api/db/users",{phone:D.phone,nickname:D.nickname,password:D.password,isAdmin:D.isAdmin});if(!(ne!=null&&ne.success)){alert("创建失败: "+((ne==null?void 0:ne.error)||"未知错误"));return}}P(!1),F()}catch(ne){console.error("Save user error:",ne),alert("保存失败")}finally{ee(!1)}}const Be=ne=>{V(ne),T(""),q(""),_(!0)};async function Ct(ne){H(ne),G(!0),M(!0);try{const We=await Ke(`/api/db/users/referrals?userId=${encodeURIComponent(ne.id)}`);We!=null&&We.success?te({referrals:We.referrals||[],stats:We.stats||{}}):te({referrals:[],stats:{}})}catch(We){console.error("Load referrals error:",We),te({referrals:[],stats:{}})}finally{M(!1)}}const Ft=ne=>{ae(ne.id),L(!0)},In=ne=>{ye(ne),pe(!0)};async function qr(){if(!E){alert("请输入新密码");return}if(E!==z){alert("两次输入的密码不一致");return}if(E.length<6){alert("密码长度不能少于6位");return}ee(!0);try{const ne=await St("/api/db/users",{id:B==null?void 0:B.id,password:E});ne!=null&&ne.success?(alert("密码修改成功"),_(!1)):alert("密码修改失败: "+((ne==null?void 0:ne.error)||"未知错误"))}catch(ne){console.error("Change password error:",ne),alert("密码修改失败")}finally{ee(!1)}}return t.jsxs("div",{className:"p-8 w-full",children:[N&&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:N}),t.jsx("button",{type:"button",onClick:()=>w(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," 位注册用户",y==="vip"&&",当前筛选 VIP"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(ie,{variant:"outline",onClick:F,disabled:R,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${R?"animate-spin":""}`}),"刷新"]}),t.jsxs("select",{value:y,onChange:ne=>{k(ne.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(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(se,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-64",value:x,onChange:ne=>g(ne.target.value)})]}),t.jsxs(ie,{onClick:Oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Cm,{className:"w-4 h-4 mr-2"}),"添加用户"]})]})]}),t.jsx(Mt,{open:S,onOpenChange:P,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[B?t.jsx(Ht,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(Cm,{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(J,{className:"text-gray-300",children:"手机号"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:D.phone,onChange:ne=>fe({...D,phone:ne.target.value}),disabled:!!B})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"昵称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:D.nickname,onChange:ne=>fe({...D,nickname:ne.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:B?"新密码 (留空则不修改)":"密码"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:B?"留空则不修改":"请输入密码",value:D.password,onChange:ne=>fe({...D,password:ne.target.value})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(J,{className:"text-gray-300",children:"管理员权限"}),t.jsx(ht,{checked:D.isAdmin,onCheckedChange:ne=>fe({...D,isAdmin:ne})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(J,{className:"text-gray-300",children:"已购全书"}),t.jsx(ht,{checked:D.hasFullBook,onCheckedChange:ne=>fe({...D,hasFullBook:ne})})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>P(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:Xe,disabled:ue,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),ue?"保存中...":"保存"]})]})]})}),t.jsx(Mt,{open:j,onOpenChange:_,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(bm,{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(J,{className:"text-gray-300",children:"新密码"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入新密码 (至少6位)",value:E,onChange:ne=>T(ne.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"确认密码"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请再次输入新密码",value:z,onChange:ne=>q(ne.target.value)})]})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",onClick:()=>_(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(ie,{onClick:qr,disabled:ue,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ue?"保存中...":"确认修改"})]})]})}),t.jsx(m2,{open:I,onClose:()=>L(!1),userId:X,onUserUpdated:F}),t.jsx(p2,{open:ve,onClose:()=>{pe(!1),ye(null)},userId:(le==null?void 0:le.id)??null,userNickname:le==null?void 0:le.nickname,onSaved:F}),t.jsx(Mt,{open:ce,onOpenChange:G,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(vr,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系详情 - ",Q==null?void 0:Q.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:((ss=Z.stats)==null?void 0:ss.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:((Qs=Z.stats)==null?void 0:Qs.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:["¥",(((qs=Z.stats)==null?void 0:qs.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:["¥",(((Xs=Z.stats)==null?void 0:Xs.pendingEarnings)||0).toFixed(2)]}),t.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),U?t.jsxs("div",{className:"flex items-center justify-center py-8",children:[t.jsx(Ze,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Js=Z.referrals)==null?void 0:Js.length)??0)>0?t.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(Z.referrals??[]).map((ne,We)=>{var or;const Nt=ne;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:((or=Nt.nickname)==null?void 0:or.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white text-sm",children:Nt.nickname}),t.jsx("div",{className:"text-xs text-gray-500",children:Nt.phone||(Nt.hasOpenId?"微信用户":"未绑定")})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[Nt.status==="vip"&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Nt.status==="paid"&&t.jsxs(Le,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Nt.purchasedSections,"章"]}),Nt.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:Nt.createdAt?new Date(Nt.createdAt).toLocaleDateString():""})]})]},Nt.id||We)})}):t.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),t.jsx(Kt,{children:t.jsx(ie,{variant:"outline",onClick:()=>G(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Te,{className:"p-0",children:R?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{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(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{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(Qr,{children:[n.map(ne=>{var We,Nt,or;return t.jsxs(st,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(ke,{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:ne.avatar?t.jsx("img",{src:ne.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((We=ne.nickname)==null?void 0:We.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:ne.nickname}),ne.isAdmin&&t.jsx(Le,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),ne.openId&&!((Nt=ne.id)!=null&&Nt.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:ne.openId?ne.openId.slice(0,12)+"...":(or=ne.id)==null?void 0:or.slice(0,12)})]})]})}),t.jsx(ke,{children:t.jsxs("div",{className:"space-y-1",children:[ne.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:ne.phone})]}),ne.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:ne.wechatId})]}),ne.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:ne.openId,children:[ne.openId.slice(0,12),"..."]})]}),!ne.phone&&!ne.wechatId&&!ne.openId&&t.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),t.jsx(ke,{children:ne.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(ke,{children:t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(ne.earnings||0)).toFixed(2)]}),parseFloat(String(ne.pendingEarnings||0))>0&&t.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(ne.pendingEarnings||0)).toFixed(2)]}),t.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Ct(ne),onKeyDown:An=>An.key==="Enter"&&Ct(ne),role:"button",tabIndex:0,children:[t.jsx(vr,{className:"w-3 h-3"}),"绑定",ne.referralCount||0,"人"]})]})}),t.jsx(ke,{children:t.jsx("code",{className:"text-[#38bdac] text-xs bg-[#38bdac]/10 px-2 py-0.5 rounded",children:ne.referralCode||"-"})}),t.jsx(ke,{className:"text-gray-400",children:ne.createdAt?new Date(ne.createdAt).toLocaleDateString():"-"}),t.jsx(ke,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>In(ne),className:"text-gray-400 hover:text-amber-400 hover:bg-amber-400/10",title:"设置 VIP",children:t.jsx(Li,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>Ft(ne),className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"查看详情",children:t.jsx(Ms,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>xe(ne),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>Be(ne),className:"text-gray-400 hover:text-yellow-400 hover:bg-yellow-400/10",title:"修改密码",children:t.jsx(bm,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>je(ne.id),title:"删除",children:t.jsx(Er,{className:"w-4 h-4"})})]})})]},ne.id)}),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),t.jsx(Sn,{page:c,totalPages:re,total:l,pageSize:f,onPageChange:u,onPageSizeChange:ne=>{p(ne),u(1)}})]})})})]})}function g2(){const[n,a]=h.useState("overview"),[l,o]=h.useState([]),[c,u]=h.useState(null),[f,p]=h.useState([]),[x,g]=h.useState([]),[v,y]=h.useState([]),[k,R]=h.useState(!0),[C,N]=h.useState(null),[w,S]=h.useState(""),[P,j]=h.useState("all"),[_,B]=h.useState(1),[V,E]=h.useState(10),[T,z]=h.useState(0),[q,ue]=h.useState(new Set),[ee,ce]=h.useState(null),[G,Z]=h.useState(""),[te,U]=h.useState(!1);h.useEffect(()=>{M()},[]),h.useEffect(()=>{B(1)},[n,P]),h.useEffect(()=>{Q(n)},[n]),h.useEffect(()=>{["orders","bindings","withdrawals"].includes(n)&&Q(n,!0)},[_,V,P,w]);async function M(){N(null);try{const D=await Ke("/api/admin/distribution/overview");D!=null&&D.success&&D.overview&&u(D.overview)}catch(D){console.error("[Admin] 概览接口异常:",D),N("加载概览失败")}try{const D=await Ke("/api/db/users");y((D==null?void 0:D.users)||[])}catch(D){console.error("[Admin] 用户数据加载失败:",D)}}async function Q(D,fe=!1){var F;if(!(!fe&&q.has(D))){R(!0);try{const re=v;switch(D){case"overview":break;case"orders":{try{const je=new URLSearchParams({page:String(_),pageSize:String(V),...P!=="all"&&{status:P},...w&&{search:w}}),xe=await Ke(`/api/orders?${je}`);if(xe!=null&&xe.success&&xe.orders){const Oe=xe.orders.map(Xe=>{const Be=re.find(Ft=>Ft.id===Xe.userId),Ct=Xe.referrerId?re.find(Ft=>Ft.id===Xe.referrerId):null;return{...Xe,amount:parseFloat(String(Xe.amount))||0,userNickname:(Be==null?void 0:Be.nickname)||Xe.userNickname||"未知用户",userPhone:(Be==null?void 0:Be.phone)||Xe.userPhone||"-",referrerNickname:(Ct==null?void 0:Ct.nickname)||null,referrerCode:(Ct==null?void 0:Ct.referralCode)??null,type:Xe.productType||Xe.type}});o(Oe),z(xe.total??Oe.length)}else o([]),z(0)}catch(je){console.error(je),N("加载订单失败"),o([])}break}case"bindings":{try{const je=new URLSearchParams({page:String(_),pageSize:String(V),...P!=="all"&&{status:P}}),xe=await Ke(`/api/db/distribution?${je}`);p((xe==null?void 0:xe.bindings)||[]),z((xe==null?void 0:xe.total)??((F=xe==null?void 0:xe.bindings)==null?void 0:F.length)??0)}catch(je){console.error(je),N("加载绑定数据失败"),p([])}break}case"withdrawals":{try{const je=P==="completed"?"success":P==="rejected"?"failed":P,xe=new URLSearchParams({...je&&je!=="all"&&{status:je},page:String(_),pageSize:String(V)}),Oe=await Ke(`/api/admin/withdrawals?${xe}`);if(Oe!=null&&Oe.success&&Oe.withdrawals){const Xe=Oe.withdrawals.map(Be=>({...Be,account:Be.account??"未绑定微信号",status:Be.status==="success"?"completed":Be.status==="failed"?"rejected":Be.status}));g(Xe),z((Oe==null?void 0:Oe.total)??Xe.length)}else Oe!=null&&Oe.success||N(`获取提现记录失败: ${(Oe==null?void 0:Oe.error)||"未知错误"}`),g([])}catch(je){console.error(je),N("加载提现数据失败"),g([])}break}}ue(je=>new Set(je).add(D))}catch(re){console.error(re)}finally{R(!1)}}}async function H(){N(null),ue(D=>{const fe=new Set(D);return fe.delete(n),fe}),n==="overview"&&M(),await Q(n,!0)}async function I(D){if(confirm("确认审核通过并打款?"))try{const fe=await St("/api/admin/withdrawals",{id:D,action:"approve"});if(!(fe!=null&&fe.success)){const F=(fe==null?void 0:fe.message)||(fe==null?void 0:fe.error)||"操作失败";alert(F);return}await H()}catch(fe){console.error(fe),alert("操作失败")}}async function L(D){const fe=prompt("请输入拒绝原因:");if(fe)try{const F=await St("/api/admin/withdrawals",{id:D,action:"reject",errorMessage:fe});if(!(F!=null&&F.success)){alert((F==null?void 0:F.error)||"操作失败");return}await H()}catch(F){console.error(F),alert("操作失败")}}async function X(){var D;if(!(!(ee!=null&&ee.orderSn)&&!(ee!=null&&ee.id))){U(!0),N(null);try{const fe=await St("/api/admin/orders/refund",{orderSn:ee.orderSn||ee.id,reason:G||void 0});fe!=null&&fe.success?(ce(null),Z(""),await Q("orders",!0)):N((fe==null?void 0:fe.error)||"退款失败")}catch(fe){const F=fe;N(((D=F==null?void 0:F.data)==null?void 0:D.error)||"退款失败,请检查网络后重试")}finally{U(!1)}}}function ae(D){const fe={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"},F={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return t.jsx(Le,{className:`${fe[D]||"bg-gray-500/20 text-gray-400"} border-0`,children:F[D]||D})}const ve=Math.ceil(T/V)||1,pe=l,le=f.filter(D=>{var F,re,je,xe;if(!w)return!0;const fe=w.toLowerCase();return((F=D.refereeNickname)==null?void 0:F.toLowerCase().includes(fe))||((re=D.refereePhone)==null?void 0:re.includes(fe))||((je=D.referrerName)==null?void 0:je.toLowerCase().includes(fe))||((xe=D.referrerCode)==null?void 0:xe.toLowerCase().includes(fe))}),ye=x.filter(D=>{var F;if(!w)return!0;const fe=w.toLowerCase();return((F=D.userName)==null?void 0:F.toLowerCase().includes(fe))||D.account&&D.account.toLowerCase().includes(fe)});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:()=>N(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(ie,{onClick:H,disabled:k,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${k?"animate-spin":""}`}),"刷新数据"]})]}),t.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4",children:[{key:"overview",label:"数据概览",icon:gd},{key:"orders",label:"订单管理",icon:yi},{key:"bindings",label:"绑定管理",icon:Yn},{key:"withdrawals",label:"提现审核",icon:Os}].map(D=>t.jsxs("button",{type:"button",onClick:()=>{a(D.key),j("all"),S("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${n===D.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[t.jsx(D.icon,{className:"w-4 h-4"}),D.label]},D.key))}),k?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(Ze,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs(t.Fragment,{children:[n==="overview"&&c&&t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{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(Ms,{className:"w-6 h-6 text-blue-400"})})]})})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{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(Yn,{className:"w-6 h-6 text-green-400"})})]})})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{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(ym,{className:"w-6 h-6 text-purple-400"})})]})})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{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(yi,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(Re,{className:"bg-orange-500/10 border-orange-500/30",children:t.jsx(Te,{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(wp,{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(Re,{className:"bg-blue-500/10 border-blue-500/30",children:t.jsx(Te,{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(Os,{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(ie,{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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Ue,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx($a,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),t.jsx(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Ue,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(gd,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),t.jsxs(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Ue,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(vr,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),t.jsx(Te,{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:"绑定有效期"})]})]})})]})]}),n==="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(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(se,{value:w,onChange:D=>S(D.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:P,onChange:D=>j(D.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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{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:pe.map(D=>{var fe,F;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:[(fe=D.id)==null?void 0:fe.slice(0,12),"..."]}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:D.userNickname}),t.jsx("p",{className:"text-gray-500 text-xs",children:D.userPhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:(()=>{const re=D.productType||D.type;return re==="fullbook"?`${D.bookName||"《底层逻辑》"} - 全本`:re==="match"?"匹配次数购买":`${D.bookName||"《底层逻辑》"} - ${D.sectionTitle||D.chapterTitle||`章节${D.productId||D.sectionId||""}`}`})()}),t.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const re=D.productType||D.type;return re==="fullbook"?"全书解锁":re==="match"?"功能权益":D.chapterTitle||"单章购买"})()})]})}),t.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof D.amount=="number"?D.amount.toFixed(2):parseFloat(String(D.amount||"0")).toFixed(2)]}),t.jsx("td",{className:"p-4 text-gray-300",children:D.paymentMethod==="wechat"?"微信支付":D.paymentMethod==="alipay"?"支付宝":D.paymentMethod||"微信支付"}),t.jsx("td",{className:"p-4",children:D.status==="refunded"?t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):D.status==="completed"||D.status==="paid"?t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):D.status==="pending"||D.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:D.refundReason,children:D.status==="refunded"&&D.refundReason?D.refundReason:"-"}),t.jsx("td",{className:"p-4 text-gray-300 text-sm",children:D.referrerId||D.referralCode?t.jsxs("span",{title:D.referralCode||D.referrerCode||D.referrerId||"",children:[D.referrerNickname||D.referralCode||D.referrerCode||((F=D.referrerId)==null?void 0:F.slice(0,8)),(D.referralCode||D.referrerCode)&&` (${D.referralCode||D.referrerCode})`]}):"-"}),t.jsx("td",{className:"p-4 text-[#FFD700]",children:D.referrerEarnings?`¥${(typeof D.referrerEarnings=="number"?D.referrerEarnings:parseFloat(String(D.referrerEarnings))).toFixed(2)}`:"-"}),t.jsx("td",{className:"p-4 text-gray-400 text-sm",children:D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:(D.status==="paid"||D.status==="completed")&&t.jsxs(ie,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{ce(D),Z("")},children:[t.jsx(kp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},D.id)})})]})}),n==="orders"&&t.jsx(Sn,{page:_,totalPages:ve,total:T,pageSize:V,onPageChange:B,onPageSizeChange:D=>{E(D),B(1)}})]})})]}),n==="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(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(se,{value:w,onChange:D=>S(D.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:P,onChange:D=>j(D.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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-0",children:[le.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:le.map(D=>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:D.refereeNickname||"匿名用户"}),t.jsx("p",{className:"text-gray-500 text-xs",children:D.refereePhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white",children:D.referrerName||"-"}),t.jsx("p",{className:"text-gray-500 text-xs font-mono",children:D.referrerCode})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:D.boundAt?new Date(D.boundAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:D.expiresAt?new Date(D.expiresAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:ae(D.status)}),t.jsx("td",{className:"p-4",children:D.commission?t.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",D.commission.toFixed(2)]}):t.jsx("span",{className:"text-gray-500",children:"-"})})]},D.id))})]})}),n==="bindings"&&t.jsx(Sn,{page:_,totalPages:ve,total:T,pageSize:V,onPageChange:B,onPageSizeChange:D=>{E(D),B(1)}})]})})]}),n==="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(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(se,{value:w,onChange:D=>S(D.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:P,onChange:D=>j(D.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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-0",children:[ye.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:ye.map(D=>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:[D.userAvatar?t.jsx("img",{src:D.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:(D.userName||D.name||"?").slice(0,1)}),t.jsx("p",{className:"text-white font-medium",children:D.userName||D.name})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",D.amount.toFixed(2)]})}),t.jsx("td",{className:"p-4",children:t.jsx(Le,{className:D.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:D.method==="wechat"?"微信":"支付宝"})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-mono text-xs",children:D.account}),t.jsx("p",{className:"text-gray-500 text-xs",children:D.name})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:ae(D.status)}),t.jsx("td",{className:"p-4 text-right",children:D.status==="pending"&&t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsxs(ie,{size:"sm",onClick:()=>I(D.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(ym,{className:"w-4 h-4 mr-1"}),"通过"]}),t.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>L(D.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[t.jsx(Dj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},D.id))})]})}),n==="withdrawals"&&t.jsx(Sn,{page:_,totalPages:ve,total:T,pageSize:V,onPageChange:B,onPageSizeChange:D=>{E(D),B(1)}})]})})]})]}),t.jsx(Mt,{open:!!ee,onOpenChange:D=>!D&&ce(null),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:"订单退款"})}),ee&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ee.orderSn||ee.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ee.amount=="number"?ee.amount.toFixed(2):parseFloat(String(ee.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(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:G,onChange:D=>Z(D.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>ce(null),disabled:te,children:"取消"}),t.jsx(ie,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:X,disabled:te,children:te?"退款中...":"确认退款"})]})]})})]})}function v2(){const[n,a]=h.useState([]),[l,o]=h.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[c,u]=h.useState(!0),[f,p]=h.useState(null),[x,g]=h.useState("all"),[v,y]=h.useState(1),[k,R]=h.useState(10),[C,N]=h.useState(0),[w,S]=h.useState(null);async function P(){var E,T,z,q,ue,ee,ce;u(!0),p(null);try{const G=new URLSearchParams({status:x,page:String(v),pageSize:String(k)}),Z=await Ke(`/api/admin/withdrawals?${G}`);if(Z!=null&&Z.success){const te=Z.withdrawals||[];a(te),N(Z.total??((E=Z.stats)==null?void 0:E.total)??te.length),o({total:((T=Z.stats)==null?void 0:T.total)??Z.total??te.length,pendingCount:((z=Z.stats)==null?void 0:z.pendingCount)??0,pendingAmount:((q=Z.stats)==null?void 0:q.pendingAmount)??0,successCount:((ue=Z.stats)==null?void 0:ue.successCount)??0,successAmount:((ee=Z.stats)==null?void 0:ee.successAmount)??0,failedCount:((ce=Z.stats)==null?void 0:ce.failedCount)??0})}else p("加载提现记录失败")}catch(G){console.error("Load withdrawals error:",G),p("加载失败,请检查网络后重试")}finally{u(!1)}}h.useEffect(()=>{y(1)},[x]),h.useEffect(()=>{P()},[x,v,k]);const j=Math.ceil(C/k)||1;async function _(E){const T=n.find(z=>z.id===E);if(T!=null&&T.userCommissionInfo&&T.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${T.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 + +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;S(E);try{const z=await St("/api/admin/withdrawals",{id:E,action:"approve"});z!=null&&z.success?P():alert("操作失败: "+((z==null?void 0:z.error)??""))}catch{alert("操作失败")}finally{S(null)}}async function B(E){const T=prompt("请输入拒绝原因(将返还用户余额):");if(T){S(E);try{const z=await St("/api/admin/withdrawals",{id:E,action:"reject",errorMessage:T});z!=null&&z.success?P():alert("操作失败: "+((z==null?void 0:z.error)??""))}catch{alert("操作失败")}finally{S(null)}}}function V(E){switch(E){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:E})}}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:()=>p(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(ie,{variant:"outline",onClick:P,disabled:c,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),t.jsx(Re,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:t.jsx(Te,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(yi,{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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{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(E=>t.jsx(ie,{variant:x===E?"default":"outline",size:"sm",onClick:()=>g(E),className:x===E?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:E==="all"?"全部":E==="pending"?"待处理":E==="success"?"已完成":"已拒绝"},E))}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Te,{className:"p-0",children:c?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):n.length===0?t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Os,{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:n.map(E=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4 text-gray-400",children:new Date(E.createdAt??"").toLocaleString()}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[E.userAvatar?t.jsx("img",{src:E.userAvatar,alt:E.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:(E.userName??"?").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-white",children:E.userName??"未知"}),t.jsx("p",{className:"text-xs text-gray-500",children:E.userPhone??E.referralCode??(E.userId??"").slice(0,10)})]})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(E.amount).toFixed(2)]})}),t.jsx("td",{className:"p-4",children:E.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:["¥",E.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:["¥",E.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:["¥",E.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:E.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",E.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):t.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),t.jsxs("td",{className:"p-4",children:[V(E.status),E.errorMessage&&t.jsx("p",{className:"text-xs text-red-400 mt-1",children:E.errorMessage})]}),t.jsx("td",{className:"p-4 text-gray-400",children:E.processedAt?new Date(E.processedAt).toLocaleString():"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:E.userConfirmedAt?t.jsxs("span",{className:"text-green-400",title:E.userConfirmedAt,children:["已确认 ",new Date(E.userConfirmedAt).toLocaleString()]}):"-"}),t.jsxs("td",{className:"p-4 text-right",children:[(E.status==="pending"||E.status==="pending_confirm")&&t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsxs(ie,{size:"sm",onClick:()=>_(E.id),disabled:w===E.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[t.jsx(Mi,{className:"w-4 h-4 mr-1"}),"批准"]}),t.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>B(E.id),disabled:w===E.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(E.status==="success"||E.status==="completed")&&E.transactionId&&t.jsx("span",{className:"text-xs text-gray-500 font-mono",children:E.transactionId})]})]},E.id))})]})}),t.jsx(Sn,{page:v,totalPages:j,total:C,pageSize:k,onPageChange:y,onPageSizeChange:E=>{R(E),y(1)}})]})})})]})}const Xn=h.forwardRef(({className:n,...a},l)=>t.jsx("textarea",{className:Qe("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",n),ref:l,...a}));Xn.displayName="Textarea";function ki(n,[a,l]){return Math.min(l,Math.max(a,n))}const y2=["top","right","bottom","left"],kn=Math.min,Xt=Math.max,Ei=Math.round,di=Math.floor,Tr=n=>({x:n,y:n}),j2={left:"right",right:"left",bottom:"top",top:"bottom"},N2={start:"end",end:"start"};function bd(n,a,l){return Xt(n,kn(a,l))}function Wr(n,a){return typeof n=="function"?n(a):n}function Hr(n){return n.split("-")[0]}function Hs(n){return n.split("-")[1]}function nu(n){return n==="x"?"y":"x"}function su(n){return n==="y"?"height":"width"}const b2=new Set(["top","bottom"]);function Rr(n){return b2.has(Hr(n))?"y":"x"}function au(n){return nu(Rr(n))}function w2(n,a,l){l===void 0&&(l=!1);const o=Hs(n),c=au(n),u=su(c);let f=c==="x"?o===(l?"end":"start")?"right":"left":o==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=Pi(f)),[f,Pi(f)]}function S2(n){const a=Pi(n);return[wd(n),a,wd(a)]}function wd(n){return n.replace(/start|end/g,a=>N2[a])}const Gm=["left","right"],Ym=["right","left"],C2=["top","bottom"],k2=["bottom","top"];function E2(n,a,l){switch(n){case"top":case"bottom":return l?a?Ym:Gm:a?Gm:Ym;case"left":case"right":return a?C2:k2;default:return[]}}function P2(n,a,l,o){const c=Hs(n);let u=E2(Hr(n),l==="start",o);return c&&(u=u.map(f=>f+"-"+c),a&&(u=u.concat(u.map(wd)))),u}function Pi(n){return n.replace(/left|right|bottom|top/g,a=>j2[a])}function R2(n){return{top:0,right:0,bottom:0,left:0,...n}}function Gx(n){return typeof n!="number"?R2(n):{top:n,right:n,bottom:n,left:n}}function Ri(n){const{x:a,y:l,width:o,height:c}=n;return{width:o,height:c,top:l,left:a,right:a+o,bottom:l+c,x:a,y:l}}function Qm(n,a,l){let{reference:o,floating:c}=n;const u=Rr(a),f=au(a),p=su(f),x=Hr(a),g=u==="y",v=o.x+o.width/2-c.width/2,y=o.y+o.height/2-c.height/2,k=o[p]/2-c[p]/2;let R;switch(x){case"top":R={x:v,y:o.y-c.height};break;case"bottom":R={x:v,y:o.y+o.height};break;case"right":R={x:o.x+o.width,y};break;case"left":R={x:o.x-c.width,y};break;default:R={x:o.x,y:o.y}}switch(Hs(a)){case"start":R[f]-=k*(l&&g?-1:1);break;case"end":R[f]+=k*(l&&g?-1:1);break}return R}async function T2(n,a){var l;a===void 0&&(a={});const{x:o,y:c,platform:u,rects:f,elements:p,strategy:x}=n,{boundary:g="clippingAncestors",rootBoundary:v="viewport",elementContext:y="floating",altBoundary:k=!1,padding:R=0}=Wr(a,n),C=Gx(R),w=p[k?y==="floating"?"reference":"floating":y],S=Ri(await u.getClippingRect({element:(l=await(u.isElement==null?void 0:u.isElement(w)))==null||l?w:w.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(p.floating)),boundary:g,rootBoundary:v,strategy:x})),P=y==="floating"?{x:o,y:c,width:f.floating.width,height:f.floating.height}:f.reference,j=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p.floating)),_=await(u.isElement==null?void 0:u.isElement(j))?await(u.getScale==null?void 0:u.getScale(j))||{x:1,y:1}:{x:1,y:1},B=Ri(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:P,offsetParent:j,strategy:x}):P);return{top:(S.top-B.top+C.top)/_.y,bottom:(B.bottom-S.bottom+C.bottom)/_.y,left:(S.left-B.left+C.left)/_.x,right:(B.right-S.right+C.right)/_.x}}const _2=async(n,a,l)=>{const{placement:o="bottom",strategy:c="absolute",middleware:u=[],platform:f}=l,p=u.filter(Boolean),x=await(f.isRTL==null?void 0:f.isRTL(a));let g=await f.getElementRects({reference:n,floating:a,strategy:c}),{x:v,y}=Qm(g,o,x),k=o,R={},C=0;for(let w=0;w({name:"arrow",options:n,async fn(a){const{x:l,y:o,placement:c,rects:u,platform:f,elements:p,middlewareData:x}=a,{element:g,padding:v=0}=Wr(n,a)||{};if(g==null)return{};const y=Gx(v),k={x:l,y:o},R=au(c),C=su(R),N=await f.getDimensions(g),w=R==="y",S=w?"top":"left",P=w?"bottom":"right",j=w?"clientHeight":"clientWidth",_=u.reference[C]+u.reference[R]-k[R]-u.floating[C],B=k[R]-u.reference[R],V=await(f.getOffsetParent==null?void 0:f.getOffsetParent(g));let E=V?V[j]:0;(!E||!await(f.isElement==null?void 0:f.isElement(V)))&&(E=p.floating[j]||u.floating[C]);const T=_/2-B/2,z=E/2-N[C]/2-1,q=kn(y[S],z),ue=kn(y[P],z),ee=q,ce=E-N[C]-ue,G=E/2-N[C]/2+T,Z=bd(ee,G,ce),te=!x.arrow&&Hs(c)!=null&&G!==Z&&u.reference[C]/2-(GG<=0)){var ue,ee;const G=(((ue=u.flip)==null?void 0:ue.index)||0)+1,Z=E[G];if(Z&&(!(y==="alignment"?P!==Rr(Z):!1)||q.every(M=>Rr(M.placement)===P?M.overflows[0]>0:!0)))return{data:{index:G,overflows:q},reset:{placement:Z}};let te=(ee=q.filter(U=>U.overflows[0]<=0).sort((U,M)=>U.overflows[1]-M.overflows[1])[0])==null?void 0:ee.placement;if(!te)switch(R){case"bestFit":{var ce;const U=(ce=q.filter(M=>{if(V){const Q=Rr(M.placement);return Q===P||Q==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(Q=>Q>0).reduce((Q,H)=>Q+H,0)]).sort((M,Q)=>M[1]-Q[1])[0])==null?void 0:ce[0];U&&(te=U);break}case"initialPlacement":te=p;break}if(c!==te)return{reset:{placement:te}}}return{}}}};function qm(n,a){return{top:n.top-a.height,right:n.right-a.width,bottom:n.bottom-a.height,left:n.left-a.width}}function Xm(n){return y2.some(a=>n[a]>=0)}const M2=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(a){const{rects:l,platform:o}=a,{strategy:c="referenceHidden",...u}=Wr(n,a);switch(c){case"referenceHidden":{const f=await o.detectOverflow(a,{...u,elementContext:"reference"}),p=qm(f,l.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:Xm(p)}}}case"escaped":{const f=await o.detectOverflow(a,{...u,altBoundary:!0}),p=qm(f,l.floating);return{data:{escapedOffsets:p,escaped:Xm(p)}}}default:return{}}}}},Yx=new Set(["left","top"]);async function D2(n,a){const{placement:l,platform:o,elements:c}=n,u=await(o.isRTL==null?void 0:o.isRTL(c.floating)),f=Hr(l),p=Hs(l),x=Rr(l)==="y",g=Yx.has(f)?-1:1,v=u&&x?-1:1,y=Wr(a,n);let{mainAxis:k,crossAxis:R,alignmentAxis:C}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return p&&typeof C=="number"&&(R=p==="end"?C*-1:C),x?{x:R*v,y:k*g}:{x:k*g,y:R*v}}const L2=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(a){var l,o;const{x:c,y:u,placement:f,middlewareData:p}=a,x=await D2(a,n);return f===((l=p.offset)==null?void 0:l.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:c+x.x,y:u+x.y,data:{...x,placement:f}}}}},O2=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(a){const{x:l,y:o,placement:c,platform:u}=a,{mainAxis:f=!0,crossAxis:p=!1,limiter:x={fn:S=>{let{x:P,y:j}=S;return{x:P,y:j}}},...g}=Wr(n,a),v={x:l,y:o},y=await u.detectOverflow(a,g),k=Rr(Hr(c)),R=nu(k);let C=v[R],N=v[k];if(f){const S=R==="y"?"top":"left",P=R==="y"?"bottom":"right",j=C+y[S],_=C-y[P];C=bd(j,C,_)}if(p){const S=k==="y"?"top":"left",P=k==="y"?"bottom":"right",j=N+y[S],_=N-y[P];N=bd(j,N,_)}const w=x.fn({...a,[R]:C,[k]:N});return{...w,data:{x:w.x-l,y:w.y-o,enabled:{[R]:f,[k]:p}}}}}},F2=function(n){return n===void 0&&(n={}),{options:n,fn(a){const{x:l,y:o,placement:c,rects:u,middlewareData:f}=a,{offset:p=0,mainAxis:x=!0,crossAxis:g=!0}=Wr(n,a),v={x:l,y:o},y=Rr(c),k=nu(y);let R=v[k],C=v[y];const N=Wr(p,a),w=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(x){const j=k==="y"?"height":"width",_=u.reference[k]-u.floating[j]+w.mainAxis,B=u.reference[k]+u.reference[j]-w.mainAxis;R<_?R=_:R>B&&(R=B)}if(g){var S,P;const j=k==="y"?"width":"height",_=Yx.has(Hr(c)),B=u.reference[y]-u.floating[j]+(_&&((S=f.offset)==null?void 0:S[y])||0)+(_?0:w.crossAxis),V=u.reference[y]+u.reference[j]+(_?0:((P=f.offset)==null?void 0:P[y])||0)-(_?w.crossAxis:0);CV&&(C=V)}return{[k]:R,[y]:C}}}},z2=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(a){var l,o;const{placement:c,rects:u,platform:f,elements:p}=a,{apply:x=()=>{},...g}=Wr(n,a),v=await f.detectOverflow(a,g),y=Hr(c),k=Hs(c),R=Rr(c)==="y",{width:C,height:N}=u.floating;let w,S;y==="top"||y==="bottom"?(w=y,S=k===(await(f.isRTL==null?void 0:f.isRTL(p.floating))?"start":"end")?"left":"right"):(S=y,w=k==="end"?"top":"bottom");const P=N-v.top-v.bottom,j=C-v.left-v.right,_=kn(N-v[w],P),B=kn(C-v[S],j),V=!a.middlewareData.shift;let E=_,T=B;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(T=j),(o=a.middlewareData.shift)!=null&&o.enabled.y&&(E=P),V&&!k){const q=Xt(v.left,0),ue=Xt(v.right,0),ee=Xt(v.top,0),ce=Xt(v.bottom,0);R?T=C-2*(q!==0||ue!==0?q+ue:Xt(v.left,v.right)):E=N-2*(ee!==0||ce!==0?ee+ce:Xt(v.top,v.bottom))}await x({...a,availableWidth:T,availableHeight:E});const z=await f.getDimensions(p.floating);return C!==z.width||N!==z.height?{reset:{rects:!0}}:{}}}};function Wi(){return typeof window<"u"}function Ks(n){return Qx(n)?(n.nodeName||"").toLowerCase():"#document"}function Jt(n){var a;return(n==null||(a=n.ownerDocument)==null?void 0:a.defaultView)||window}function Ir(n){var a;return(a=(Qx(n)?n.ownerDocument:n.document)||window.document)==null?void 0:a.documentElement}function Qx(n){return Wi()?n instanceof Node||n instanceof Jt(n).Node:!1}function yr(n){return Wi()?n instanceof Element||n instanceof Jt(n).Element:!1}function _r(n){return Wi()?n instanceof HTMLElement||n instanceof Jt(n).HTMLElement:!1}function Jm(n){return!Wi()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Jt(n).ShadowRoot}const $2=new Set(["inline","contents"]);function Ga(n){const{overflow:a,overflowX:l,overflowY:o,display:c}=jr(n);return/auto|scroll|overlay|hidden|clip/.test(a+o+l)&&!$2.has(c)}const B2=new Set(["table","td","th"]);function U2(n){return B2.has(Ks(n))}const V2=[":popover-open",":modal"];function Hi(n){return V2.some(a=>{try{return n.matches(a)}catch{return!1}})}const W2=["transform","translate","scale","rotate","perspective"],H2=["transform","translate","scale","rotate","perspective","filter"],K2=["paint","layout","strict","content"];function lu(n){const a=iu(),l=yr(n)?jr(n):n;return W2.some(o=>l[o]?l[o]!=="none":!1)||(l.containerType?l.containerType!=="normal":!1)||!a&&(l.backdropFilter?l.backdropFilter!=="none":!1)||!a&&(l.filter?l.filter!=="none":!1)||H2.some(o=>(l.willChange||"").includes(o))||K2.some(o=>(l.contain||"").includes(o))}function G2(n){let a=En(n);for(;_r(a)&&!$s(a);){if(lu(a))return a;if(Hi(a))return null;a=En(a)}return null}function iu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Y2=new Set(["html","body","#document"]);function $s(n){return Y2.has(Ks(n))}function jr(n){return Jt(n).getComputedStyle(n)}function Ki(n){return yr(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function En(n){if(Ks(n)==="html")return n;const a=n.assignedSlot||n.parentNode||Jm(n)&&n.host||Ir(n);return Jm(a)?a.host:a}function qx(n){const a=En(n);return $s(a)?n.ownerDocument?n.ownerDocument.body:n.body:_r(a)&&Ga(a)?a:qx(a)}function Ua(n,a,l){var o;a===void 0&&(a=[]),l===void 0&&(l=!0);const c=qx(n),u=c===((o=n.ownerDocument)==null?void 0:o.body),f=Jt(c);if(u){const p=Sd(f);return a.concat(f,f.visualViewport||[],Ga(c)?c:[],p&&l?Ua(p):[])}return a.concat(c,Ua(c,[],l))}function Sd(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Xx(n){const a=jr(n);let l=parseFloat(a.width)||0,o=parseFloat(a.height)||0;const c=_r(n),u=c?n.offsetWidth:l,f=c?n.offsetHeight:o,p=Ei(l)!==u||Ei(o)!==f;return p&&(l=u,o=f),{width:l,height:o,$:p}}function ou(n){return yr(n)?n:n.contextElement}function Ls(n){const a=ou(n);if(!_r(a))return Tr(1);const l=a.getBoundingClientRect(),{width:o,height:c,$:u}=Xx(a);let f=(u?Ei(l.width):l.width)/o,p=(u?Ei(l.height):l.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!p||!Number.isFinite(p))&&(p=1),{x:f,y:p}}const Q2=Tr(0);function Jx(n){const a=Jt(n);return!iu()||!a.visualViewport?Q2:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function q2(n,a,l){return a===void 0&&(a=!1),!l||a&&l!==Jt(n)?!1:a}function es(n,a,l,o){a===void 0&&(a=!1),l===void 0&&(l=!1);const c=n.getBoundingClientRect(),u=ou(n);let f=Tr(1);a&&(o?yr(o)&&(f=Ls(o)):f=Ls(n));const p=q2(u,l,o)?Jx(u):Tr(0);let x=(c.left+p.x)/f.x,g=(c.top+p.y)/f.y,v=c.width/f.x,y=c.height/f.y;if(u){const k=Jt(u),R=o&&yr(o)?Jt(o):o;let C=k,N=Sd(C);for(;N&&o&&R!==C;){const w=Ls(N),S=N.getBoundingClientRect(),P=jr(N),j=S.left+(N.clientLeft+parseFloat(P.paddingLeft))*w.x,_=S.top+(N.clientTop+parseFloat(P.paddingTop))*w.y;x*=w.x,g*=w.y,v*=w.x,y*=w.y,x+=j,g+=_,C=Jt(N),N=Sd(C)}}return Ri({width:v,height:y,x,y:g})}function Gi(n,a){const l=Ki(n).scrollLeft;return a?a.left+l:es(Ir(n)).left+l}function Zx(n,a){const l=n.getBoundingClientRect(),o=l.left+a.scrollLeft-Gi(n,l),c=l.top+a.scrollTop;return{x:o,y:c}}function X2(n){let{elements:a,rect:l,offsetParent:o,strategy:c}=n;const u=c==="fixed",f=Ir(o),p=a?Hi(a.floating):!1;if(o===f||p&&u)return l;let x={scrollLeft:0,scrollTop:0},g=Tr(1);const v=Tr(0),y=_r(o);if((y||!y&&!u)&&((Ks(o)!=="body"||Ga(f))&&(x=Ki(o)),_r(o))){const R=es(o);g=Ls(o),v.x=R.x+o.clientLeft,v.y=R.y+o.clientTop}const k=f&&!y&&!u?Zx(f,x):Tr(0);return{width:l.width*g.x,height:l.height*g.y,x:l.x*g.x-x.scrollLeft*g.x+v.x+k.x,y:l.y*g.y-x.scrollTop*g.y+v.y+k.y}}function J2(n){return Array.from(n.getClientRects())}function Z2(n){const a=Ir(n),l=Ki(n),o=n.ownerDocument.body,c=Xt(a.scrollWidth,a.clientWidth,o.scrollWidth,o.clientWidth),u=Xt(a.scrollHeight,a.clientHeight,o.scrollHeight,o.clientHeight);let f=-l.scrollLeft+Gi(n);const p=-l.scrollTop;return jr(o).direction==="rtl"&&(f+=Xt(a.clientWidth,o.clientWidth)-c),{width:c,height:u,x:f,y:p}}const Zm=25;function eS(n,a){const l=Jt(n),o=Ir(n),c=l.visualViewport;let u=o.clientWidth,f=o.clientHeight,p=0,x=0;if(c){u=c.width,f=c.height;const v=iu();(!v||v&&a==="fixed")&&(p=c.offsetLeft,x=c.offsetTop)}const g=Gi(o);if(g<=0){const v=o.ownerDocument,y=v.body,k=getComputedStyle(y),R=v.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,C=Math.abs(o.clientWidth-y.clientWidth-R);C<=Zm&&(u-=C)}else g<=Zm&&(u+=g);return{width:u,height:f,x:p,y:x}}const tS=new Set(["absolute","fixed"]);function rS(n,a){const l=es(n,!0,a==="fixed"),o=l.top+n.clientTop,c=l.left+n.clientLeft,u=_r(n)?Ls(n):Tr(1),f=n.clientWidth*u.x,p=n.clientHeight*u.y,x=c*u.x,g=o*u.y;return{width:f,height:p,x,y:g}}function ep(n,a,l){let o;if(a==="viewport")o=eS(n,l);else if(a==="document")o=Z2(Ir(n));else if(yr(a))o=rS(a,l);else{const c=Jx(n);o={x:a.x-c.x,y:a.y-c.y,width:a.width,height:a.height}}return Ri(o)}function eg(n,a){const l=En(n);return l===a||!yr(l)||$s(l)?!1:jr(l).position==="fixed"||eg(l,a)}function nS(n,a){const l=a.get(n);if(l)return l;let o=Ua(n,[],!1).filter(p=>yr(p)&&Ks(p)!=="body"),c=null;const u=jr(n).position==="fixed";let f=u?En(n):n;for(;yr(f)&&!$s(f);){const p=jr(f),x=lu(f);!x&&p.position==="fixed"&&(c=null),(u?!x&&!c:!x&&p.position==="static"&&!!c&&tS.has(c.position)||Ga(f)&&!x&&eg(n,f))?o=o.filter(v=>v!==f):c=p,f=En(f)}return a.set(n,o),o}function sS(n){let{element:a,boundary:l,rootBoundary:o,strategy:c}=n;const f=[...l==="clippingAncestors"?Hi(a)?[]:nS(a,this._c):[].concat(l),o],p=f[0],x=f.reduce((g,v)=>{const y=ep(a,v,c);return g.top=Xt(y.top,g.top),g.right=kn(y.right,g.right),g.bottom=kn(y.bottom,g.bottom),g.left=Xt(y.left,g.left),g},ep(a,p,c));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function aS(n){const{width:a,height:l}=Xx(n);return{width:a,height:l}}function lS(n,a,l){const o=_r(a),c=Ir(a),u=l==="fixed",f=es(n,!0,u,a);let p={scrollLeft:0,scrollTop:0};const x=Tr(0);function g(){x.x=Gi(c)}if(o||!o&&!u)if((Ks(a)!=="body"||Ga(c))&&(p=Ki(a)),o){const R=es(a,!0,u,a);x.x=R.x+a.clientLeft,x.y=R.y+a.clientTop}else c&&g();u&&!o&&c&&g();const v=c&&!o&&!u?Zx(c,p):Tr(0),y=f.left+p.scrollLeft-x.x-v.x,k=f.top+p.scrollTop-x.y-v.y;return{x:y,y:k,width:f.width,height:f.height}}function ad(n){return jr(n).position==="static"}function tp(n,a){if(!_r(n)||jr(n).position==="fixed")return null;if(a)return a(n);let l=n.offsetParent;return Ir(n)===l&&(l=l.ownerDocument.body),l}function tg(n,a){const l=Jt(n);if(Hi(n))return l;if(!_r(n)){let c=En(n);for(;c&&!$s(c);){if(yr(c)&&!ad(c))return c;c=En(c)}return l}let o=tp(n,a);for(;o&&U2(o)&&ad(o);)o=tp(o,a);return o&&$s(o)&&ad(o)&&!lu(o)?l:o||G2(n)||l}const iS=async function(n){const a=this.getOffsetParent||tg,l=this.getDimensions,o=await l(n.floating);return{reference:lS(n.reference,await a(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function oS(n){return jr(n).direction==="rtl"}const cS={convertOffsetParentRelativeRectToViewportRelativeRect:X2,getDocumentElement:Ir,getClippingRect:sS,getOffsetParent:tg,getElementRects:iS,getClientRects:J2,getDimensions:aS,getScale:Ls,isElement:yr,isRTL:oS};function rg(n,a){return n.x===a.x&&n.y===a.y&&n.width===a.width&&n.height===a.height}function dS(n,a){let l=null,o;const c=Ir(n);function u(){var p;clearTimeout(o),(p=l)==null||p.disconnect(),l=null}function f(p,x){p===void 0&&(p=!1),x===void 0&&(x=1),u();const g=n.getBoundingClientRect(),{left:v,top:y,width:k,height:R}=g;if(p||a(),!k||!R)return;const C=di(y),N=di(c.clientWidth-(v+k)),w=di(c.clientHeight-(y+R)),S=di(v),j={rootMargin:-C+"px "+-N+"px "+-w+"px "+-S+"px",threshold:Xt(0,kn(1,x))||1};let _=!0;function B(V){const E=V[0].intersectionRatio;if(E!==x){if(!_)return f();E?f(!1,E):o=setTimeout(()=>{f(!1,1e-7)},1e3)}E===1&&!rg(g,n.getBoundingClientRect())&&f(),_=!1}try{l=new IntersectionObserver(B,{...j,root:c.ownerDocument})}catch{l=new IntersectionObserver(B,j)}l.observe(n)}return f(!0),u}function uS(n,a,l,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:x=!1}=o,g=ou(n),v=c||u?[...g?Ua(g):[],...Ua(a)]:[];v.forEach(S=>{c&&S.addEventListener("scroll",l,{passive:!0}),u&&S.addEventListener("resize",l)});const y=g&&p?dS(g,l):null;let k=-1,R=null;f&&(R=new ResizeObserver(S=>{let[P]=S;P&&P.target===g&&R&&(R.unobserve(a),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{var j;(j=R)==null||j.observe(a)})),l()}),g&&!x&&R.observe(g),R.observe(a));let C,N=x?es(n):null;x&&w();function w(){const S=es(n);N&&!rg(N,S)&&l(),N=S,C=requestAnimationFrame(w)}return l(),()=>{var S;v.forEach(P=>{c&&P.removeEventListener("scroll",l),u&&P.removeEventListener("resize",l)}),y==null||y(),(S=R)==null||S.disconnect(),R=null,x&&cancelAnimationFrame(C)}}const fS=L2,hS=O2,mS=A2,pS=z2,xS=M2,rp=I2,gS=F2,vS=(n,a,l)=>{const o=new Map,c={platform:cS,...l},u={...c.platform,_c:o};return _2(n,a,{...c,platform:u})};var yS=typeof document<"u",jS=function(){},pi=yS?h.useLayoutEffect:jS;function Ti(n,a){if(n===a)return!0;if(typeof n!=typeof a)return!1;if(typeof n=="function"&&n.toString()===a.toString())return!0;let l,o,c;if(n&&a&&typeof n=="object"){if(Array.isArray(n)){if(l=n.length,l!==a.length)return!1;for(o=l;o--!==0;)if(!Ti(n[o],a[o]))return!1;return!0}if(c=Object.keys(n),l=c.length,l!==Object.keys(a).length)return!1;for(o=l;o--!==0;)if(!{}.hasOwnProperty.call(a,c[o]))return!1;for(o=l;o--!==0;){const u=c[o];if(!(u==="_owner"&&n.$$typeof)&&!Ti(n[u],a[u]))return!1}return!0}return n!==n&&a!==a}function ng(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function np(n,a){const l=ng(n);return Math.round(a*l)/l}function ld(n){const a=h.useRef(n);return pi(()=>{a.current=n}),a}function NS(n){n===void 0&&(n={});const{placement:a="bottom",strategy:l="absolute",middleware:o=[],platform:c,elements:{reference:u,floating:f}={},transform:p=!0,whileElementsMounted:x,open:g}=n,[v,y]=h.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[k,R]=h.useState(o);Ti(k,o)||R(o);const[C,N]=h.useState(null),[w,S]=h.useState(null),P=h.useCallback(M=>{M!==V.current&&(V.current=M,N(M))},[]),j=h.useCallback(M=>{M!==E.current&&(E.current=M,S(M))},[]),_=u||C,B=f||w,V=h.useRef(null),E=h.useRef(null),T=h.useRef(v),z=x!=null,q=ld(x),ue=ld(c),ee=ld(g),ce=h.useCallback(()=>{if(!V.current||!E.current)return;const M={placement:a,strategy:l,middleware:k};ue.current&&(M.platform=ue.current),vS(V.current,E.current,M).then(Q=>{const H={...Q,isPositioned:ee.current!==!1};G.current&&!Ti(T.current,H)&&(T.current=H,Va.flushSync(()=>{y(H)}))})},[k,a,l,ue,ee]);pi(()=>{g===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,y(M=>({...M,isPositioned:!1})))},[g]);const G=h.useRef(!1);pi(()=>(G.current=!0,()=>{G.current=!1}),[]),pi(()=>{if(_&&(V.current=_),B&&(E.current=B),_&&B){if(q.current)return q.current(_,B,ce);ce()}},[_,B,ce,q,z]);const Z=h.useMemo(()=>({reference:V,floating:E,setReference:P,setFloating:j}),[P,j]),te=h.useMemo(()=>({reference:_,floating:B}),[_,B]),U=h.useMemo(()=>{const M={position:l,left:0,top:0};if(!te.floating)return M;const Q=np(te.floating,v.x),H=np(te.floating,v.y);return p?{...M,transform:"translate("+Q+"px, "+H+"px)",...ng(te.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:Q,top:H}},[l,p,te.floating,v.x,v.y]);return h.useMemo(()=>({...v,update:ce,refs:Z,elements:te,floatingStyles:U}),[v,ce,Z,te,U])}const bS=n=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:n,fn(l){const{element:o,padding:c}=typeof n=="function"?n(l):n;return o&&a(o)?o.current!=null?rp({element:o.current,padding:c}).fn(l):{}:o?rp({element:o,padding:c}).fn(l):{}}}},wS=(n,a)=>({...fS(n),options:[n,a]}),SS=(n,a)=>({...hS(n),options:[n,a]}),CS=(n,a)=>({...gS(n),options:[n,a]}),kS=(n,a)=>({...mS(n),options:[n,a]}),ES=(n,a)=>({...pS(n),options:[n,a]}),PS=(n,a)=>({...xS(n),options:[n,a]}),RS=(n,a)=>({...bS(n),options:[n,a]});var TS="Arrow",sg=h.forwardRef((n,a)=>{const{children:l,width:o=10,height:c=5,...u}=n;return t.jsx(ze.svg,{...u,ref:a,width:o,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?l:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});sg.displayName=TS;var _S=sg,cu="Popper",[ag,lg]=Rn(cu),[IS,ig]=ag(cu),og=n=>{const{__scopePopper:a,children:l}=n,[o,c]=h.useState(null);return t.jsx(IS,{scope:a,anchor:o,onAnchorChange:c,children:l})};og.displayName=cu;var cg="PopperAnchor",dg=h.forwardRef((n,a)=>{const{__scopePopper:l,virtualRef:o,...c}=n,u=ig(cg,l),f=h.useRef(null),p=Ye(a,f),x=h.useRef(null);return h.useEffect(()=>{const g=x.current;x.current=(o==null?void 0:o.current)||f.current,g!==x.current&&u.onAnchorChange(x.current)}),o?null:t.jsx(ze.div,{...c,ref:p})});dg.displayName=cg;var du="PopperContent",[AS,MS]=ag(du),ug=h.forwardRef((n,a)=>{var le,ye,D,fe,F,re;const{__scopePopper:l,side:o="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,arrowPadding:p=0,avoidCollisions:x=!0,collisionBoundary:g=[],collisionPadding:v=0,sticky:y="partial",hideWhenDetached:k=!1,updatePositionStrategy:R="optimized",onPlaced:C,...N}=n,w=ig(du,l),[S,P]=h.useState(null),j=Ye(a,je=>P(je)),[_,B]=h.useState(null),V=Zd(_),E=(V==null?void 0:V.width)??0,T=(V==null?void 0:V.height)??0,z=o+(u!=="center"?"-"+u:""),q=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},ue=Array.isArray(g)?g:[g],ee=ue.length>0,ce={padding:q,boundary:ue.filter(LS),altBoundary:ee},{refs:G,floatingStyles:Z,placement:te,isPositioned:U,middlewareData:M}=NS({strategy:"fixed",placement:z,whileElementsMounted:(...je)=>uS(...je,{animationFrame:R==="always"}),elements:{reference:w.anchor},middleware:[wS({mainAxis:c+T,alignmentAxis:f}),x&&SS({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?CS():void 0,...ce}),x&&kS({...ce}),ES({...ce,apply:({elements:je,rects:xe,availableWidth:Oe,availableHeight:Xe})=>{const{width:Be,height:Ct}=xe.reference,Ft=je.floating.style;Ft.setProperty("--radix-popper-available-width",`${Oe}px`),Ft.setProperty("--radix-popper-available-height",`${Xe}px`),Ft.setProperty("--radix-popper-anchor-width",`${Be}px`),Ft.setProperty("--radix-popper-anchor-height",`${Ct}px`)}}),_&&RS({element:_,padding:p}),OS({arrowWidth:E,arrowHeight:T}),k&&PS({strategy:"referenceHidden",...ce})]}),[Q,H]=mg(te),I=Cn(C);_t(()=>{U&&(I==null||I())},[U,I]);const L=(le=M.arrow)==null?void 0:le.x,X=(ye=M.arrow)==null?void 0:ye.y,ae=((D=M.arrow)==null?void 0:D.centerOffset)!==0,[ve,pe]=h.useState();return _t(()=>{S&&pe(window.getComputedStyle(S).zIndex)},[S]),t.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:U?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[(fe=M.transformOrigin)==null?void 0:fe.x,(F=M.transformOrigin)==null?void 0:F.y].join(" "),...((re=M.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:t.jsx(AS,{scope:l,placedSide:Q,onArrowChange:B,arrowX:L,arrowY:X,shouldHideArrow:ae,children:t.jsx(ze.div,{"data-side":Q,"data-align":H,...N,ref:j,style:{...N.style,animation:U?void 0:"none"}})})})});ug.displayName=du;var fg="PopperArrow",DS={top:"bottom",right:"left",bottom:"top",left:"right"},hg=h.forwardRef(function(a,l){const{__scopePopper:o,...c}=a,u=MS(fg,o),f=DS[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(_S,{...c,ref:l,style:{...c.style,display:"block"}})})});hg.displayName=fg;function LS(n){return n!==null}var OS=n=>({name:"transformOrigin",options:n,fn(a){var w,S,P;const{placement:l,rects:o,middlewareData:c}=a,f=((w=c.arrow)==null?void 0:w.centerOffset)!==0,p=f?0:n.arrowWidth,x=f?0:n.arrowHeight,[g,v]=mg(l),y={start:"0%",center:"50%",end:"100%"}[v],k=(((S=c.arrow)==null?void 0:S.x)??0)+p/2,R=(((P=c.arrow)==null?void 0:P.y)??0)+x/2;let C="",N="";return g==="bottom"?(C=f?y:`${k}px`,N=`${-x}px`):g==="top"?(C=f?y:`${k}px`,N=`${o.floating.height+x}px`):g==="right"?(C=`${-x}px`,N=f?y:`${R}px`):g==="left"&&(C=`${o.floating.width+x}px`,N=f?y:`${R}px`),{data:{x:C,y:N}}}});function mg(n){const[a,l="center"]=n.split("-");return[a,l]}var FS=og,zS=dg,$S=ug,BS=hg,pg=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"}),US="VisuallyHidden",VS=h.forwardRef((n,a)=>t.jsx(ze.span,{...n,ref:a,style:{...pg,...n.style}}));VS.displayName=US;var WS=[" ","Enter","ArrowUp","ArrowDown"],HS=[" ","Enter"],ts="Select",[Yi,Qi,KS]=eu(ts),[Gs]=Rn(ts,[KS,lg]),qi=lg(),[GS,Tn]=Gs(ts),[YS,QS]=Gs(ts),xg=n=>{const{__scopeSelect:a,children:l,open:o,defaultOpen:c,onOpenChange:u,value:f,defaultValue:p,onValueChange:x,dir:g,name:v,autoComplete:y,disabled:k,required:R,form:C}=n,N=qi(a),[w,S]=h.useState(null),[P,j]=h.useState(null),[_,B]=h.useState(!1),V=Bi(g),[E,T]=Jn({prop:o,defaultProp:c??!1,onChange:u,caller:ts}),[z,q]=Jn({prop:f,defaultProp:p,onChange:x,caller:ts}),ue=h.useRef(null),ee=w?C||!!w.closest("form"):!0,[ce,G]=h.useState(new Set),Z=Array.from(ce).map(te=>te.props.value).join(";");return t.jsx(FS,{...N,children:t.jsxs(GS,{required:R,scope:a,trigger:w,onTriggerChange:S,valueNode:P,onValueNodeChange:j,valueNodeHasChildren:_,onValueNodeHasChildrenChange:B,contentId:wn(),value:z,onValueChange:q,open:E,onOpenChange:T,dir:V,triggerPointerDownPosRef:ue,disabled:k,children:[t.jsx(Yi.Provider,{scope:a,children:t.jsx(YS,{scope:n.__scopeSelect,onNativeOptionAdd:h.useCallback(te=>{G(U=>new Set(U).add(te))},[]),onNativeOptionRemove:h.useCallback(te=>{G(U=>{const M=new Set(U);return M.delete(te),M})},[]),children:l})}),ee?t.jsxs(Fg,{"aria-hidden":!0,required:R,tabIndex:-1,name:v,autoComplete:y,value:z,onChange:te=>q(te.target.value),disabled:k,form:C,children:[z===void 0?t.jsx("option",{value:""}):null,Array.from(ce)]},Z):null]})})};xg.displayName=ts;var gg="SelectTrigger",vg=h.forwardRef((n,a)=>{const{__scopeSelect:l,disabled:o=!1,...c}=n,u=qi(l),f=Tn(gg,l),p=f.disabled||o,x=Ye(a,f.onTriggerChange),g=Qi(l),v=h.useRef("touch"),[y,k,R]=$g(N=>{const w=g().filter(j=>!j.disabled),S=w.find(j=>j.value===f.value),P=Bg(w,N,S);P!==void 0&&f.onValueChange(P.value)}),C=N=>{p||(f.onOpenChange(!0),R()),N&&(f.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return t.jsx(zS,{asChild:!0,...u,children:t.jsx(ze.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:p,"data-disabled":p?"":void 0,"data-placeholder":zg(f.value)?"":void 0,...c,ref:x,onClick:De(c.onClick,N=>{N.currentTarget.focus(),v.current!=="mouse"&&C(N)}),onPointerDown:De(c.onPointerDown,N=>{v.current=N.pointerType;const w=N.target;w.hasPointerCapture(N.pointerId)&&w.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(C(N),N.preventDefault())}),onKeyDown:De(c.onKeyDown,N=>{const w=y.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&k(N.key),!(w&&N.key===" ")&&WS.includes(N.key)&&(C(),N.preventDefault())})})})});vg.displayName=gg;var yg="SelectValue",jg=h.forwardRef((n,a)=>{const{__scopeSelect:l,className:o,style:c,children:u,placeholder:f="",...p}=n,x=Tn(yg,l),{onValueNodeHasChildrenChange:g}=x,v=u!==void 0,y=Ye(a,x.onValueNodeChange);return _t(()=>{g(v)},[g,v]),t.jsx(ze.span,{...p,ref:y,style:{pointerEvents:"none"},children:zg(x.value)?t.jsx(t.Fragment,{children:f}):u})});jg.displayName=yg;var qS="SelectIcon",Ng=h.forwardRef((n,a)=>{const{__scopeSelect:l,children:o,...c}=n;return t.jsx(ze.span,{"aria-hidden":!0,...c,ref:a,children:o||"▼"})});Ng.displayName=qS;var XS="SelectPortal",bg=n=>t.jsx(Kd,{asChild:!0,...n});bg.displayName=XS;var rs="SelectContent",wg=h.forwardRef((n,a)=>{const l=Tn(rs,n.__scopeSelect),[o,c]=h.useState();if(_t(()=>{c(new DocumentFragment)},[]),!l.open){const u=o;return u?Va.createPortal(t.jsx(Sg,{scope:n.__scopeSelect,children:t.jsx(Yi.Slot,{scope:n.__scopeSelect,children:t.jsx("div",{children:n.children})})}),u):null}return t.jsx(Cg,{...n,ref:a})});wg.displayName=rs;var xr=10,[Sg,_n]=Gs(rs),JS="SelectContentImpl",ZS=Ba("SelectContent.RemoveScroll"),Cg=h.forwardRef((n,a)=>{const{__scopeSelect:l,position:o="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,side:p,sideOffset:x,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:k,collisionPadding:R,sticky:C,hideWhenDetached:N,avoidCollisions:w,...S}=n,P=Tn(rs,l),[j,_]=h.useState(null),[B,V]=h.useState(null),E=Ye(a,le=>_(le)),[T,z]=h.useState(null),[q,ue]=h.useState(null),ee=Qi(l),[ce,G]=h.useState(!1),Z=h.useRef(!1);h.useEffect(()=>{if(j)return nx(j)},[j]),Yp();const te=h.useCallback(le=>{const[ye,...D]=ee().map(re=>re.ref.current),[fe]=D.slice(-1),F=document.activeElement;for(const re of le)if(re===F||(re==null||re.scrollIntoView({block:"nearest"}),re===ye&&B&&(B.scrollTop=0),re===fe&&B&&(B.scrollTop=B.scrollHeight),re==null||re.focus(),document.activeElement!==F))return},[ee,B]),U=h.useCallback(()=>te([T,j]),[te,T,j]);h.useEffect(()=>{ce&&U()},[ce,U]);const{onOpenChange:M,triggerPointerDownPosRef:Q}=P;h.useEffect(()=>{if(j){let le={x:0,y:0};const ye=fe=>{var F,re;le={x:Math.abs(Math.round(fe.pageX)-(((F=Q.current)==null?void 0:F.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((re=Q.current)==null?void 0:re.y)??0))}},D=fe=>{le.x<=10&&le.y<=10?fe.preventDefault():j.contains(fe.target)||M(!1),document.removeEventListener("pointermove",ye),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",D,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",D,{capture:!0})}}},[j,M,Q]),h.useEffect(()=>{const le=()=>M(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[M]);const[H,I]=$g(le=>{const ye=ee().filter(F=>!F.disabled),D=ye.find(F=>F.ref.current===document.activeElement),fe=Bg(ye,le,D);fe&&setTimeout(()=>fe.ref.current.focus())}),L=h.useCallback((le,ye,D)=>{const fe=!Z.current&&!D;(P.value!==void 0&&P.value===ye||fe)&&(z(le),fe&&(Z.current=!0))},[P.value]),X=h.useCallback(()=>j==null?void 0:j.focus(),[j]),ae=h.useCallback((le,ye,D)=>{const fe=!Z.current&&!D;(P.value!==void 0&&P.value===ye||fe)&&ue(le)},[P.value]),ve=o==="popper"?Cd:kg,pe=ve===Cd?{side:p,sideOffset:x,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:k,collisionPadding:R,sticky:C,hideWhenDetached:N,avoidCollisions:w}:{};return t.jsx(Sg,{scope:l,content:j,viewport:B,onViewportChange:V,itemRefCallback:L,selectedItem:T,onItemLeave:X,itemTextRefCallback:ae,focusSelectedItem:U,selectedItemText:q,position:o,isPositioned:ce,searchRef:H,children:t.jsx(Gd,{as:ZS,allowPinchZoom:!0,children:t.jsx(Hd,{asChild:!0,trapped:P.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:De(c,le=>{var ye;(ye=P.trigger)==null||ye.focus({preventScroll:!0}),le.preventDefault()}),children:t.jsx(Wd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>P.onOpenChange(!1),children:t.jsx(ve,{role:"listbox",id:P.contentId,"data-state":P.open?"open":"closed",dir:P.dir,onContextMenu:le=>le.preventDefault(),...S,...pe,onPlaced:()=>G(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:De(S.onKeyDown,le=>{const ye=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!ye&&le.key.length===1&&I(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let fe=ee().filter(F=>!F.disabled).map(F=>F.ref.current);if(["ArrowUp","End"].includes(le.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const F=le.target,re=fe.indexOf(F);fe=fe.slice(re+1)}setTimeout(()=>te(fe)),le.preventDefault()}})})})})})})});Cg.displayName=JS;var eC="SelectItemAlignedPosition",kg=h.forwardRef((n,a)=>{const{__scopeSelect:l,onPlaced:o,...c}=n,u=Tn(rs,l),f=_n(rs,l),[p,x]=h.useState(null),[g,v]=h.useState(null),y=Ye(a,E=>v(E)),k=Qi(l),R=h.useRef(!1),C=h.useRef(!0),{viewport:N,selectedItem:w,selectedItemText:S,focusSelectedItem:P}=f,j=h.useCallback(()=>{if(u.trigger&&u.valueNode&&p&&g&&N&&w&&S){const E=u.trigger.getBoundingClientRect(),T=g.getBoundingClientRect(),z=u.valueNode.getBoundingClientRect(),q=S.getBoundingClientRect();if(u.dir!=="rtl"){const F=q.left-T.left,re=z.left-F,je=E.left-re,xe=E.width+je,Oe=Math.max(xe,T.width),Xe=window.innerWidth-xr,Be=ki(re,[xr,Math.max(xr,Xe-Oe)]);p.style.minWidth=xe+"px",p.style.left=Be+"px"}else{const F=T.right-q.right,re=window.innerWidth-z.right-F,je=window.innerWidth-E.right-re,xe=E.width+je,Oe=Math.max(xe,T.width),Xe=window.innerWidth-xr,Be=ki(re,[xr,Math.max(xr,Xe-Oe)]);p.style.minWidth=xe+"px",p.style.right=Be+"px"}const ue=k(),ee=window.innerHeight-xr*2,ce=N.scrollHeight,G=window.getComputedStyle(g),Z=parseInt(G.borderTopWidth,10),te=parseInt(G.paddingTop,10),U=parseInt(G.borderBottomWidth,10),M=parseInt(G.paddingBottom,10),Q=Z+te+ce+M+U,H=Math.min(w.offsetHeight*5,Q),I=window.getComputedStyle(N),L=parseInt(I.paddingTop,10),X=parseInt(I.paddingBottom,10),ae=E.top+E.height/2-xr,ve=ee-ae,pe=w.offsetHeight/2,le=w.offsetTop+pe,ye=Z+te+le,D=Q-ye;if(ye<=ae){const F=ue.length>0&&w===ue[ue.length-1].ref.current;p.style.bottom="0px";const re=g.clientHeight-N.offsetTop-N.offsetHeight,je=Math.max(ve,pe+(F?X:0)+re+U),xe=ye+je;p.style.height=xe+"px"}else{const F=ue.length>0&&w===ue[0].ref.current;p.style.top="0px";const je=Math.max(ae,Z+N.offsetTop+(F?L:0)+pe)+D;p.style.height=je+"px",N.scrollTop=ye-ae+N.offsetTop}p.style.margin=`${xr}px 0`,p.style.minHeight=H+"px",p.style.maxHeight=ee+"px",o==null||o(),requestAnimationFrame(()=>R.current=!0)}},[k,u.trigger,u.valueNode,p,g,N,w,S,u.dir,o]);_t(()=>j(),[j]);const[_,B]=h.useState();_t(()=>{g&&B(window.getComputedStyle(g).zIndex)},[g]);const V=h.useCallback(E=>{E&&C.current===!0&&(j(),P==null||P(),C.current=!1)},[j,P]);return t.jsx(rC,{scope:l,contentWrapper:p,shouldExpandOnScrollRef:R,onScrollButtonChange:V,children:t.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:t.jsx(ze.div,{...c,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});kg.displayName=eC;var tC="SelectPopperPosition",Cd=h.forwardRef((n,a)=>{const{__scopeSelect:l,align:o="start",collisionPadding:c=xr,...u}=n,f=qi(l);return t.jsx($S,{...f,...u,ref:a,align:o,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)"}})});Cd.displayName=tC;var[rC,uu]=Gs(rs,{}),kd="SelectViewport",Eg=h.forwardRef((n,a)=>{const{__scopeSelect:l,nonce:o,...c}=n,u=_n(kd,l),f=uu(kd,l),p=Ye(a,u.onViewportChange),x=h.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:o}),t.jsx(Yi.Slot,{scope:l,children:t.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:p,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:De(c.onScroll,g=>{const v=g.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:k}=f;if(k!=null&&k.current&&y){const R=Math.abs(x.current-v.scrollTop);if(R>0){const C=window.innerHeight-xr*2,N=parseFloat(y.style.minHeight),w=parseFloat(y.style.height),S=Math.max(N,w);if(S0?_:0,y.style.justifyContent="flex-end")}}}x.current=v.scrollTop})})})]})});Eg.displayName=kd;var Pg="SelectGroup",[nC,sC]=Gs(Pg),aC=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n,c=wn();return t.jsx(nC,{scope:l,id:c,children:t.jsx(ze.div,{role:"group","aria-labelledby":c,...o,ref:a})})});aC.displayName=Pg;var Rg="SelectLabel",lC=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n,c=sC(Rg,l);return t.jsx(ze.div,{id:c.id,...o,ref:a})});lC.displayName=Rg;var _i="SelectItem",[iC,Tg]=Gs(_i),_g=h.forwardRef((n,a)=>{const{__scopeSelect:l,value:o,disabled:c=!1,textValue:u,...f}=n,p=Tn(_i,l),x=_n(_i,l),g=p.value===o,[v,y]=h.useState(u??""),[k,R]=h.useState(!1),C=Ye(a,P=>{var j;return(j=x.itemRefCallback)==null?void 0:j.call(x,P,o,c)}),N=wn(),w=h.useRef("touch"),S=()=>{c||(p.onValueChange(o),p.onOpenChange(!1))};if(o==="")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(iC,{scope:l,value:o,disabled:c,textId:N,isSelected:g,onItemTextChange:h.useCallback(P=>{y(j=>j||((P==null?void 0:P.textContent)??"").trim())},[]),children:t.jsx(Yi.ItemSlot,{scope:l,value:o,disabled:c,textValue:v,children:t.jsx(ze.div,{role:"option","aria-labelledby":N,"data-highlighted":k?"":void 0,"aria-selected":g&&k,"data-state":g?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...f,ref:C,onFocus:De(f.onFocus,()=>R(!0)),onBlur:De(f.onBlur,()=>R(!1)),onClick:De(f.onClick,()=>{w.current!=="mouse"&&S()}),onPointerUp:De(f.onPointerUp,()=>{w.current==="mouse"&&S()}),onPointerDown:De(f.onPointerDown,P=>{w.current=P.pointerType}),onPointerMove:De(f.onPointerMove,P=>{var j;w.current=P.pointerType,c?(j=x.onItemLeave)==null||j.call(x):w.current==="mouse"&&P.currentTarget.focus({preventScroll:!0})}),onPointerLeave:De(f.onPointerLeave,P=>{var j;P.currentTarget===document.activeElement&&((j=x.onItemLeave)==null||j.call(x))}),onKeyDown:De(f.onKeyDown,P=>{var _;((_=x.searchRef)==null?void 0:_.current)!==""&&P.key===" "||(HS.includes(P.key)&&S(),P.key===" "&&P.preventDefault())})})})})});_g.displayName=_i;var Oa="SelectItemText",Ig=h.forwardRef((n,a)=>{const{__scopeSelect:l,className:o,style:c,...u}=n,f=Tn(Oa,l),p=_n(Oa,l),x=Tg(Oa,l),g=QS(Oa,l),[v,y]=h.useState(null),k=Ye(a,S=>y(S),x.onItemTextChange,S=>{var P;return(P=p.itemTextRefCallback)==null?void 0:P.call(p,S,x.value,x.disabled)}),R=v==null?void 0:v.textContent,C=h.useMemo(()=>t.jsx("option",{value:x.value,disabled:x.disabled,children:R},x.value),[x.disabled,x.value,R]),{onNativeOptionAdd:N,onNativeOptionRemove:w}=g;return _t(()=>(N(C),()=>w(C)),[N,w,C]),t.jsxs(t.Fragment,{children:[t.jsx(ze.span,{id:x.textId,...u,ref:k}),x.isSelected&&f.valueNode&&!f.valueNodeHasChildren?Va.createPortal(u.children,f.valueNode):null]})});Ig.displayName=Oa;var Ag="SelectItemIndicator",Mg=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n;return Tg(Ag,l).isSelected?t.jsx(ze.span,{"aria-hidden":!0,...o,ref:a}):null});Mg.displayName=Ag;var Ed="SelectScrollUpButton",Dg=h.forwardRef((n,a)=>{const l=_n(Ed,n.__scopeSelect),o=uu(Ed,n.__scopeSelect),[c,u]=h.useState(!1),f=Ye(a,o.onScrollButtonChange);return _t(()=>{if(l.viewport&&l.isPositioned){let p=function(){const g=x.scrollTop>0;u(g)};const x=l.viewport;return p(),x.addEventListener("scroll",p),()=>x.removeEventListener("scroll",p)}},[l.viewport,l.isPositioned]),c?t.jsx(Og,{...n,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:x}=l;p&&x&&(p.scrollTop=p.scrollTop-x.offsetHeight)}}):null});Dg.displayName=Ed;var Pd="SelectScrollDownButton",Lg=h.forwardRef((n,a)=>{const l=_n(Pd,n.__scopeSelect),o=uu(Pd,n.__scopeSelect),[c,u]=h.useState(!1),f=Ye(a,o.onScrollButtonChange);return _t(()=>{if(l.viewport&&l.isPositioned){let p=function(){const g=x.scrollHeight-x.clientHeight,v=Math.ceil(x.scrollTop)x.removeEventListener("scroll",p)}},[l.viewport,l.isPositioned]),c?t.jsx(Og,{...n,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:x}=l;p&&x&&(p.scrollTop=p.scrollTop+x.offsetHeight)}}):null});Lg.displayName=Pd;var Og=h.forwardRef((n,a)=>{const{__scopeSelect:l,onAutoScroll:o,...c}=n,u=_n("SelectScrollButton",l),f=h.useRef(null),p=Qi(l),x=h.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return h.useEffect(()=>()=>x(),[x]),_t(()=>{var v;const g=p().find(y=>y.ref.current===document.activeElement);(v=g==null?void 0:g.ref.current)==null||v.scrollIntoView({block:"nearest"})},[p]),t.jsx(ze.div,{"aria-hidden":!0,...c,ref:a,style:{flexShrink:0,...c.style},onPointerDown:De(c.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:De(c.onPointerMove,()=>{var g;(g=u.onItemLeave)==null||g.call(u),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:De(c.onPointerLeave,()=>{x()})})}),oC="SelectSeparator",cC=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n;return t.jsx(ze.div,{"aria-hidden":!0,...o,ref:a})});cC.displayName=oC;var Rd="SelectArrow",dC=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n,c=qi(l),u=Tn(Rd,l),f=_n(Rd,l);return u.open&&f.position==="popper"?t.jsx(BS,{...c,...o,ref:a}):null});dC.displayName=Rd;var uC="SelectBubbleInput",Fg=h.forwardRef(({__scopeSelect:n,value:a,...l},o)=>{const c=h.useRef(null),u=Ye(o,c),f=Jd(a);return h.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&v){const y=new Event("change",{bubbles:!0});v.call(p,a),p.dispatchEvent(y)}},[f,a]),t.jsx(ze.select,{...l,style:{...pg,...l.style},ref:u,defaultValue:a})});Fg.displayName=uC;function zg(n){return n===""||n===void 0}function $g(n){const a=Cn(n),l=h.useRef(""),o=h.useRef(0),c=h.useCallback(f=>{const p=l.current+f;a(p),(function x(g){l.current=g,window.clearTimeout(o.current),g!==""&&(o.current=window.setTimeout(()=>x(""),1e3))})(p)},[a]),u=h.useCallback(()=>{l.current="",window.clearTimeout(o.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(o.current),[]),[l,c,u]}function Bg(n,a,l){const c=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a,u=l?n.indexOf(l):-1;let f=fC(n,Math.max(u,0));c.length===1&&(f=f.filter(g=>g!==l));const x=f.find(g=>g.textValue.toLowerCase().startsWith(c.toLowerCase()));return x!==l?x:void 0}function fC(n,a){return n.map((l,o)=>n[(a+o)%n.length])}var hC=xg,Ug=vg,mC=jg,pC=Ng,xC=bg,Vg=wg,gC=Eg,Wg=_g,vC=Ig,yC=Mg,jC=Dg,NC=Lg;const id=hC,od=mC,xi=h.forwardRef(({className:n,children:a,...l},o)=>t.jsxs(Ug,{ref:o,className:Qe("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",n),...l,children:[a,t.jsx(pC,{asChild:!0,children:t.jsx(Di,{className:"h-4 w-4 opacity-50"})})]}));xi.displayName=Ug.displayName;const gi=h.forwardRef(({className:n,children:a,position:l="popper",...o},c)=>t.jsx(xC,{children:t.jsxs(Vg,{ref:c,className:Qe("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",n),position:l,...o,children:[t.jsx(jC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(Np,{className:"h-4 w-4"})}),t.jsx(gC,{className:"p-1",children:a}),t.jsx(NC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(Di,{className:"h-4 w-4"})})]})}));gi.displayName=Vg.displayName;const jn=h.forwardRef(({className:n,children:a,...l},o)=>t.jsxs(Wg,{ref:o,className:Qe("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",n),...l,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(yC,{children:t.jsx(Mi,{className:"h-4 w-4"})})}),t.jsx(vC,{children:a})]}));jn.displayName=Wg.displayName;const bC=["一","二","三","四","五","六","七","八","九","十"],wC=["序言","尾声","附录"];function ui(n){return n?wC.some(a=>n.includes(a)):!1}function cd(n){return n.startsWith("part:")?{type:"part",id:n.slice(5)}:n.startsWith("chapter:")?{type:"chapter",id:n.slice(8)}:n.startsWith("section:")?{type:"section",id:n.slice(8)}:null}function SC({parts:n,expandedParts:a,onTogglePart:l,onReorder:o,onReadSection:c,onDeleteSection:u,onAddSectionInPart:f,onEditPart:p,onDeletePart:x}){const[g,v]=h.useState(null),[y,k]=h.useState(null),R=(j,_)=>(g==null?void 0:g.type)===j&&(g==null?void 0:g.id)===_,C=(j,_)=>(y==null?void 0:y.type)===j&&(y==null?void 0:y.id)===_,N=h.useCallback(()=>{const j=[];for(const _ of n)for(const B of _.chapters)for(const V of B.sections)j.push({id:V.id,partId:_.id,partTitle:_.title,chapterId:B.id,chapterTitle:B.title});return j},[n]),w=h.useCallback(async(j,_,B,V)=>{var ue;j.preventDefault(),j.stopPropagation();const E=j.dataTransfer.getData("text/plain"),T=cd(E);if(!T||T.type===_&&T.id===B)return;const z=N(),q=new Map(z.map(ee=>[ee.id,ee]));if(T.type==="section"){const ee=q.get(T.id);if(ee&&ui(ee.partTitle))return}else{const ee=T.type==="part"?n.find(ce=>ce.id===T.id):n.find(ce=>ce.chapters.some(G=>G.id===T.id));if(ee&&ui(ee.title))return}if(!(V&&ui(V.partTitle))){if(_==="part"){const ee=n.find(ce=>ce.id===B);if(ee&&ui(ee.title))return}if(T.type==="part"&&_==="part"){const ee=n.map(U=>U.id),ce=ee.indexOf(T.id),G=ee.indexOf(B);if(ce===-1||G===-1)return;const Z=[...ee];Z.splice(ce,1),Z.splice(ceQ.id===U);if(M)for(const Q of M.chapters)for(const H of Q.sections){const I=q.get(H.id);I&&te.push(I)}}await o(te);return}if(T.type==="chapter"&&(_==="chapter"||_==="section"||_==="part")){const ee=n.find(I=>I.chapters.some(L=>L.id===T.id)),ce=ee==null?void 0:ee.chapters.find(I=>I.id===T.id);if(!ee||!ce)return;let G,Z,te=null;if(_==="section"){const I=q.get(B);if(!I)return;G=I.partId,Z=I.partTitle,te=B}else if(_==="chapter"){const I=n.find(ae=>ae.chapters.some(ve=>ve.id===B)),L=I==null?void 0:I.chapters.find(ae=>ae.id===B);if(!I||!L)return;G=I.id,Z=I.title;const X=z.filter(ae=>ae.chapterId===B).pop();te=(X==null?void 0:X.id)??null}else{const I=n.find(X=>X.id===B);if(!I||!I.chapters[0])return;G=I.id,Z=I.title;const L=z.filter(X=>X.partId===I.id&&X.chapterId===I.chapters[0].id);te=((ue=L[L.length-1])==null?void 0:ue.id)??null}const U=ce.sections.map(I=>I.id),M=z.filter(I=>!U.includes(I.id));let Q=M.length;if(te){const I=M.findIndex(L=>L.id===te);I>=0&&(Q=I+1)}const H=U.map(I=>({...q.get(I),partId:G,partTitle:Z,chapterId:ce.id,chapterTitle:ce.title}));await o([...M.slice(0,Q),...H,...M.slice(Q)]);return}if(T.type==="section"&&(_==="section"||_==="chapter"||_==="part")){if(!V)return;const{partId:ee,partTitle:ce,chapterId:G,chapterTitle:Z}=V;let te;if(_==="section")te=z.findIndex(L=>L.id===B);else if(_==="chapter"){const L=z.filter(X=>X.chapterId===B).pop();te=L?z.findIndex(X=>X.id===L.id)+1:z.length}else{const L=n.find(ve=>ve.id===B);if(!(L!=null&&L.chapters[0]))return;const X=z.filter(ve=>ve.partId===L.id&&ve.chapterId===L.chapters[0].id),ae=X[X.length-1];te=ae?z.findIndex(ve=>ve.id===ae.id)+1:0}const U=z.findIndex(L=>L.id===T.id);if(U===-1)return;const M=z.filter(L=>L.id!==T.id),Q=U({onDragEnter:V=>{V.preventDefault(),V.stopPropagation(),V.dataTransfer.dropEffect="move",k({type:j,id:_})},onDragOver:V=>{V.preventDefault(),V.stopPropagation(),V.dataTransfer.dropEffect="move",k({type:j,id:_})},onDragLeave:()=>k(null),onDrop:V=>{k(null);const E=cd(V.dataTransfer.getData("text/plain"));if(E&&!(j==="section"&&E.type==="section"&&E.id===_))if(j==="part")if(E.type==="part")w(V,"part",_);else{const T=n.find(q=>q.id===_);(T==null?void 0:T.chapters[0])&&B&&w(V,"part",_,B)}else j==="chapter"&&B?(E.type==="section"||E.type==="chapter")&&w(V,"chapter",_,B):j==="section"&&B&&w(V,"section",_,B)}}),P=j=>bC[j]??String(j+1);return t.jsx("div",{className:"space-y-3",children:n.map((j,_)=>{var ee,ce;const B=j.title==="序言"||j.title.includes("序言"),V=j.title==="尾声"||j.title.includes("尾声"),E=j.title==="附录"||j.title.includes("附录"),T=a.includes(j.id),z=j.chapters.length,q=j.chapters.reduce((G,Z)=>G+Z.sections.length,0);if(B&&j.chapters.length===1&&j.chapters[0].sections.length===1){const G=j.chapters[0].sections[0];return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:t.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),t.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[j.chapters[0].title," | ",G.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[G.price===0||G.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",G.price]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(G),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Er,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},j.id)}if(E)return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),t.jsx("div",{className:"space-y-3",children:j.chapters.map((G,Z)=>t.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[t.jsxs("span",{className:"text-sm text-gray-300",children:["附录",Z+1," | ",G.title]}),t.jsx(As,{className:"w-4 h-4 text-gray-500 shrink-0"})]},G.id))})]},j.id);if(V&&j.chapters.length===1&&j.chapters[0].sections.length===1){const G=j.chapters[0].sections[0];return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:t.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),t.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[j.chapters[0].title," | ",G.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[G.price===0||G.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",G.price]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(G),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Er,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},j.id)}if(V)return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),t.jsx("div",{className:"space-y-3",children:j.chapters.map(G=>G.sections.map(Z=>t.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[t.jsxs("span",{className:"text-sm text-gray-300",children:[G.title," | ",Z.title]}),t.jsxs("div",{className:"flex gap-1 shrink-0",children:[t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(Z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(Z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(Z),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Er,{className:"w-3.5 h-3.5"})})]})]},Z.id)))})]},j.id);const ue=C("part",j.id);return t.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${ue?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...S("part",j.id,{partId:j.id,partTitle:j.title,chapterId:((ee=j.chapters[0])==null?void 0:ee.id)??"",chapterTitle:((ce=j.chapters[0])==null?void 0:ce.title)??""}),children:[t.jsxs("div",{draggable:!0,onDragStart:G=>{G.stopPropagation(),G.dataTransfer.setData("text/plain","part:"+j.id),G.dataTransfer.effectAllowed="move",v({type:"part",id:j.id})},onDragEnd:()=>{v(null),k(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${R("part",j.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>l(j.id),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx(Gc,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),t.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:P(_)}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-bold text-white text-base",children:j.title}),t.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",q," 节"]})]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:G=>G.stopPropagation(),onClick:G=>G.stopPropagation(),children:[f&&t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(j),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:t.jsx(gr,{className:"w-3.5 h-3.5"})}),p&&t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>p(j),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),x&&t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>x(j),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:t.jsx(Er,{className:"w-3.5 h-3.5"})}),t.jsxs("span",{className:"text-xs text-gray-500",children:[z,"章"]}),T?t.jsx(Di,{className:"w-5 h-5 text-gray-500"}):t.jsx(As,{className:"w-5 h-5 text-gray-500"})]})]}),T&&t.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:j.chapters.map((G,Z)=>{const te=C("chapter",G.id);return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{draggable:!0,onDragStart:U=>{U.stopPropagation(),U.dataTransfer.setData("text/plain","chapter:"+G.id),U.dataTransfer.effectAllowed="move",v({type:"chapter",id:G.id})},onDragEnd:()=>{v(null),k(null)},onDragEnter:U=>{U.preventDefault(),U.stopPropagation(),U.dataTransfer.dropEffect="move",k({type:"chapter",id:G.id})},onDragOver:U=>{U.preventDefault(),U.stopPropagation(),U.dataTransfer.dropEffect="move",k({type:"chapter",id:G.id})},onDragLeave:()=>k(null),onDrop:U=>{k(null);const M=cd(U.dataTransfer.getData("text/plain"));if(!M)return;const Q={partId:j.id,partTitle:j.title,chapterId:G.id,chapterTitle:G.title};(M.type==="section"||M.type==="chapter")&&w(U,"chapter",G.id,Q)},className:`py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${te?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${R("chapter",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[t.jsx(Gc,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),t.jsxs("p",{className:"text-xs text-gray-500 pb-1",children:["第",Z+1,"章 | ",G.title]})]}),t.jsx("div",{className:"space-y-1 pl-2",children:G.sections.map(U=>{const M=C("section",U.id);return t.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+U.id),Q.dataTransfer.effectAllowed="move",v({type:"section",id:U.id})},onDragEnd:()=>{v(null),k(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${M?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...S("section",U.id,{partId:j.id,partTitle:j.title,chapterId:G.id,chapterTitle:G.title}),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx(Gc,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),t.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${U.price===0||U.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),t.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[U.id," ",U.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Q=>Q.stopPropagation(),onClick:Q=>Q.stopPropagation(),children:[U.isNew&&t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),U.price===0||U.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",U.price]}),t.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(U),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:t.jsx(Er,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},U.id)})})]},G.id)})})]},j.id)})})}function CC(n){const a=new Map;for(const c of n){const u=c.partId||"part-1",f=c.partTitle||"未分类",p=c.chapterId||"chapter-1",x=c.chapterTitle||"未分类";a.has(u)||a.set(u,{id:u,title:f,chapters:new Map});const g=a.get(u);g.chapters.has(p)||g.chapters.set(p,{id:p,title:x,sections:[]}),g.chapters.get(p).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew})}const l=Array.from(a.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes("附录")?2:c.includes("尾声")?3:1;return l.sort((c,u)=>{const f=o(c.title),p=o(u.title);return f!==p?f-p:0})}function kC(){var fe;const[n,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState([]),[f,p]=h.useState(null),[x,g]=h.useState(!1),[v,y]=h.useState(!1),[k,R]=h.useState(!1),[C,N]=h.useState(""),[w,S]=h.useState([]),[P,j]=h.useState(!1),[_,B]=h.useState(!1),V=h.useRef(null),[E,T]=h.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),[z,q]=h.useState(null),[ue,ee]=h.useState(!1),ce=CC(n),G=n.length,Z=async()=>{o(!0);try{const F=await Ke("/api/db/book?action=list");a(Array.isArray(F==null?void 0:F.sections)?F.sections:[])}catch(F){console.error(F),a([])}finally{o(!1)}};h.useEffect(()=>{Z()},[]);const te=F=>{u(re=>re.includes(F)?re.filter(je=>je!==F):[...re,F])},U=h.useCallback(F=>{const re=n,je=F.flatMap(xe=>{const Oe=re.find(Xe=>Xe.id===xe.id);return Oe?[{...Oe,partId:xe.partId,partTitle:xe.partTitle,chapterId:xe.chapterId,chapterTitle:xe.chapterTitle}]:[]});return a(je),St("/api/db/book",{action:"reorder",items:F}).then(xe=>{xe&&xe.success===!1&&(a(re),alert("排序失败: "+(xe&&typeof xe=="object"&&"error"in xe?xe.error:"未知错误")))}).catch(xe=>{a(re),console.error("排序失败:",xe),alert("排序失败: "+(xe instanceof Error?xe.message:"网络或服务异常"))}),Promise.resolve()},[n]),M=async F=>{if(confirm(`确定要删除章节「${F.title}」吗?此操作不可恢复。`))try{const re=await zs(`/api/db/book?id=${encodeURIComponent(F.id)}`);re&&re.success!==!1?(alert("已删除"),Z()):alert("删除失败: "+(re&&typeof re=="object"&&"error"in re?re.error:"未知错误"))}catch(re){console.error(re),alert("删除失败")}},Q=async F=>{y(!0);try{const re=await Ke(`/api/db/book?action=read&id=${encodeURIComponent(F.id)}`);if(re!=null&&re.success&&re.section){const je=re.section;p({id:F.id,title:re.section.title??F.title,price:re.section.price??F.price,content:re.section.content??"",filePath:F.filePath,isFree:F.isFree||F.price===0,isNew:je.isNew??F.isNew})}else p({id:F.id,title:F.title,price:F.price,content:"",filePath:F.filePath,isFree:F.isFree,isNew:F.isNew}),re&&!re.success&&alert("无法读取文件内容: "+(re.error||"未知错误"))}catch(re){console.error(re),p({id:F.id,title:F.title,price:F.price,content:"",filePath:F.filePath,isFree:F.isFree})}finally{y(!1)}},H=async()=>{var F;if(f){R(!0);try{let re=f.content||"";const je=[new RegExp(`^#+\\s*${f.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${f.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(F=f.title)==null?void 0:F.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Oe of je)re=re.replace(Oe,"");re=re.replace(/^\s*\n+/,"").trim();const xe=await St("/api/db/book",{id:f.id,title:f.title,price:f.isFree?0:f.price,content:re,isFree:f.isFree||f.price===0,isNew:f.isNew,saveToFile:!0});xe&&xe.success!==!1?(alert(`已保存章节: ${f.title}`),p(null),Z()):alert("保存失败: "+(xe&&typeof xe=="object"&&"error"in xe?xe.error:"未知错误"))}catch(re){console.error(re),alert("保存失败")}finally{R(!1)}}},I=async()=>{if(!E.id||!E.title){alert("请填写章节ID和标题");return}R(!0);try{const F=await St("/api/db/book",{id:E.id,title:E.title,price:E.price,content:E.content,partId:E.partId,chapterId:E.chapterId,saveToFile:!1});F&&F.success!==!1?(alert(`章节创建成功: ${E.title}`),g(!1),T({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),Z()):alert("创建失败: "+(F&&typeof F=="object"&&"error"in F?F.error:"未知错误"))}catch(F){console.error(F),alert("创建失败")}finally{R(!1)}},L=F=>{T(re=>{var je;return{...re,partId:F.id,chapterId:((je=F.chapters[0])==null?void 0:je.id)??"chapter-1"}}),g(!0)},X=F=>{q({id:F.id,title:F.title})},ae=async()=>{var F;if((F=z==null?void 0:z.title)!=null&&F.trim()){ee(!0);try{const re=n.map(xe=>({id:xe.id,partId:xe.partId||"part-1",partTitle:xe.partId===z.id?z.title.trim():xe.partTitle||"",chapterId:xe.chapterId||"chapter-1",chapterTitle:xe.chapterTitle||""})),je=await St("/api/db/book",{action:"reorder",items:re});je&&je.success!==!1?(q(null),Z()):alert("更新篇名失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误"))}catch(re){console.error(re),alert("更新篇名失败")}finally{ee(!1)}}},ve=async F=>{const re=n.filter(je=>je.partId===F.id).map(je=>je.id);if(re.length!==0&&confirm(`确定要删除「${F.title}」整篇吗?将删除共 ${re.length} 节内容,此操作不可恢复。`))try{for(const je of re)await zs(`/api/db/book?id=${encodeURIComponent(je)}`);Z()}catch(je){console.error(je),alert("删除失败")}},pe=async F=>{var je,xe;const re=(je=F.target.files)==null?void 0:je[0];if(re){B(!0);try{const Oe=new FormData;Oe.append("file",re),Oe.append("folder","book-images");const Be=await(await fetch(Fs("/api/upload"),{method:"POST",body:Oe,credentials:"include"})).json();if(Be!=null&&Be.success&&((xe=Be==null?void 0:Be.data)!=null&&xe.url)){const Ct=`![${re.name}](${Be.data.url})`;f&&p({...f,content:(f.content||"")+` + +`+Ct}),alert(`图片上传成功: ${Be.data.url}`)}else alert("上传失败: "+((Be==null?void 0:Be.error)||"未知错误"))}catch(Oe){console.error(Oe),alert("上传失败")}finally{B(!1),V.current&&(V.current.value="")}}},le=async()=>{var F;if(C.trim()){j(!0);try{const re=await Ke(`/api/search?q=${encodeURIComponent(C)}`);re!=null&&re.success&&((F=re.data)!=null&&F.results)?S(re.data.results):(S([]),re&&!re.success&&alert("搜索失败: "+re.error))}catch(re){console.error(re),S([]),alert("搜索失败")}finally{j(!1)}}},ye=ce.find(F=>F.id===E.partId),D=(ye==null?void 0:ye.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:["共 ",ce.length," 篇 · ",G," 节内容"]})]}),t.jsx("div",{className:"flex gap-2",children:t.jsxs(ie,{onClick:()=>{const F=typeof window<"u"?`${window.location.origin}/api-doc`:"";F&&window.open(F,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Yn,{className:"w-4 h-4 mr-2"}),"API 接口"]})})]}),t.jsx(Mt,{open:x,onOpenChange:g,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(gr,{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(J,{className:"text-gray-300",children:"章节ID *"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:E.id,onChange:F=>T({...E,id:F.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:E.price,onChange:F=>T({...E,price:Number(F.target.value)})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"章节标题 *"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:E.title,onChange:F=>T({...E,title:F.target.value})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"所属篇"}),t.jsxs(id,{value:E.partId,onValueChange:F=>T({...E,partId:F,chapterId:"chapter-1"}),children:[t.jsx(xi,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[ce.map(F=>t.jsx(jn,{value:F.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:F.title},F.id)),ce.length===0&&t.jsx(jn,{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(J,{className:"text-gray-300",children:"所属章"}),t.jsxs(id,{value:E.chapterId,onValueChange:F=>T({...E,chapterId:F}),children:[t.jsx(xi,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[D.map(F=>t.jsx(jn,{value:F.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:F.title},F.id)),D.length===0&&t.jsx(jn,{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(J,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:E.content,onChange:F=>T({...E,content:F.target.value})})]})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",onClick:()=>g(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(ie,{onClick:I,disabled:k||!E.id||!E.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),t.jsx(Mt,{open:!!z,onOpenChange:F=>!F&&q(null),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(Ht,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),z&&t.jsx("div",{className:"space-y-4 py-4",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"篇名"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:z.title,onChange:F=>q({...z,title:F.target.value}),placeholder:"输入篇名"})]})}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",onClick:()=>q(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(ie,{onClick:ae,disabled:ue||!((fe=z==null?void 0:z.title)!=null&&fe.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ue?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),t.jsx(Mt,{open:!!f,onOpenChange:()=>p(null),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(Ht,{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(J,{className:"text-gray-300",children:"章节ID"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.id,disabled:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.isFree?0:f.price,onChange:F=>p({...f,price:Number(F.target.value),isFree:Number(F.target.value)===0}),disabled:f.isFree})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"免费章节(唯一入口,小程序以 is_free 或 price=0 为准)"}),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:F=>p({...f,isFree:F.target.checked,price:F.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(J,{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.isNew??!1,onChange:F=>p({...f,isNew:F.target.checked}),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:"标记 NEW"})]})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"章节标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.title,onChange:F=>p({...f,title:F.target.value})})]}),f.filePath&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"文件路径"}),t.jsx(se,{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(J,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:V,type:"file",accept:"image/*",onChange:pe,className:"hidden"}),t.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{var F;return(F=V.current)==null?void 0:F.click()},disabled:_,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[_?t.jsx(Ze,{className:"w-4 h-4 mr-1 animate-spin"}):t.jsx(Cp,{className:"w-4 h-4 mr-1"}),"上传图片"]})]})]}),v?t.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(Xn,{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:F=>p({...f,content:F.target.value})})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>p(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsx(ie,{onClick:H,disabled:k,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),t.jsxs(ru,{defaultValue:"chapters",className:"space-y-6",children:[t.jsxs(Vi,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[t.jsxs(ar,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Vr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),t.jsxs(ar,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Qn,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),t.jsxs(ar,{value:"hooks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(ON,{className:"w-4 h-4 mr-2"}),"钩子配置"]})]}),t.jsxs(lr,{value:"chapters",className:"space-y-4",children:[t.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:t.jsx(Vr,{className:"w-6 h-6"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),t.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),t.jsxs("div",{className:"text-center shrink-0",children:[t.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:G}),t.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),t.jsxs(ie,{onClick:()=>g(!0),className:"w-full bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"新建章节"]}),l?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(SC,{parts:ce,expandedParts:c,onTogglePart:te,onReorder:U,onReadSection:Q,onDeleteSection:M,onAddSectionInPart:L,onEditPart:X,onDeletePart:ve})]}),t.jsx(lr,{value:"search",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"内容搜索"})}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:C,onChange:F=>N(F.target.value),onKeyDown:F=>F.key==="Enter"&&le()}),t.jsx(ie,{onClick:le,disabled:P||!C.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?t.jsx(Ze,{className:"w-4 h-4 animate-spin"}):t.jsx(Qn,{className:"w-4 h-4"})})]}),w.length>0&&t.jsxs("div",{className:"space-y-2 mt-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",w.length," 个结果"]}),w.map(F=>t.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>Q({id:F.id,title:F.title,price:F.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:F.id}),t.jsx("span",{className:"text-white",children:F.title})]}),t.jsx(Le,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:F.matchType==="title"?"标题匹配":"内容匹配"})]}),F.snippet&&t.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:F.snippet}),(F.partTitle||F.chapterTitle)&&t.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[F.partTitle," · ",F.chapterTitle]})]},F.id))]})]})]})}),t.jsx(lr,{value:"hooks",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"引流钩子配置"})}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[t.jsx(J,{htmlFor:"hook-chapter",className:"text-gray-300",children:"触发章节"}),t.jsxs(id,{defaultValue:"3",children:[t.jsx(xi,{id:"hook-chapter",className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{placeholder:"选择章节"})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[t.jsx(jn,{value:"1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第一章"}),t.jsx(jn,{value:"2",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第二章"}),t.jsx(jn,{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(J,{htmlFor:"message",className:"text-gray-300",children:"引流文案"}),t.jsx(Xn,{placeholder:"输入引导用户加群的文案...",id:"message",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",defaultValue:"阅读更多精彩内容,请加入Soul创业实验派对群..."})]}),t.jsx(ie,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:"保存配置"})]})]})})]})]})}var Hg=["PageUp","PageDown"],Kg=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Gg={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ys="Slider",[Td,EC,PC]=eu(Ys),[Yg]=Rn(Ys,[PC]),[RC,Xi]=Yg(Ys),Qg=h.forwardRef((n,a)=>{const{name:l,min:o=0,max:c=100,step:u=1,orientation:f="horizontal",disabled:p=!1,minStepsBetweenThumbs:x=0,defaultValue:g=[o],value:v,onValueChange:y=()=>{},onValueCommit:k=()=>{},inverted:R=!1,form:C,...N}=n,w=h.useRef(new Set),S=h.useRef(0),j=f==="horizontal"?TC:_C,[_=[],B]=Jn({prop:v,defaultProp:g,onChange:ue=>{var ce;(ce=[...w.current][S.current])==null||ce.focus(),y(ue)}}),V=h.useRef(_);function E(ue){const ee=LC(_,ue);q(ue,ee)}function T(ue){q(ue,S.current)}function z(){const ue=V.current[S.current];_[S.current]!==ue&&k(_)}function q(ue,ee,{commit:ce}={commit:!1}){const G=$C(u),Z=BC(Math.round((ue-o)/u)*u+o,G),te=ki(Z,[o,c]);B((U=[])=>{const M=MC(U,te,ee);if(zC(M,x*u)){S.current=M.indexOf(te);const Q=String(M)!==String(U);return Q&&ce&&k(M),Q?M:U}else return U})}return t.jsx(RC,{scope:n.__scopeSlider,name:l,disabled:p,min:o,max:c,valueIndexToChangeRef:S,thumbs:w.current,values:_,orientation:f,form:C,children:t.jsx(Td.Provider,{scope:n.__scopeSlider,children:t.jsx(Td.Slot,{scope:n.__scopeSlider,children:t.jsx(j,{"aria-disabled":p,"data-disabled":p?"":void 0,...N,ref:a,onPointerDown:De(N.onPointerDown,()=>{p||(V.current=_)}),min:o,max:c,inverted:R,onSlideStart:p?void 0:E,onSlideMove:p?void 0:T,onSlideEnd:p?void 0:z,onHomeKeyDown:()=>!p&&q(o,0,{commit:!0}),onEndKeyDown:()=>!p&&q(c,_.length-1,{commit:!0}),onStepKeyDown:({event:ue,direction:ee})=>{if(!p){const Z=Hg.includes(ue.key)||ue.shiftKey&&Kg.includes(ue.key)?10:1,te=S.current,U=_[te],M=u*Z*ee;q(U+M,te,{commit:!0})}}})})})})});Qg.displayName=Ys;var[qg,Xg]=Yg(Ys,{startEdge:"left",endEdge:"right",size:"width",direction:1}),TC=h.forwardRef((n,a)=>{const{min:l,max:o,dir:c,inverted:u,onSlideStart:f,onSlideMove:p,onSlideEnd:x,onStepKeyDown:g,...v}=n,[y,k]=h.useState(null),R=Ye(a,j=>k(j)),C=h.useRef(void 0),N=Bi(c),w=N==="ltr",S=w&&!u||!w&&u;function P(j){const _=C.current||y.getBoundingClientRect(),B=[0,_.width],E=fu(B,S?[l,o]:[o,l]);return C.current=_,E(j-_.left)}return t.jsx(qg,{scope:n.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:t.jsx(Jg,{dir:N,"data-orientation":"horizontal",...v,ref:R,style:{...v.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:j=>{const _=P(j.clientX);f==null||f(_)},onSlideMove:j=>{const _=P(j.clientX);p==null||p(_)},onSlideEnd:()=>{C.current=void 0,x==null||x()},onStepKeyDown:j=>{const B=Gg[S?"from-left":"from-right"].includes(j.key);g==null||g({event:j,direction:B?-1:1})}})})}),_C=h.forwardRef((n,a)=>{const{min:l,max:o,inverted:c,onSlideStart:u,onSlideMove:f,onSlideEnd:p,onStepKeyDown:x,...g}=n,v=h.useRef(null),y=Ye(a,v),k=h.useRef(void 0),R=!c;function C(N){const w=k.current||v.current.getBoundingClientRect(),S=[0,w.height],j=fu(S,R?[o,l]:[l,o]);return k.current=w,j(N-w.top)}return t.jsx(qg,{scope:n.__scopeSlider,startEdge:R?"bottom":"top",endEdge:R?"top":"bottom",size:"height",direction:R?1:-1,children:t.jsx(Jg,{"data-orientation":"vertical",...g,ref:y,style:{...g.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const w=C(N.clientY);u==null||u(w)},onSlideMove:N=>{const w=C(N.clientY);f==null||f(w)},onSlideEnd:()=>{k.current=void 0,p==null||p()},onStepKeyDown:N=>{const S=Gg[R?"from-bottom":"from-top"].includes(N.key);x==null||x({event:N,direction:S?-1:1})}})})}),Jg=h.forwardRef((n,a)=>{const{__scopeSlider:l,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onHomeKeyDown:f,onEndKeyDown:p,onStepKeyDown:x,...g}=n,v=Xi(Ys,l);return t.jsx(ze.span,{...g,ref:a,onKeyDown:De(n.onKeyDown,y=>{y.key==="Home"?(f(y),y.preventDefault()):y.key==="End"?(p(y),y.preventDefault()):Hg.concat(Kg).includes(y.key)&&(x(y),y.preventDefault())}),onPointerDown:De(n.onPointerDown,y=>{const k=y.target;k.setPointerCapture(y.pointerId),y.preventDefault(),v.thumbs.has(k)?k.focus():o(y)}),onPointerMove:De(n.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&c(y)}),onPointerUp:De(n.onPointerUp,y=>{const k=y.target;k.hasPointerCapture(y.pointerId)&&(k.releasePointerCapture(y.pointerId),u(y))})})}),Zg="SliderTrack",e0=h.forwardRef((n,a)=>{const{__scopeSlider:l,...o}=n,c=Xi(Zg,l);return t.jsx(ze.span,{"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation,...o,ref:a})});e0.displayName=Zg;var _d="SliderRange",t0=h.forwardRef((n,a)=>{const{__scopeSlider:l,...o}=n,c=Xi(_d,l),u=Xg(_d,l),f=h.useRef(null),p=Ye(a,f),x=c.values.length,g=c.values.map(k=>s0(k,c.min,c.max)),v=x>1?Math.min(...g):0,y=100-Math.max(...g);return t.jsx(ze.span,{"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,...o,ref:p,style:{...n.style,[u.startEdge]:v+"%",[u.endEdge]:y+"%"}})});t0.displayName=_d;var Id="SliderThumb",r0=h.forwardRef((n,a)=>{const l=EC(n.__scopeSlider),[o,c]=h.useState(null),u=Ye(a,p=>c(p)),f=h.useMemo(()=>o?l().findIndex(p=>p.ref.current===o):-1,[l,o]);return t.jsx(IC,{...n,ref:u,index:f})}),IC=h.forwardRef((n,a)=>{const{__scopeSlider:l,index:o,name:c,...u}=n,f=Xi(Id,l),p=Xg(Id,l),[x,g]=h.useState(null),v=Ye(a,P=>g(P)),y=x?f.form||!!x.closest("form"):!0,k=Zd(x),R=f.values[o],C=R===void 0?0:s0(R,f.min,f.max),N=DC(o,f.values.length),w=k==null?void 0:k[p.size],S=w?OC(w,C,p.direction):0;return h.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",[p.startEdge]:`calc(${C}% + ${S}px)`},children:[t.jsx(Td.ItemSlot,{scope:n.__scopeSlider,children:t.jsx(ze.span,{role:"slider","aria-label":n["aria-label"]||N,"aria-valuemin":f.min,"aria-valuenow":R,"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:v,style:R===void 0?{display:"none"}:n.style,onFocus:De(n.onFocus,()=>{f.valueIndexToChangeRef.current=o})})}),y&&t.jsx(n0,{name:c??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:R},o)]})});r0.displayName=Id;var AC="RadioBubbleInput",n0=h.forwardRef(({__scopeSlider:n,value:a,...l},o)=>{const c=h.useRef(null),u=Ye(c,o),f=Jd(a);return h.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&v){const y=new Event("input",{bubbles:!0});v.call(p,a),p.dispatchEvent(y)}},[f,a]),t.jsx(ze.input,{style:{display:"none"},...l,ref:u,defaultValue:a})});n0.displayName=AC;function MC(n=[],a,l){const o=[...n];return o[l]=a,o.sort((c,u)=>c-u)}function s0(n,a,l){const u=100/(l-a)*(n-a);return ki(u,[0,100])}function DC(n,a){return a>2?`Value ${n+1} of ${a}`:a===2?["Minimum","Maximum"][n]:void 0}function LC(n,a){if(n.length===1)return 0;const l=n.map(c=>Math.abs(c-a)),o=Math.min(...l);return l.indexOf(o)}function OC(n,a,l){const o=n/2,u=fu([0,50],[0,o]);return(o-u(a)*l)*l}function FC(n){return n.slice(0,-1).map((a,l)=>n[l+1]-a)}function zC(n,a){if(a>0){const l=FC(n);return Math.min(...l)>=a}return!0}function fu(n,a){return l=>{if(n[0]===n[1]||a[0]===a[1])return a[0];const o=(a[1]-a[0])/(n[1]-n[0]);return a[0]+o*(l-n[0])}}function $C(n){return(String(n).split(".")[1]||"").length}function BC(n,a){const l=Math.pow(10,a);return Math.round(n*l)/l}var UC=Qg,VC=e0,WC=t0,HC=r0;function KC({className:n,defaultValue:a,value:l,min:o=0,max:c=100,...u}){const f=h.useMemo(()=>Array.isArray(l)?l:Array.isArray(a)?a:[o,c],[l,a,o,c]);return t.jsxs(UC,{defaultValue:a,value:l,min:o,max:c,className:Qe("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",n),...u,children:[t.jsx(VC,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:t.jsx(WC,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:f.length},(p,x)=>t.jsx(HC,{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 GC={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function YC(){const[n,a]=h.useState(GC),[l,o]=h.useState(!0),[c,u]=h.useState(!1);h.useEffect(()=>{Ke("/api/admin/referral-settings").then(x=>{const g=x==null?void 0:x.data;g&&typeof g=="object"&&a({distributorShare:g.distributorShare??90,minWithdrawAmount:g.minWithdrawAmount??10,bindingDays:g.bindingDays??30,userDiscount:g.userDiscount??5,enableAutoWithdraw:g.enableAutoWithdraw??!1,vipOrderShareVip:g.vipOrderShareVip??20,vipOrderShareNonVip:g.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>o(!1))},[]);const f=async()=>{u(!0);try{const x={distributorShare:Number(n.distributorShare)||0,minWithdrawAmount:Number(n.minWithdrawAmount)||0,bindingDays:Number(n.bindingDays)||0,userDiscount:Number(n.userDiscount)||0,enableAutoWithdraw:!!n.enableAutoWithdraw,vipOrderShareVip:Number(n.vipOrderShareVip)||20,vipOrderShareNonVip:Number(n.vipOrderShareNonVip)||10},g=await jt("/api/admin/referral-settings",x);if(!g||g.success===!1){alert("保存失败: "+(g&&typeof g=="object"&&"error"in g?g.error:""));return}alert(`✅ 分销配置已保存成功! + +• 小程序与网站的推广规则会一起生效 +• 绑定关系会使用新的天数配置 +• 佣金比例会立即应用到新订单 + +如有缓存,请刷新前台/小程序页面。`)}catch(x){console.error(x),alert("保存失败: "+(x instanceof Error?x.message:String(x)))}finally{u(!1)}},p=x=>g=>{const v=parseFloat(g.target.value||"0");a(y=>({...y,[x]:isNaN(v)?0:v}))};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(Os,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),t.jsxs(ie,{onClick:f,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(EN,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),t.jsx(ot,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),t.jsx(Te,{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(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ri,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),t.jsx(se,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.userDiscount,onChange:p("userDiscount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(vr,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(KC,{className:"flex-1",min:10,max:100,step:1,value:[n.distributorShare],onValueChange:([x])=>a(g=>({...g,distributorShare:x}))}),t.jsx(se,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:n.distributorShare,onChange:p("distributorShare")})]}),t.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",t.jsxs("span",{className:"text-[#38bdac] font-mono",children:[n.distributorShare,"%"]}),";会员订单见下方。"]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ri,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),t.jsx(se,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareVip,onChange:p("vipOrderShareVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ri,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),t.jsx(se,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareNonVip,onChange:p("vipOrderShareNonVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(vr,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),t.jsx(se,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:n.bindingDays,onChange:p("bindingDays")}),t.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(Os,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),t.jsx(ot,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),t.jsx(Te,{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(J,{className:"text-gray-300",children:"最低提现金额(元)"}),t.jsx(se,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:n.minWithdrawAmount,onChange:p("minWithdrawAmount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{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(ht,{checked:n.enableAutoWithdraw,onCheckedChange:x=>a(g=>({...g,enableAutoWithdraw:x}))}),t.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Ue,{children:t.jsxs(Ve,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[t.jsx(ri,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),t.jsxs(Te,{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 Ur={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function sp(n){return Array.isArray(n)?n.map(a=>a&&typeof a=="object"&&"label"in a&&"value"in a?{label:String(a.label),value:String(a.value)}:{label:"",value:""}).filter(a=>a.label||a.value):Ur.stats}function ap(n){return Array.isArray(n)?n.map(a=>typeof a=="string"?a:String(a??"")).filter(Boolean):Ur.highlights}function QC(){const[n,a]=h.useState(Ur),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(!1),x=h.useRef(null);h.useEffect(()=>{Ke("/api/admin/author-settings").then(S=>{const P=S==null?void 0:S.data;P&&typeof P=="object"&&a({name:String(P.name??Ur.name),avatar:String(P.avatar??Ur.avatar),avatarImg:String(P.avatarImg??""),title:String(P.title??Ur.title),bio:String(P.bio??Ur.bio),stats:sp(P.stats).length?sp(P.stats):Ur.stats,highlights:ap(P.highlights).length?ap(P.highlights):Ur.highlights})}).catch(console.error).finally(()=>o(!1))},[]);const g=async()=>{u(!0);try{const S={name:n.name,avatar:n.avatar||"K",avatarImg:n.avatarImg,title:n.title,bio:n.bio,stats:n.stats.filter(_=>_.label||_.value),highlights:n.highlights.filter(Boolean)},P=await jt("/api/admin/author-settings",S);if(!P||P.success===!1){alert("保存失败: "+(P&&typeof P=="object"&&"error"in P?P.error:""));return}u(!1);const j=document.createElement("div");j.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",j.textContent="作者设置已保存",document.body.appendChild(j),setTimeout(()=>j.remove(),2e3)}catch(S){console.error(S),alert("保存失败: "+(S instanceof Error?S.message:String(S)))}finally{u(!1)}},v=async S=>{var j;const P=(j=S.target.files)==null?void 0:j[0];if(P){p(!0);try{const _=new FormData;_.append("file",P),_.append("folder","avatars");const B=Bd(),V={};B&&(V.Authorization=`Bearer ${B}`);const T=await(await fetch(Fs("/api/upload"),{method:"POST",body:_,credentials:"include",headers:V})).json();T!=null&&T.success&&(T!=null&&T.url)?a(z=>({...z,avatarImg:T.url})):alert("上传失败: "+((T==null?void 0:T.error)||"未知错误"))}catch(_){console.error(_),alert("上传失败")}finally{p(!1),x.current&&(x.current.value="")}}},y=()=>a(S=>({...S,stats:[...S.stats,{label:"",value:""}]})),k=S=>a(P=>({...P,stats:P.stats.filter((j,_)=>_!==S)})),R=(S,P,j)=>a(_=>({..._,stats:_.stats.map((B,V)=>V===S?{...B,[P]:j}:B)})),C=()=>a(S=>({...S,highlights:[...S.highlights,""]})),N=S=>a(P=>({...P,highlights:P.highlights.filter((j,_)=>_!==S)})),w=(S,P)=>a(j=>({...j,highlights:j.highlights.map((_,B)=>B===S?P:_)}));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(qn,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),t.jsxs(ie,{onClick:g,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(qn,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),t.jsx(ot,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),t.jsxs(Te,{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(J,{className:"text-gray-300",children:"姓名"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:n.name,onChange:S=>a(P=>({...P,name:S.target.value})),placeholder:"卡若"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:n.avatar,onChange:S=>a(P=>({...P,avatar:S.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Cp,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:n.avatarImg,onChange:S=>a(P=>({...P,avatarImg:S.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),t.jsx("input",{ref:x,type:"file",accept:"image/*",className:"hidden",onChange:v}),t.jsxs(ie,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:f,onClick:()=>{var S;return(S=x.current)==null?void 0:S.click()},children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),f?"上传中...":"上传"]})]}),n.avatarImg&&t.jsx("div",{className:"mt-2",children:t.jsx("img",{src:n.avatarImg.startsWith("http")?n.avatarImg:Fs(n.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"头衔"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:n.title,onChange:S=>a(P=>({...P,title:S.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"个人简介"}),t.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:n.bio,onChange:S=>a(P=>({...P,bio:S.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsx(Ve,{className:"text-white",children:"统计数据"}),t.jsx(ot,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),t.jsxs(Te,{className:"space-y-3",children:[n.stats.map((S,P)=>t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:S.label,onChange:j=>R(P,"label",j.target.value),placeholder:"标签"}),t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:S.value,onChange:j=>R(P,"value",j.target.value),placeholder:"数值"}),t.jsx(ie,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>k(P),children:t.jsx(ir,{className:"w-4 h-4"})})]},P)),t.jsxs(ie,{variant:"outline",size:"sm",onClick:y,className:"border-gray-600 text-gray-400",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsx(Ve,{className:"text-white",children:"亮点标签"}),t.jsx(ot,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),t.jsxs(Te,{className:"space-y-3",children:[n.highlights.map((S,P)=>t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:S,onChange:j=>w(P,j.target.value),placeholder:"5年私域运营经验"}),t.jsx(ie,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>N(P),children:t.jsx(ir,{className:"w-4 h-4"})})]},P)),t.jsxs(ie,{variant:"outline",size:"sm",onClick:C,className:"border-gray-600 text-gray-400",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}const qC={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},XC={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},JC={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...XC}},ZC={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0};function e4(){const[n,a]=h.useState(JC),[l,o]=h.useState(ZC),[c,u]=h.useState(qC),[f,p]=h.useState(!1),[x,g]=h.useState(!0),[v,y]=h.useState(!1),[k,R]=h.useState(""),[C,N]=h.useState(""),[w,S]=h.useState(!1),[P,j]=h.useState(!1),_=(T,z,q=!1)=>{R(T),N(z),S(q),y(!0)};h.useEffect(()=>{(async()=>{try{const z=await Ke("/api/admin/settings");if(!z||z.success===!1)return;if(z.featureConfig&&Object.keys(z.featureConfig).length&&o(q=>({...q,...z.featureConfig})),z.mpConfig&&typeof z.mpConfig=="object"&&u(q=>({...q,...z.mpConfig})),z.siteSettings&&typeof z.siteSettings=="object"){const q=z.siteSettings;a(ue=>({...ue,...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:{...ue.authorInfo,...q.authorInfo}}}))}}catch(z){console.error("Load settings error:",z)}finally{g(!1)}})()},[]);const B=async(T,z)=>{j(!0);try{const q=await jt("/api/admin/settings",{featureConfig:T});if(!q||q.success===!1){z(),_("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}_("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(q){console.error("Save feature config error:",q),z(),_("保存失败",q instanceof Error?q.message:String(q),!0)}finally{j(!1)}},V=(T,z)=>{const q=l,ue={...q,[T]:z};o(ue),B(ue,()=>o(q))},E=async()=>{p(!0);try{const T=await jt("/api/admin/settings",{featureConfig:l,siteSettings:{sectionPrice:n.sectionPrice,baseBookPrice:n.baseBookPrice,distributorShare:n.distributorShare,authorInfo:n.authorInfo},mpConfig:{...c,appId:c.appId||"",withdrawSubscribeTmplId:c.withdrawSubscribeTmplId||"",mchId:c.mchId||"",minWithdraw:typeof c.minWithdraw=="number"?c.minWithdraw:10}});if(!T||T.success===!1){_("保存失败",(T==null?void 0:T.error)??"未知错误",!0);return}_("已保存","设置已保存成功。")}catch(T){console.error("Save settings error:",T),_("保存失败",T instanceof Error?T.message:String(T),!0)}finally{p(!1)}};return x?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(ie,{onClick:E,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(jm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),t.jsx(ot,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),t.jsxs(Te,{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(J,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(jm,{className:"w-3 h-3"}),"主理人名称"]}),t.jsx(se,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:n.authorInfo.name??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,name:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[t.jsx($a,{className:"w-3 h-3"}),"开播日期"]}),t.jsx(se,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:n.authorInfo.startDate??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,startDate:T.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[t.jsx($a,{className:"w-3 h-3"}),"直播时间"]}),t.jsx(se,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:n.authorInfo.liveTime??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,liveTime:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(vN,{className:"w-3 h-3"}),"直播平台"]}),t.jsx(se,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:n.authorInfo.platform??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,platform:T.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(Vr,{className:"w-3 h-3"}),"简介描述"]}),t.jsx(se,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:n.authorInfo.description??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,description:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),t.jsx(Xn,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:n.authorInfo.bio??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,bio:T.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:(n.authorInfo.name??"K").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-semibold",children:n.authorInfo.name}),t.jsx("p",{className:"text-gray-400 text-xs",children:n.authorInfo.description}),t.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",n.authorInfo.liveTime," · ",n.authorInfo.platform]})]})]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),t.jsx(Te,{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(J,{className:"text-gray-300",children:"单节价格 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:n.sectionPrice,onChange:T=>a(z=>({...z,sectionPrice:Number.parseFloat(T.target.value)||1}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"整本价格 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:n.baseBookPrice,onChange:T=>a(z=>({...z,baseBookPrice:Number.parseFloat(T.target.value)||9.9}))})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(xd,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),t.jsx(ot,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),t.jsx(Te,{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(J,{className:"text-gray-300",children:"小程序 AppID"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:c.appId??"",onChange:T=>u(z=>({...z,appId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"提现订阅模板 ID"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:c.withdrawSubscribeTmplId??"",onChange:T=>u(z=>({...z,withdrawSubscribeTmplId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"微信支付商户号"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:c.mchId??"",onChange:T=>u(z=>({...z,mchId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"最低提现金额 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.minWithdraw??10,onChange:T=>u(z=>({...z,minWithdraw:Number.parseFloat(T.target.value)||10}))})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Ni,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),t.jsx(ot,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),t.jsxs(Te,{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(vr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(J,{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(ht,{id:"match-enabled",checked:l.matchEnabled,disabled:P,onCheckedChange:T=>V("matchEnabled",T)})]}),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(qj,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(J,{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(ht,{id:"referral-enabled",checked:l.referralEnabled,disabled:P,onCheckedChange:T=>V("referralEnabled",T)})]}),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(Vr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(J,{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(ht,{id:"search-enabled",checked:l.searchEnabled,disabled:P,onCheckedChange:T=>V("searchEnabled",T)})]}),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(Ni,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(J,{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(ht,{id:"about-enabled",checked:l.aboutEnabled,disabled:P,onCheckedChange:T=>V("aboutEnabled",T)})]})]}),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(Mt,{open:v,onOpenChange:y,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[t.jsxs(Dt,{children:[t.jsx(Lt,{className:w?"text-red-400":"text-[#38bdac]",children:k}),t.jsx(U1,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:C})]}),t.jsx(Kt,{className:"mt-4",children:t.jsx(ie,{onClick:()=>y(!1),className:w?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const lp={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 t4(){const[n,a]=h.useState(!1),[l,o]=h.useState(lp),[c,u]=h.useState(""),f=async()=>{a(!0);try{const S=await Ke("/api/config");S!=null&&S.paymentMethods&&o({...lp,...S.paymentMethods})}catch(S){console.error(S)}finally{a(!1)}};h.useEffect(()=>{f()},[]);const p=async()=>{a(!0);try{await jt("/api/db/config",{key:"payment_methods",value:l,description:"支付方式配置"}),alert("配置已保存!")}catch(S){console.error("保存失败:",S),alert("保存失败: "+(S instanceof Error?S.message:String(S)))}finally{a(!1)}},x=(S,P)=>{navigator.clipboard.writeText(S),u(P),setTimeout(()=>u(""),2e3)},g=(S,P)=>{o(j=>({...j,wechat:{...j.wechat,[S]:P}}))},v=(S,P)=>{o(j=>({...j,alipay:{...j.alipay,[S]:P}}))},y=(S,P)=>{o(j=>({...j,usdt:{...j.usdt,[S]:P}}))},k=(S,P)=>{o(j=>({...j,paypal:{...j.paypal,[S]:P}}))},R=l.wechat,C=l.alipay,N=l.usdt,w=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(ie,{variant:"outline",onClick:f,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"同步配置"]}),t.jsxs(ie,{onClick:p,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{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(bp,{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(ru,{defaultValue:"wechat",className:"space-y-6",children:[t.jsxs(Vi,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[t.jsxs(ar,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[t.jsx(xd,{className:"w-4 h-4 mr-2"}),"微信"]}),t.jsxs(ar,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[t.jsx(hd,{className:"w-4 h-4 mr-2"}),"支付宝"]}),t.jsxs(ar,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[t.jsx(vm,{className:"w-4 h-4 mr-2"}),"USDT"]}),t.jsxs(ar,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[t.jsx(md,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),t.jsx(lr,{value:"wechat",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{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(xd,{className:"w-5 h-5"}),"微信支付配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),t.jsx(ht,{checked:!!R.enabled,onCheckedChange:S=>g("enabled",S)})]}),t.jsxs(Te,{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(J,{className:"text-gray-300",children:"网站AppID"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(R.websiteAppId??""),onChange:S=>g("websiteAppId",S.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"商户号"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(R.merchantId??""),onChange:S=>g("merchantId",S.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(ji,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"微信收款码/支付链接"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(R.qrCode??""),onChange:S=>g("qrCode",S.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(J,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),t.jsx(se,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(R.groupQrCode??""),onChange:S=>g("groupQrCode",S.target.value)}),t.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),t.jsx(lr,{value:"alipay",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{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(hd,{className:"w-5 h-5"}),"支付宝配置"]}),t.jsx(ot,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),t.jsx(ht,{checked:!!C.enabled,onCheckedChange:S=>v("enabled",S)})]}),t.jsxs(Te,{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(J,{className:"text-gray-300",children:"合作者身份 (PID)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.partnerId??""),onChange:S=>v("partnerId",S.target.value)}),t.jsx(ie,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>x(String(C.partnerId??""),"pid"),children:c==="pid"?t.jsx(Mi,{className:"w-4 h-4 text-green-500"}):t.jsx(Sp,{className:"w-4 h-4 text-gray-400"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"安全校验码 (Key)"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.securityKey??""),onChange:S=>v("securityKey",S.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(ji,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(C.qrCode??""),onChange:S=>v("qrCode",S.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),t.jsx(lr,{value:"usdt",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{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(vm,{className:"w-5 h-5"}),"USDT配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),t.jsx(ht,{checked:!!N.enabled,onCheckedChange:S=>y("enabled",S)})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{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(N.network??"TRC20"),onChange:S=>y("network",S.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(J,{className:"text-gray-300",children:"收款地址"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(N.address??""),onChange:S=>y("address",S.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:S=>y("exchangeRate",Number.parseFloat(S.target.value)||7.2)})]})]})]})}),t.jsx(lr,{value:"paypal",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{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(md,{className:"w-5 h-5"}),"PayPal配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),t.jsx(ht,{checked:!!w.enabled,onCheckedChange:S=>k("enabled",S)})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"PayPal邮箱"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(w.email??""),onChange:S=>k("email",S.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:S=>k("exchangeRate",Number(S.target.value)||7.2)})]})]})]})})]})]})}const r4={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},n4={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},s4={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function a4(){const[n,a]=h.useState({siteConfig:{...r4},menuConfig:{...n4},pageConfig:{...s4}}),[l,o]=h.useState(!1),[c,u]=h.useState(!1);h.useEffect(()=>{Ke("/api/config").then(v=>{v!=null&&v.siteConfig&&a(y=>({...y,siteConfig:{...y.siteConfig,...v.siteConfig}})),v!=null&&v.menuConfig&&a(y=>({...y,menuConfig:{...y.menuConfig,...v.menuConfig}})),v!=null&&v.pageConfig&&a(y=>({...y,pageConfig:{...y.pageConfig,...v.pageConfig}}))}).catch(console.error)},[]);const f=async()=>{u(!0);try{await jt("/api/db/config",{key:"site_config",value:n.siteConfig,description:"网站基础配置"}),await jt("/api/db/config",{key:"menu_config",value:n.menuConfig,description:"底部菜单配置"}),await jt("/api/db/config",{key:"page_config",value:n.pageConfig,description:"页面标题配置"}),o(!0),setTimeout(()=>o(!1),2e3),alert("配置已保存")}catch(v){console.error(v),alert("保存失败: "+(v instanceof Error?v.message:String(v)))}finally{u(!1)}},p=n.siteConfig,x=n.menuConfig,g=n.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(ie,{onClick:f,disabled:c,className:`${l?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),c?"保存中...":l?"已保存":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(md,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),t.jsx(ot,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),t.jsxs(Te,{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(J,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),t.jsx(se,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteName??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteName:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),t.jsx(se,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteTitle??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteTitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),t.jsx(se,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteDescription??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteDescription:v.target.value}}))})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),t.jsx(se,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:p.logo??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,logo:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),t.jsx(se,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:p.favicon??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,favicon:v.target.value}}))})]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(SN,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),t.jsx(ot,{className:"text-gray-400",children:"配置网站主题色"})]}),t.jsx(Te,{children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"space-y-2 flex-1",children:[t.jsx(J,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(se,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:p.primaryColor??"#00CED1",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,primaryColor:v.target.value}}))}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:p.primaryColor??"#00CED1",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,primaryColor:v.target.value}}))})]})]}),t.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:p.primaryColor??"#00CED1"},children:"预览"})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(jN,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),t.jsx(ot,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),t.jsx(Te,{className:"space-y-4",children:Object.entries(x).map(([v,y])=>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(ht,{checked:(y==null?void 0:y.enabled)??!0,onCheckedChange:k=>a(R=>({...R,menuConfig:{...R.menuConfig,[v]:{...y,enabled:k}}}))}),t.jsx("span",{className:"text-gray-300 w-16 capitalize",children:v}),t.jsx(se,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(y==null?void 0:y.label)??"",onChange:k=>a(R=>({...R,menuConfig:{...R.menuConfig,[v]:{...y,label:k.target.value}}}))})]}),t.jsx("span",{className:`text-sm ${y!=null&&y.enabled?"text-green-400":"text-gray-500"}`,children:y!=null&&y.enabled?"显示":"隐藏"})]},v))})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Kj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),t.jsxs(Te,{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(J,{className:"text-gray-300",children:"首页标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.homeTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,homeTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"首页副标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.homeSubtitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,homeSubtitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"目录页标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.chaptersTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,chaptersTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"匹配页标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.matchTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,matchTitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"我的页标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.myTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,myTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"关于作者标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.aboutTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,aboutTitle:v.target.value}}))})]})]})]})]})]})]})}function l4(){const[n,a]=h.useState(""),[l,o]=h.useState(""),[c,u]=h.useState(""),[f,p]=h.useState({}),x=async()=>{var R,C,N,w;try{const S=await Ke("/api/config"),P=(C=(R=S==null?void 0:S.liveQRCodes)==null?void 0:R[0])==null?void 0:C.urls;Array.isArray(P)&&a(P.join(` +`));const j=(w=(N=S==null?void 0:S.paymentMethods)==null?void 0:N.wechat)==null?void 0:w.groupQrCode;j&&o(j),p({paymentMethods:S==null?void 0:S.paymentMethods,liveQRCodes:S==null?void 0:S.liveQRCodes})}catch(S){console.error(S)}};h.useEffect(()=>{x()},[]);const g=(R,C)=>{navigator.clipboard.writeText(R),u(C),setTimeout(()=>u(""),2e3)},v=async()=>{try{const R=n.split(` +`).map(N=>N.trim()).filter(Boolean),C=[...f.liveQRCodes||[]];C[0]?C[0].urls=R:C.push({id:"live-1",name:"微信群活码",urls:R,clickCount:0}),await jt("/api/db/config",{key:"live_qr_codes",value:C,description:"群活码配置"}),alert("群活码配置已保存!"),await x()}catch(R){console.error(R),alert("保存失败: "+(R instanceof Error?R.message:String(R)))}},y=async()=>{var R;try{await jt("/api/db/config",{key:"payment_methods",value:{...f.paymentMethods||{},wechat:{...((R=f.paymentMethods)==null?void 0:R.wechat)||{},groupQrCode:l}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await x()}catch(C){console.error(C),alert("保存失败: "+(C instanceof Error?C.message:String(C)))}},k=()=>{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(bp,{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(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(Sm,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),t.jsx(ot,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(wm,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(se,{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:R=>o(R.target.value)}),t.jsx(ie,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>g(l,"group"),children:c==="group"?t.jsx(Mi,{className:"w-4 h-4 text-green-500"}):t.jsx(Sp,{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(ji,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(ie,{onClick:y,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),"保存配置"]}),t.jsxs(ie,{onClick:k,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[t.jsx(ji,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Sm,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),t.jsx(ot,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(wm,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),t.jsx(Xn,{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:n,onChange:R=>a(R.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:[n.split(` +`).filter(Boolean).length," 个"]})]}),t.jsxs(ie,{onClick:v,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(bi,{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 ip={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}},i4=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function o4(){const[n,a]=h.useState(ip),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(!1),[x,g]=h.useState(null),[v,y]=h.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),k=async()=>{o(!0);try{const j=await Ke("/api/db/config/full?key=match_config"),_=(j==null?void 0:j.data)??(j==null?void 0:j.config);_&&a({...ip,..._})}catch(j){console.error("加载匹配配置失败:",j)}finally{o(!1)}};h.useEffect(()=>{k()},[]);const R=async()=>{u(!0);try{const j=await jt("/api/db/config",{key:"match_config",value:n,description:"匹配功能配置"});j&&j.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(j&&typeof j=="object"&&"error"in j?j.error:"未知错误"))}catch(j){console.error("保存配置失败:",j),alert("保存失败")}finally{u(!1)}},C=j=>{g(j),y({id:j.id,label:j.label,matchLabel:j.matchLabel,icon:j.icon,matchFromDB:j.matchFromDB,showJoinAfterMatch:j.showJoinAfterMatch,price:j.price,enabled:j.enabled}),p(!0)},N=()=>{g(null),y({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),p(!0)},w=()=>{if(!v.id||!v.label){alert("请填写类型ID和名称");return}const j=[...n.matchTypes];if(x){const _=j.findIndex(B=>B.id===x.id);_!==-1&&(j[_]={...v})}else{if(j.some(_=>_.id===v.id)){alert("类型ID已存在");return}j.push({...v})}a({...n,matchTypes:j}),p(!1)},S=j=>{confirm("确定要删除这个匹配类型吗?")&&a({...n,matchTypes:n.matchTypes.filter(_=>_.id!==j)})},P=j=>{a({...n,matchTypes:n.matchTypes.map(_=>_.id===j?{..._,enabled:!_.enabled}:_)})};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(Ni,{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(ie,{variant:"outline",onClick:k,disabled:l,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]}),t.jsxs(ie,{onClick:R,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ZN,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),t.jsxs(Te,{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(J,{className:"text-gray-300",children:"每日免费匹配次数"}),t.jsx(se,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.freeMatchLimit,onChange:j=>a({...n,freeMatchLimit:parseInt(j.target.value,10)||0})}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"付费匹配价格(元)"}),t.jsx(se,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:n.matchPrice,onChange:j=>a({...n,matchPrice:parseFloat(j.target.value)||1})}),t.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"每日最大匹配次数"}),t.jsx(se,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.settings.maxMatchesPerDay,onChange:j=>a({...n,settings:{...n.settings,maxMatchesPerDay:parseInt(j.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(ht,{checked:n.settings.enableFreeMatches,onCheckedChange:j=>a({...n,settings:{...n.settings,enableFreeMatches:j}})}),t.jsx(J,{className:"text-gray-300",children:"启用免费匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:n.settings.enablePaidMatches,onCheckedChange:j=>a({...n,settings:{...n.settings,enablePaidMatches:j}})}),t.jsx(J,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Ue,{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(vr,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),t.jsx(ot,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),t.jsxs(ie,{onClick:N,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(gr,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),t.jsx(Te,{children:t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{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(Qr,{children:n.matchTypes.map(j=>t.jsxs(st,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(ke,{children:t.jsx("span",{className:"text-2xl",children:j.icon})}),t.jsx(ke,{className:"font-mono text-gray-300",children:j.id}),t.jsx(ke,{className:"text-white font-medium",children:j.label}),t.jsx(ke,{className:"text-gray-300",children:j.matchLabel}),t.jsx(ke,{children:t.jsxs(Le,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",j.price]})}),t.jsx(ke,{children:j.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(ke,{children:t.jsx(ht,{checked:j.enabled,onCheckedChange:()=>P(j.id)})}),t.jsx(ke,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>C(j),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>S(j.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:t.jsx(Er,{className:"w-4 h-4"})})]})})]},j.id))})]})})]}),t.jsx(Mt,{open:f,onOpenChange:p,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[x?t.jsx(Ht,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(gr,{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(J,{className:"text-gray-300",children:"类型ID(英文)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:v.id,onChange:j=>y({...v,id:j.target.value}),disabled:!!x})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"图标"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:i4.map(j=>t.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${v.icon===j?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>y({...v,icon:j}),children:j},j))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"显示名称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:v.label,onChange:j=>y({...v,label:j.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"匹配标签"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:v.matchLabel,onChange:j=>y({...v,matchLabel:j.target.value})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"单次匹配价格(元)"}),t.jsx(se,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:v.price,onChange:j=>y({...v,price:parseFloat(j.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(ht,{checked:v.matchFromDB,onCheckedChange:j=>y({...v,matchFromDB:j})}),t.jsx(J,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:v.showJoinAfterMatch,onCheckedChange:j=>y({...v,showJoinAfterMatch:j})}),t.jsx(J,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:v.enabled,onCheckedChange:j=>y({...v,enabled:j})}),t.jsx(J,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",onClick:()=>p(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsxs(ie,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const op={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function c4(){const[n,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f,p]=h.useState(10),[x,g]=h.useState(""),[v,y]=h.useState(!0),[k,R]=h.useState(null);async function C(){y(!0),R(null);try{const w=new URLSearchParams({page:String(c),pageSize:String(f)});x&&w.set("matchType",x);const S=await Ke(`/api/db/match-records?${w}`);S!=null&&S.success?(a(S.records||[]),o(S.total??0)):R("加载匹配记录失败")}catch(w){console.error("加载匹配记录失败",w),R("加载失败,请检查网络后重试")}finally{y(!1)}}h.useEffect(()=>{C()},[c,x]);const N=Math.ceil(l/f)||1;return t.jsxs("div",{className:"p-8 w-full",children:[k&&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:k}),t.jsx("button",{type:"button",onClick:()=>R(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:w=>{g(w.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(op).map(([w,S])=>t.jsx("option",{value:w,children:S},w))]}),t.jsxs("button",{type:"button",onClick:C,disabled:v,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(Ze,{className:`w-4 h-4 ${v?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Te,{className:"p-0",children:v?t.jsxs("div",{className:"flex justify-center py-12",children:[t.jsx(Ze,{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(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{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(Qr,{children:[n.map(w=>t.jsxs(st,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(ke,{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:[w.userAvatar?t.jsx("img",{src:w.userAvatar,alt:"",className:"w-full h-full object-cover",onError:S=>{S.currentTarget.style.display="none";const P=S.currentTarget.nextElementSibling;P&&P.classList.remove("hidden")}}):null,t.jsx("span",{className:w.userAvatar?"hidden":"",children:(w.userNickname||w.userId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:w.userNickname||w.userId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.userId.slice(0,16),"..."]})]})]})}),t.jsx(ke,{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:[w.matchedUserAvatar?t.jsx("img",{src:w.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:S=>{S.currentTarget.style.display="none";const P=S.currentTarget.nextElementSibling;P&&P.classList.remove("hidden")}}):null,t.jsx("span",{className:w.matchedUserAvatar?"hidden":"",children:(w.matchedNickname||w.matchedUserId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:w.matchedNickname||w.matchedUserId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.matchedUserId.slice(0,16),"..."]})]})]})}),t.jsx(ke,{children:t.jsx(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:op[w.matchType]||w.matchType})}),t.jsxs(ke,{className:"text-gray-400 text-sm",children:[w.phone&&t.jsxs("div",{children:["📱 ",w.phone]}),w.wechatId&&t.jsxs("div",{children:["💬 ",w.wechatId]}),!w.phone&&!w.wechatId&&"-"]}),t.jsx(ke,{className:"text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleString():"-"})]},w.id)),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),t.jsx(Sn,{page:c,totalPages:N,total:l,pageSize:f,onPageChange:u,onPageSizeChange:w=>{p(w),u(1)}})]})})})]})}function d4(){const[n,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(null),[x,g]=h.useState(""),[v,y]=h.useState(0),[k,R]=h.useState(!1);async function C(){o(!0);try{const j=await Ke("/api/db/vip-roles");j!=null&&j.success&&j.data&&a(j.data)}catch(j){console.error("Load roles error:",j)}finally{o(!1)}}h.useEffect(()=>{C()},[]);const N=()=>{p(null),g(""),y(n.length>0?Math.max(...n.map(j=>j.sort))+1:0),u(!0)},w=j=>{p(j),g(j.name),y(j.sort),u(!0)},S=async()=>{if(!x.trim()){alert("角色名称不能为空");return}R(!0);try{if(f){const j=await St("/api/db/vip-roles",{id:f.id,name:x.trim(),sort:v});j!=null&&j.success?(u(!1),C()):alert("更新失败: "+(j==null?void 0:j.error))}else{const j=await jt("/api/db/vip-roles",{name:x.trim(),sort:v});j!=null&&j.success?(u(!1),C()):alert("新增失败: "+(j==null?void 0:j.error))}}catch(j){console.error("Save error:",j),alert("保存失败")}finally{R(!1)}},P=async j=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const _=await zs(`/api/db/vip-roles?id=${j}`);_!=null&&_.success?C():alert("删除失败: "+(_==null?void 0:_.error))}catch(_){console.error("Delete error:",_),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(Li,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),t.jsxs(ie,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{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(Qr,{children:[n.map(j=>t.jsxs(st,{className:"border-gray-700/50",children:[t.jsx(ke,{className:"text-gray-300",children:j.id}),t.jsx(ke,{className:"text-white",children:j.name}),t.jsx(ke,{className:"text-gray-400",children:j.sort}),t.jsxs(ke,{className:"text-right",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>w(j),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>P(j.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Er,{className:"w-4 h-4"})})]})]},j.id)),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),t.jsx(Mt,{open:c,onOpenChange:u,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(Dt,{children:t.jsx(Lt,{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(J,{className:"text-gray-300",children:"角色名称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:x,onChange:j=>g(j.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:v,onChange:j=>y(parseInt(j.target.value,10)||0)})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:S,disabled:k,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),k?"保存中...":"保存"]})]})]})})]})}function u4(){const[n,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(null),[x,g]=h.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[v,y]=h.useState(!1),[k,R]=h.useState(!1),C=h.useRef(null),N=async E=>{var z;const T=(z=E.target.files)==null?void 0:z[0];if(T){R(!0);try{const q=new FormData;q.append("file",T),q.append("folder","mentors");const ue=Bd(),ee={};ue&&(ee.Authorization=`Bearer ${ue}`);const G=await(await fetch(Fs("/api/upload"),{method:"POST",body:q,credentials:"include",headers:ee})).json();G!=null&&G.success&&(G!=null&&G.url)?g(Z=>({...Z,avatar:G.url})):alert("上传失败: "+((G==null?void 0:G.error)||"未知错误"))}catch(q){console.error(q),alert("上传失败")}finally{R(!1),C.current&&(C.current.value="")}}};async function w(){o(!0);try{const E=await Ke("/api/db/mentors");E!=null&&E.success&&E.data&&a(E.data)}catch(E){console.error("Load mentors error:",E)}finally{o(!1)}}h.useEffect(()=>{w()},[]);const S=()=>{g({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(E=>E.sort))+1:0,enabled:!0})},P=()=>{p(null),S(),u(!0)},j=E=>{p(E),g({name:E.name,avatar:E.avatar||"",intro:E.intro||"",tags:E.tags||"",priceSingle:E.priceSingle!=null?String(E.priceSingle):"",priceHalfYear:E.priceHalfYear!=null?String(E.priceHalfYear):"",priceYear:E.priceYear!=null?String(E.priceYear):"",quote:E.quote||"",whyFind:E.whyFind||"",offering:E.offering||"",judgmentStyle:E.judgmentStyle||"",sort:E.sort,enabled:E.enabled??!0}),u(!0)},_=async()=>{if(!x.name.trim()){alert("导师姓名不能为空");return}y(!0);try{const E=z=>z===""?void 0:parseFloat(z),T={name:x.name.trim(),avatar:x.avatar.trim()||void 0,intro:x.intro.trim()||void 0,tags:x.tags.trim()||void 0,priceSingle:E(x.priceSingle),priceHalfYear:E(x.priceHalfYear),priceYear:E(x.priceYear),quote:x.quote.trim()||void 0,whyFind:x.whyFind.trim()||void 0,offering:x.offering.trim()||void 0,judgmentStyle:x.judgmentStyle.trim()||void 0,sort:x.sort,enabled:x.enabled};if(f){const z=await St("/api/db/mentors",{id:f.id,...T});z!=null&&z.success?(u(!1),w()):alert("更新失败: "+(z==null?void 0:z.error))}else{const z=await jt("/api/db/mentors",T);z!=null&&z.success?(u(!1),w()):alert("新增失败: "+(z==null?void 0:z.error))}}catch(E){console.error("Save error:",E),alert("保存失败")}finally{y(!1)}},B=async E=>{if(confirm("确定删除该导师?"))try{const T=await zs(`/api/db/mentors?id=${E}`);T!=null&&T.success?w():alert("删除失败: "+(T==null?void 0:T.error))}catch(T){console.error("Delete error:",T),alert("删除失败")}},V=E=>E!=null?`¥${E}`:"-";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(vr,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),t.jsxs(ie,{onClick:P,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{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-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(Qr,{children:[n.map(E=>t.jsxs(st,{className:"border-gray-700/50",children:[t.jsx(ke,{className:"text-gray-300",children:E.id}),t.jsx(ke,{className:"text-white",children:E.name}),t.jsx(ke,{className:"text-gray-400 max-w-[200px] truncate",children:E.intro||"-"}),t.jsx(ke,{className:"text-gray-400",children:V(E.priceSingle)}),t.jsx(ke,{className:"text-gray-400",children:V(E.priceHalfYear)}),t.jsx(ke,{className:"text-gray-400",children:V(E.priceYear)}),t.jsx(ke,{className:"text-gray-400",children:E.sort}),t.jsxs(ke,{className:"text-right",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>j(E),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>B(E.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Er,{className:"w-4 h-4"})})]})]},E.id)),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),t.jsx(Mt,{open:c,onOpenChange:u,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:f?"编辑导师":"新增导师"})}),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(J,{className:"text-gray-300",children:"姓名 *"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:x.name,onChange:E=>g(T=>({...T,name:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"排序"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:x.sort,onChange:E=>g(T=>({...T,sort:parseInt(E.target.value,10)||0}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"头像"}),t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:x.avatar,onChange:E=>g(T=>({...T,avatar:E.target.value})),placeholder:"点击上传或粘贴图片地址"}),t.jsx("input",{ref:C,type:"file",accept:"image/*",className:"hidden",onChange:N}),t.jsxs(ie,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:k,onClick:()=>{var E;return(E=C.current)==null?void 0:E.click()},children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),k?"上传中...":"上传"]})]}),x.avatar&&t.jsx("div",{className:"mt-2",children:t.jsx("img",{src:x.avatar.startsWith("http")?x.avatar:Fs(x.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"简介"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:x.intro,onChange:E=>g(T=>({...T,intro:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:x.tags,onChange:E=>g(T=>({...T,tags:E.target.value}))})]}),t.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[t.jsx(J,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),t.jsx(se,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:x.priceSingle,onChange:E=>g(T=>({...T,priceSingle:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),t.jsx(se,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:x.priceHalfYear,onChange:E=>g(T=>({...T,priceHalfYear:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),t.jsx(se,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:x.priceYear,onChange:E=>g(T=>({...T,priceYear:E.target.value}))})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"引言"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:x.quote,onChange:E=>g(T=>({...T,quote:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"为什么找(文本)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:x.whyFind,onChange:E=>g(T=>({...T,whyFind:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"提供什么(文本)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:x.offering,onChange:E=>g(T=>({...T,offering:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:x.judgmentStyle,onChange:E=>g(T=>({...T,judgmentStyle:E.target.value}))})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:"enabled",checked:x.enabled,onChange:E=>g(T=>({...T,enabled:E.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),t.jsx(J,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:_,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存"]})]})]})})]})}function f4(){const[n,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState("");async function f(){o(!0);try{const g=c?`/api/db/mentor-consultations?status=${c}`:"/api/db/mentor-consultations",v=await Ke(g);v!=null&&v.success&&v.data&&a(v.data)}catch(g){console.error("Load consultations error:",g)}finally{o(!1)}}h.useEffect(()=>{f()},[c]);const p={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},x={single:"单次",half_year:"半年",year:"年度"};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($a,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("select",{value:c,onChange:g=>u(g.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[t.jsx("option",{value:"",children:"全部状态"}),Object.entries(p).map(([g,v])=>t.jsx("option",{value:g,children:v},g))]}),t.jsxs(ie,{onClick:f,disabled:l,variant:"outline",className:"border-gray-600 text-gray-300",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"ID"}),t.jsx(_e,{className:"text-gray-400",children:"用户ID"}),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.jsxs(Qr,{children:[n.map(g=>t.jsxs(st,{className:"border-gray-700/50",children:[t.jsx(ke,{className:"text-gray-300",children:g.id}),t.jsx(ke,{className:"text-gray-400",children:g.userId}),t.jsx(ke,{className:"text-gray-400",children:g.mentorId}),t.jsx(ke,{className:"text-gray-400",children:x[g.consultationType]||g.consultationType}),t.jsxs(ke,{className:"text-white",children:["¥",g.amount]}),t.jsx(ke,{className:"text-gray-400",children:p[g.status]||g.status}),t.jsx(ke,{className:"text-gray-500 text-sm",children:g.createdAt})]},g.id)),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function h4(){const[n,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f]=h.useState(10),[p,x]=h.useState(0),[g,v]=h.useState(""),y=Xd(g,300),[k,R]=h.useState(!0),[C,N]=h.useState(null),[w,S]=h.useState(!1),[P,j]=h.useState(null),[_,B]=h.useState(""),[V,E]=h.useState(""),[T,z]=h.useState(""),[q,ue]=h.useState("admin"),[ee,ce]=h.useState("active"),[G,Z]=h.useState(!1);async function te(){var L;R(!0),N(null);try{const X=new URLSearchParams({page:String(c),pageSize:String(f)});y.trim()&&X.set("search",y.trim());const ae=await Ke(`/api/admin/users?${X}`);ae!=null&&ae.success?(a(ae.records||[]),o(ae.total??0),x(ae.totalPages??0)):N(ae.error||"加载失败")}catch(X){const ae=X;N(ae.status===403?"无权限访问":((L=ae==null?void 0:ae.data)==null?void 0:L.error)||"加载失败"),a([])}finally{R(!1)}}h.useEffect(()=>{te()},[c,f,y]);const U=()=>{j(null),B(""),E(""),z(""),ue("admin"),ce("active"),S(!0)},M=L=>{j(L),B(L.username),E(""),z(L.name||""),ue(L.role==="super_admin"?"super_admin":"admin"),ce(L.status==="disabled"?"disabled":"active"),S(!0)},Q=async()=>{var L;if(!_.trim()){N("用户名不能为空");return}if(!P&&!V){N("新建时密码必填,至少 6 位");return}if(V&&V.length<6){N("密码至少 6 位");return}N(null),Z(!0);try{if(P){const X=await St("/api/admin/users",{id:P.id,password:V||void 0,name:T.trim(),role:q,status:ee});X!=null&&X.success?(S(!1),te()):N((X==null?void 0:X.error)||"保存失败")}else{const X=await jt("/api/admin/users",{username:_.trim(),password:V,name:T.trim(),role:q});X!=null&&X.success?(S(!1),te()):N((X==null?void 0:X.error)||"保存失败")}}catch(X){const ae=X;N(((L=ae==null?void 0:ae.data)==null?void 0:L.error)||"保存失败")}finally{Z(!1)}},H=async L=>{var X;if(confirm("确定删除该管理员?"))try{const ae=await zs(`/api/admin/users?id=${L}`);ae!=null&&ae.success?te():N((ae==null?void 0:ae.error)||"删除失败")}catch(ae){const ve=ae;N(((X=ve==null?void 0:ve.data)==null?void 0:X.error)||"删除失败")}},I=L=>{if(!L)return"-";try{const X=new Date(L);return isNaN(X.getTime())?L:X.toLocaleString("zh-CN")}catch{return L}};return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-6",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(zd,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(se,{placeholder:"搜索用户名/昵称",value:g,onChange:L=>v(L.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),t.jsx(ie,{variant:"outline",size:"sm",onClick:te,disabled:k,className:"border-gray-600 text-gray-300",children:t.jsx(Ze,{className:`w-4 h-4 ${k?"animate-spin":""}`})}),t.jsxs(ie,{onClick:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),C&&t.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[t.jsx("span",{children:C}),t.jsx("button",{type:"button",onClick:()=>N(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-0",children:k?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(t.Fragment,{children:[t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{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-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(Qr,{children:[n.map(L=>t.jsxs(st,{className:"border-gray-700/50",children:[t.jsx(ke,{className:"text-gray-300",children:L.id}),t.jsx(ke,{className:"text-white font-medium",children:L.username}),t.jsx(ke,{className:"text-gray-400",children:L.name||"-"}),t.jsx(ke,{children:t.jsx(Le,{variant:"outline",className:L.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:L.role==="super_admin"?"超级管理员":"管理员"})}),t.jsx(ke,{children:t.jsx(Le,{variant:"outline",className:L.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:L.status==="active"?"正常":"已禁用"})}),t.jsx(ke,{className:"text-gray-500 text-sm",children:I(L.createdAt)}),t.jsxs(ke,{className:"text-right",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>M(L),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>H(L.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Er,{className:"w-4 h-4"})})]})]},L.id)),n.length===0&&!k&&t.jsx(st,{children:t.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:C==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),p>1&&t.jsx("div",{className:"p-4 border-t border-gray-700/50",children:t.jsx(Sn,{page:c,pageSize:f,total:l,totalPages:p,onPageChange:u})})]})})}),t.jsx(Mt,{open:w,onOpenChange:S,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:P?"编辑管理员":"新增管理员"})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"用户名"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:_,onChange:L=>B(L.target.value),disabled:!!P}),P&&t.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:P?"新密码(留空不改)":"密码"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:P?"留空表示不修改":"至少 6 位",value:V,onChange:L=>E(L.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"昵称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:T,onChange:L=>z(L.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"角色"}),t.jsxs("select",{value:q,onChange:L=>ue(L.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[t.jsx("option",{value:"admin",children:"管理员"}),t.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),P&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"状态"}),t.jsxs("select",{value:ee,onChange:L=>ce(L.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[t.jsx("option",{value:"active",children:"正常"}),t.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>S(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:Q,disabled:G,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),G?"保存中...":"保存"]})]})]})})]})}function m4(){return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t.jsx(Yn,{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(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"1. 接口总览"})}),t.jsxs(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"2. 书籍内容"})}),t.jsxs(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"3. 支付"})}),t.jsxs(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"4. 分销与用户"})}),t.jsxs(Te,{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(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"5. 管理后台"})}),t.jsxs(Te,{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 p4(){const n=ns();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(Tj,{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:n.pathname}),t.jsx(ie,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:t.jsxs(fi,{to:"/",children:[t.jsx(aN,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function x4(){return t.jsxs(lj,{children:[t.jsx(nt,{path:"/login",element:t.jsx(rw,{})}),t.jsxs(nt,{path:"/",element:t.jsx(ab,{}),children:[t.jsx(nt,{index:!0,element:t.jsx(nj,{to:"/dashboard",replace:!0})}),t.jsx(nt,{path:"dashboard",element:t.jsx(sw,{})}),t.jsx(nt,{path:"orders",element:t.jsx(V1,{})}),t.jsx(nt,{path:"users",element:t.jsx(x2,{})}),t.jsx(nt,{path:"distribution",element:t.jsx(g2,{})}),t.jsx(nt,{path:"withdrawals",element:t.jsx(v2,{})}),t.jsx(nt,{path:"content",element:t.jsx(kC,{})}),t.jsx(nt,{path:"referral-settings",element:t.jsx(YC,{})}),t.jsx(nt,{path:"author-settings",element:t.jsx(QC,{})}),t.jsx(nt,{path:"vip-roles",element:t.jsx(d4,{})}),t.jsx(nt,{path:"mentors",element:t.jsx(u4,{})}),t.jsx(nt,{path:"mentor-consultations",element:t.jsx(f4,{})}),t.jsx(nt,{path:"admin-users",element:t.jsx(h4,{})}),t.jsx(nt,{path:"settings",element:t.jsx(e4,{})}),t.jsx(nt,{path:"payment",element:t.jsx(t4,{})}),t.jsx(nt,{path:"site",element:t.jsx(a4,{})}),t.jsx(nt,{path:"qrcodes",element:t.jsx(l4,{})}),t.jsx(nt,{path:"match",element:t.jsx(o4,{})}),t.jsx(nt,{path:"match-records",element:t.jsx(c4,{})}),t.jsx(nt,{path:"api-doc",element:t.jsx(m4,{})})]}),t.jsx(nt,{path:"*",element:t.jsx(p4,{})})]})}cy.createRoot(document.getElementById("root")).render(t.jsx(h.StrictMode,{children:t.jsx(hj,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:t.jsx(x4,{})})})); diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 2a388810..eec90623 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,7 +4,7 @@ 管理后台 - Soul创业派对 - +