tt?(Rn=Ye,Ye=null):Rn=Ye.sibling;var Ki=be(se,Ye,vt.value,Ee);if(Ki===null){Ye===null&&(Ye=Rn);break}l&&Ye&&Ki.alternate===null&&d(se,Ye),Q=S(Ki,Q,tt),Je===null?Be=Ki:Je.sibling=Ki,Je=Ki,Ye=Rn}if(vt.done)return p(se,Ye),Yt&&Fa(se,tt),Be;if(Ye===null){for(;!vt.done;tt++,vt=le.next())vt=ke(se,vt.value,Ee),vt!==null&&(Q=S(vt,Q,tt),Je===null?Be=vt:Je.sibling=vt,Je=vt);return Yt&&Fa(se,tt),Be}for(Ye=x(se,Ye);!vt.done;tt++,vt=le.next())vt=Oe(Ye,se,tt,vt.value,Ee),vt!==null&&(l&&vt.alternate!==null&&Ye.delete(vt.key===null?tt:vt.key),Q=S(vt,Q,tt),Je===null?Be=vt:Je.sibling=vt,Je=vt);return l&&Ye.forEach(function(u3){return d(se,u3)}),Yt&&Fa(se,tt),Be}function mn(se,Q,le,Ee){if(typeof le=="object"&&le!==null&&le.type===D&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case I:e:{for(var Be=le.key,Je=Q;Je!==null;){if(Je.key===Be){if(Be=le.type,Be===D){if(Je.tag===7){p(se,Je.sibling),Q=j(Je,le.props.children),Q.return=se,se=Q;break e}}else if(Je.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===F&&Wy(Be)===Je.type){p(se,Je.sibling),Q=j(Je,le.props),Q.ref=oc(se,Je,le),Q.return=se,se=Q;break e}p(se,Je);break}else d(se,Je);Je=Je.sibling}le.type===D?(Q=Ga(le.props.children,se.mode,Ee,le.key),Q.return=se,se=Q):(Ee=uu(le.type,le.key,le.props,null,se.mode,Ee),Ee.ref=oc(se,Q,le),Ee.return=se,se=Ee)}return A(se);case O:e:{for(Je=le.key;Q!==null;){if(Q.key===Je)if(Q.tag===4&&Q.stateNode.containerInfo===le.containerInfo&&Q.stateNode.implementation===le.implementation){p(se,Q.sibling),Q=j(Q,le.children||[]),Q.return=se,se=Q;break e}else{p(se,Q);break}else d(se,Q);Q=Q.sibling}Q=cm(le,se.mode,Ee),Q.return=se,se=Q}return A(se);case F:return Je=le._init,mn(se,Q,Je(le._payload),Ee)}if(Qe(le))return _e(se,Q,le,Ee);if(ie(le))return Fe(se,Q,le,Ee);Bd(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,Q!==null&&Q.tag===6?(p(se,Q.sibling),Q=j(Q,le),Q.return=se,se=Q):(p(se,Q),Q=lm(le,se.mode,Ee),Q.return=se,se=Q),A(se)):p(se,Q)}return mn}var qo=Uy(!0),Ky=Uy(!1),Vd=Di(null),Hd=null,Go=null,yp=null;function vp(){yp=Go=Hd=null}function bp(l){var d=Vd.current;Ht(Vd),l._currentValue=d}function wp(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function Jo(l,d){Hd=l,yp=Go=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(vr=!0),l.firstContext=null)}function Vr(l){var d=l._currentValue;if(yp!==l)if(l={context:l,memoizedValue:d,next:null},Go===null){if(Hd===null)throw Error(n(308));Go=l,Hd.dependencies={lanes:0,firstContext:l}}else Go=Go.next=l;return d}var Ba=null;function Np(l){Ba===null?Ba=[l]:Ba.push(l)}function qy(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,Np(d)):(p.next=j.next,j.next=p),d.interleaved=p,ri(l,x)}function ri(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var zi=!1;function jp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gy(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function si(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function $i(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(mt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,ri(l,p)}return j=x.interleaved,j===null?(d.next=d,Np(x)):(d.next=j.next,j.next=d),x.interleaved=d,ri(l,p)}function Wd(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Po(l,p)}}function Jy(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState:x.baseState,firstBaseUpdate:j,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function Ud(l,d,p,x){var j=l.updateQueue;zi=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,B=j.shared.pending;if(B!==null){j.shared.pending=null;var K=B,ue=K.next;K.next=null,A===null?S=ue:A.next=ue,A=K;var Ne=l.alternate;Ne!==null&&(Ne=Ne.updateQueue,B=Ne.lastBaseUpdate,B!==A&&(B===null?Ne.firstBaseUpdate=ue:B.next=ue,Ne.lastBaseUpdate=K))}if(S!==null){var ke=j.baseState;A=0,Ne=ue=K=null,B=S;do{var be=B.lane,Oe=B.eventTime;if((x&be)===be){Ne!==null&&(Ne=Ne.next={eventTime:Oe,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var _e=l,Fe=B;switch(be=d,Oe=p,Fe.tag){case 1:if(_e=Fe.payload,typeof _e=="function"){ke=_e.call(Oe,ke,be);break e}ke=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Fe.payload,be=typeof _e=="function"?_e.call(Oe,ke,be):_e,be==null)break e;ke=G({},ke,be);break e;case 2:zi=!0}}B.callback!==null&&B.lane!==0&&(l.flags|=64,be=j.effects,be===null?j.effects=[B]:be.push(B))}else Oe={eventTime:Oe,lane:be,tag:B.tag,payload:B.payload,callback:B.callback,next:null},Ne===null?(ue=Ne=Oe,K=ke):Ne=Ne.next=Oe,A|=be;if(B=B.next,B===null){if(B=j.shared.pending,B===null)break;be=B,B=be.next,be.next=null,j.lastBaseUpdate=be,j.shared.pending=null}}while(!0);if(Ne===null&&(K=ke),j.baseState=K,j.firstBaseUpdate=ue,j.lastBaseUpdate=Ne,d=j.shared.interleaved,d!==null){j=d;do A|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);Wa|=A,l.lanes=A,l.memoizedState=ke}}function Yy(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Tp.transition;Tp.transition={};try{l(!1),d()}finally{yt=p,Tp.transition=x}}function mv(){return Hr().memoizedState}function DE(l,d,p){var x=Hi(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},gv(l))xv(d,p);else if(p=qy(l,d,p,x),p!==null){var j=ur();hs(p,l,x,j),yv(p,d,x)}}function LE(l,d,p){var x=Hi(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(gv(l))xv(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,B=S(A,p);if(j.hasEagerState=!0,j.eagerState=B,as(B,A)){var K=d.interleaved;K===null?(j.next=j,Np(d)):(j.next=K.next,K.next=j),d.interleaved=j;return}}catch{}finally{}p=qy(l,d,j,x),p!==null&&(j=ur(),hs(p,l,x,j),yv(p,d,x))}}function gv(l){var d=l.alternate;return l===en||d!==null&&d===en}function xv(l,d){uc=Gd=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function yv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Po(l,p)}}var Qd={readContext:Vr,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useInsertionEffect:Gn,useLayoutEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useMutableSource:Gn,useSyncExternalStore:Gn,useId:Gn,unstable_isNewReconciler:!1},_E={readContext:Vr,useCallback:function(l,d){return Ms().memoizedState=[l,d===void 0?null:d],l},useContext:Vr,useEffect:ov,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Jd(4194308,4,dv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Jd(4194308,4,l,d)},useInsertionEffect:function(l,d){return Jd(4,2,l,d)},useMemo:function(l,d){var p=Ms();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=Ms();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=DE.bind(null,en,l),[x.memoizedState,l]},useRef:function(l){var d=Ms();return l={current:l},d.memoizedState=l},useState:iv,useDebugValue:Dp,useDeferredValue:function(l){return Ms().memoizedState=l},useTransition:function(){var l=iv(!1),d=l[0];return l=OE.bind(null,l[1]),Ms().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=en,j=Ms();if(Yt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),In===null)throw Error(n(349));(Ha&30)!==0||ev(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,ov(nv.bind(null,x,S,l),[l]),x.flags|=2048,pc(9,tv.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=Ms(),d=In.identifierPrefix;if(Yt){var p=ni,x=ti;p=(x&~(1<<32-et(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=hc++,0")&&(K=K.replace("",l.displayName)),K}while(1<=A&&0<=B);break}}}finally{ce=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?V(l):""}function fe(l){switch(l.tag){case 5:return V(l.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return l=W(l.type,!1),l;case 11:return l=W(l.type.render,!1),l;case 1:return l=W(l.type,!0),l;default:return""}}function X(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case D:return"Fragment";case O:return"Portal";case L:return"Profiler";case P:return"StrictMode";case Y:return"Suspense";case U:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case J:return(l.displayName||"Context")+".Consumer";case _:return(l._context.displayName||"Context")+".Provider";case ee:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case R:return d=l.displayName||null,d!==null?d:X(l.type)||"Memo";case F:d=l._payload,l=l._init;try{return X(l(d))}catch{}}return null}function de(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return X(d);case 8:return d===P?"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 d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function he(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function be(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function Te(l){var d=be(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var j=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return j.call(this)},set:function(A){x=""+A,S.call(this,A)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(A){x=""+A},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function Ve(l){l._valueTracker||(l._valueTracker=Te(l))}function He(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=be(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function vt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Dt(l,d){var p=d.checked;return G({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function vn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=he(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function pt(l,d){d=d.checked,d!=null&&E(l,"checked",d,!1)}function Rt(l,d){pt(l,d);var p=he(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Pe(l,d.type,p):d.hasOwnProperty("defaultValue")&&Pe(l,d.type,he(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function ne(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Pe(l,d,p){(d!=="number"||vt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Ze=Array.isArray;function bt(l,d,p,x){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=_t.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function ts(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var lr={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},me=["Webkit","ms","Moz","O"];Object.keys(lr).forEach(function(l){me.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),lr[d]=lr[l]})});function ye(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||lr.hasOwnProperty(l)&&lr[l]?(""+d).trim():d+"px"}function cr(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=ye(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,j):l[p]=j}}var Vs=G({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 Ni(l,d){if(d){if(Vs[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function ji(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){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 Cr=null;function Ia(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var zr=null,ns=null,dr=null;function ki(l){if(l=oc(l)){if(typeof zr!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Dd(d),zr(l.stateNode,l.type,d))}}function Ra(l){ns?dr?dr.push(l):dr=[l]:ns=l}function Hs(){if(ns){var l=ns,d=dr;if(dr=ns=null,ki(l),d)for(l=0;l>>=0,l===0?32:31-(In(l)/ur|0)|0}var Zt=64,$n=4194304;function ls(l){switch(l&-l){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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Ss(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,j=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var B=A&~j;B!==0?x=ls(B):(S&=A,S!==0&&(x=ls(S)))}else A=p&~j,A!==0?x=ls(A):S!==0&&(x=ls(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&j)===0&&(j=x&-x,S=d&-d,j>=S||j===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function Ri(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-tt(d),l[d]=p}function Wl(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=Xl),oy=" ",ly=!1;function cy(l,d){switch(l){case"keyup":return oE.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Oo=!1;function cE(l,d){switch(l){case"compositionend":return dy(d);case"keypress":return d.which!==32?null:(ly=!0,oy);case"textInput":return l=d.data,l===oy&&ly?null:l;default:return null}}function dE(l,d){if(Oo)return l==="compositionend"||!Jf&&cy(l,d)?(l=ty(),kd=Hf=Pi=null,Oo=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=xy(p)}}function vy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?vy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function by(){for(var l=window,d=vt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=vt(l.document)}return d}function Xf(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function vE(l){var d=by(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&vy(p.ownerDocument.documentElement,p)){if(x!==null&&Xf(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var j=p.textContent.length,S=Math.min(x.start,j);x=x.end===void 0?S:Math.min(x.end,j),!l.extend&&S>x&&(j=x,x=S,S=j),j=yy(p,S);var A=yy(p,x);j&&A&&(l.rangeCount!==1||l.anchorNode!==j.node||l.anchorOffset!==j.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(j.node,j.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(A.node,A.offset)):(d.setEnd(A.node,A.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,Do=null,Zf=null,nc=null,ep=!1;function wy(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;ep||Do==null||Do!==vt(x)||(x=Do,"selectionStart"in x&&Xf(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),nc&&tc(nc,x)||(nc=x,x=Rd(Zf,"onSelect"),0Fo||(l.current=hp[Fo],hp[Fo]=null,Fo--)}function $t(l,d){Fo++,hp[Fo]=l.current,l.current=d}var _i={},Jn=Li(_i),yr=Li(!1),$a=_i;function Bo(l,d){var p=l.type.contextTypes;if(!p)return _i;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var j={},S;for(S in p)j[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=j),j}function vr(l){return l=l.childContextTypes,l!=null}function Ld(){qt(yr),qt(Jn)}function Ly(l,d,p){if(Jn.current!==_i)throw Error(n(168));$t(Jn,d),$t(yr,p)}function _y(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var j in x)if(!(j in d))throw Error(n(108,de(l)||"Unknown",j));return G({},p,x)}function _d(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||_i,$a=Jn.current,$t(Jn,l),$t(yr,yr.current),!0}function zy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=_y(l,d,$a),x.__reactInternalMemoizedMergedChildContext=l,qt(yr),qt(Jn),$t(Jn,l)):qt(yr),$t(yr,p)}var Xs=null,zd=!1,fp=!1;function $y(l){Xs===null?Xs=[l]:Xs.push(l)}function IE(l){zd=!0,$y(l)}function zi(){if(!fp&&Xs!==null){fp=!0;var l=0,d=wt;try{var p=Xs;for(wt=1;l>=A,j-=A,Zs=1<<32-tt(d)+j|p<nt?(On=Xe,Xe=null):On=Xe.sibling;var jt=ve(se,Xe,le[nt],Ee);if(jt===null){Xe===null&&(Xe=On);break}l&&Xe&&jt.alternate===null&&d(se,Xe),Q=S(jt,Q,nt),Qe===null?Be=jt:Qe.sibling=jt,Qe=jt,Xe=On}if(nt===le.length)return p(se,Xe),en&&Ba(se,nt),Be;if(Xe===null){for(;ntnt?(On=Xe,Xe=null):On=Xe.sibling;var qi=ve(se,Xe,jt.value,Ee);if(qi===null){Xe===null&&(Xe=On);break}l&&Xe&&qi.alternate===null&&d(se,Xe),Q=S(qi,Q,nt),Qe===null?Be=qi:Qe.sibling=qi,Qe=qi,Xe=On}if(jt.done)return p(se,Xe),en&&Ba(se,nt),Be;if(Xe===null){for(;!jt.done;nt++,jt=le.next())jt=ke(se,jt.value,Ee),jt!==null&&(Q=S(jt,Q,nt),Qe===null?Be=jt:Qe.sibling=jt,Qe=jt);return en&&Ba(se,nt),Be}for(Xe=x(se,Xe);!jt.done;nt++,jt=le.next())jt=Oe(Xe,se,nt,jt.value,Ee),jt!==null&&(l&&jt.alternate!==null&&Xe.delete(jt.key===null?nt:jt.key),Q=S(jt,Q,nt),Qe===null?Be=jt:Qe.sibling=jt,Qe=jt);return l&&Xe.forEach(function(u3){return d(se,u3)}),en&&Ba(se,nt),Be}function gn(se,Q,le,Ee){if(typeof le=="object"&&le!==null&&le.type===D&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case I:e:{for(var Be=le.key,Qe=Q;Qe!==null;){if(Qe.key===Be){if(Be=le.type,Be===D){if(Qe.tag===7){p(se,Qe.sibling),Q=j(Qe,le.props.children),Q.return=se,se=Q;break e}}else if(Qe.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===F&&Uy(Be)===Qe.type){p(se,Qe.sibling),Q=j(Qe,le.props),Q.ref=lc(se,Qe,le),Q.return=se,se=Q;break e}p(se,Qe);break}else d(se,Qe);Qe=Qe.sibling}le.type===D?(Q=Ja(le.props.children,se.mode,Ee,le.key),Q.return=se,se=Q):(Ee=hu(le.type,le.key,le.props,null,se.mode,Ee),Ee.ref=lc(se,Q,le),Ee.return=se,se=Ee)}return A(se);case O:e:{for(Qe=le.key;Q!==null;){if(Q.key===Qe)if(Q.tag===4&&Q.stateNode.containerInfo===le.containerInfo&&Q.stateNode.implementation===le.implementation){p(se,Q.sibling),Q=j(Q,le.children||[]),Q.return=se,se=Q;break e}else{p(se,Q);break}else d(se,Q);Q=Q.sibling}Q=dm(le,se.mode,Ee),Q.return=se,se=Q}return A(se);case F:return Qe=le._init,gn(se,Q,Qe(le._payload),Ee)}if(Ze(le))return _e(se,Q,le,Ee);if(ie(le))return Fe(se,Q,le,Ee);Vd(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,Q!==null&&Q.tag===6?(p(se,Q.sibling),Q=j(Q,le),Q.return=se,se=Q):(p(se,Q),Q=cm(le,se.mode,Ee),Q.return=se,se=Q),A(se)):p(se,Q)}return gn}var Uo=Ky(!0),qy=Ky(!1),Hd=Li(null),Wd=null,Ko=null,vp=null;function bp(){vp=Ko=Wd=null}function wp(l){var d=Hd.current;qt(Hd),l._currentValue=d}function Np(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function qo(l,d){Wd=l,vp=Ko=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(br=!0),l.firstContext=null)}function Wr(l){var d=l._currentValue;if(vp!==l)if(l={context:l,memoizedValue:d,next:null},Ko===null){if(Wd===null)throw Error(n(308));Ko=l,Wd.dependencies={lanes:0,firstContext:l}}else Ko=Ko.next=l;return d}var Va=null;function jp(l){Va===null?Va=[l]:Va.push(l)}function Gy(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,jp(d)):(p.next=j.next,j.next=p),d.interleaved=p,ti(l,x)}function ti(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var $i=!1;function kp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jy(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function ni(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Fi(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(xt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,ti(l,p)}return j=x.interleaved,j===null?(d.next=d,jp(x)):(d.next=j.next,j.next=d),x.interleaved=d,ti(l,p)}function Ud(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Io(l,p)}}function Yy(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState:x.baseState,firstBaseUpdate:j,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function Kd(l,d,p,x){var j=l.updateQueue;$i=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,B=j.shared.pending;if(B!==null){j.shared.pending=null;var K=B,ue=K.next;K.next=null,A===null?S=ue:A.next=ue,A=K;var Ne=l.alternate;Ne!==null&&(Ne=Ne.updateQueue,B=Ne.lastBaseUpdate,B!==A&&(B===null?Ne.firstBaseUpdate=ue:B.next=ue,Ne.lastBaseUpdate=K))}if(S!==null){var ke=j.baseState;A=0,Ne=ue=K=null,B=S;do{var ve=B.lane,Oe=B.eventTime;if((x&ve)===ve){Ne!==null&&(Ne=Ne.next={eventTime:Oe,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var _e=l,Fe=B;switch(ve=d,Oe=p,Fe.tag){case 1:if(_e=Fe.payload,typeof _e=="function"){ke=_e.call(Oe,ke,ve);break e}ke=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Fe.payload,ve=typeof _e=="function"?_e.call(Oe,ke,ve):_e,ve==null)break e;ke=G({},ke,ve);break e;case 2:$i=!0}}B.callback!==null&&B.lane!==0&&(l.flags|=64,ve=j.effects,ve===null?j.effects=[B]:ve.push(B))}else Oe={eventTime:Oe,lane:ve,tag:B.tag,payload:B.payload,callback:B.callback,next:null},Ne===null?(ue=Ne=Oe,K=ke):Ne=Ne.next=Oe,A|=ve;if(B=B.next,B===null){if(B=j.shared.pending,B===null)break;ve=B,B=ve.next,ve.next=null,j.lastBaseUpdate=ve,j.shared.pending=null}}while(!0);if(Ne===null&&(K=ke),j.baseState=K,j.firstBaseUpdate=ue,j.lastBaseUpdate=Ne,d=j.shared.interleaved,d!==null){j=d;do A|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);Ua|=A,l.lanes=A,l.memoizedState=ke}}function Qy(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Mp.transition;Mp.transition={};try{l(!1),d()}finally{wt=p,Mp.transition=x}}function gv(){return Ur().memoizedState}function DE(l,d,p){var x=Wi(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},xv(l))yv(d,p);else if(p=Gy(l,d,p,x),p!==null){var j=fr();ps(p,l,x,j),vv(p,d,x)}}function LE(l,d,p){var x=Wi(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(xv(l))yv(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,B=S(A,p);if(j.hasEagerState=!0,j.eagerState=B,cs(B,A)){var K=d.interleaved;K===null?(j.next=j,jp(d)):(j.next=K.next,K.next=j),d.interleaved=j;return}}catch{}finally{}p=Gy(l,d,j,x),p!==null&&(j=fr(),ps(p,l,x,j),vv(p,d,x))}}function xv(l){var d=l.alternate;return l===sn||d!==null&&d===sn}function yv(l,d){hc=Jd=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function vv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Io(l,p)}}var Xd={readContext:Wr,useCallback:Yn,useContext:Yn,useEffect:Yn,useImperativeHandle:Yn,useInsertionEffect:Yn,useLayoutEffect:Yn,useMemo:Yn,useReducer:Yn,useRef:Yn,useState:Yn,useDebugValue:Yn,useDeferredValue:Yn,useTransition:Yn,useMutableSource:Yn,useSyncExternalStore:Yn,useId:Yn,unstable_isNewReconciler:!1},_E={readContext:Wr,useCallback:function(l,d){return Ts().memoizedState=[l,d===void 0?null:d],l},useContext:Wr,useEffect:lv,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Yd(4194308,4,uv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Yd(4194308,4,l,d)},useInsertionEffect:function(l,d){return Yd(4,2,l,d)},useMemo:function(l,d){var p=Ts();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=Ts();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=DE.bind(null,sn,l),[x.memoizedState,l]},useRef:function(l){var d=Ts();return l={current:l},d.memoizedState=l},useState:av,useDebugValue:Lp,useDeferredValue:function(l){return Ts().memoizedState=l},useTransition:function(){var l=av(!1),d=l[0];return l=OE.bind(null,l[1]),Ts().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=sn,j=Ts();if(en){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Pn===null)throw Error(n(349));(Wa&30)!==0||tv(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,lv(rv.bind(null,x,S,l),[l]),x.flags|=2048,mc(9,nv.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=Ts(),d=Pn.identifierPrefix;if(en){var p=ei,x=Zs;p=(x&~(1<<32-tt(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=fc++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[Es]=d,l[ic]=x,zv(l,d,!1,!1),d.stateNode=l;e:{switch(A=Si(p,x),p){case"dialog":Vt("cancel",l),Vt("close",l),j=x;break;case"iframe":case"object":case"embed":Vt("load",l),j=x;break;case"video":case"audio":for(j=0;jel&&(d.flags|=128,x=!0,mc(S,!1),d.lanes=4194304)}else{if(!x)if(l=Kd(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),mc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Yt)return Jn(d),null}else 2*Tt()-S.renderingStartTime>el&&p!==1073741824&&(d.flags|=128,x=!0,mc(S,!1),d.lanes=4194304);S.isBackwards?(A.sibling=d.child,d.child=A):(p=S.last,p!==null?p.sibling=A:d.child=A,S.last=A)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=Tt(),d.sibling=null,p=Zt.current,Lt(Zt,x?p&1|2:p&1),d):(Jn(d),null);case 22:case 23:return im(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Ar&1073741824)!==0&&(Jn(d),d.subtreeFlags&6&&(d.flags|=8192)):Jn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function UE(l,d){switch(pp(d),d.tag){case 1:return yr(d.type)&&Dd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Yo(),Ht(xr),Ht(qn),Ep(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Sp(d),null;case 13:if(Ht(Zt),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Ko()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Ht(Zt),null;case 4:return Yo(),null;case 10:return bp(d.type._context),null;case 22:case 23:return im(),null;case 24:return null;default:return null}}var tu=!1,Yn=!1,KE=typeof WeakSet=="function"?WeakSet:Set,De=null;function Xo(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){ln(l,d,x)}else p.current=null}function qp(l,d,p){try{p()}catch(x){ln(l,d,x)}}var Bv=!1;function qE(l,d){if(ip=wd,l=vy(),Qf(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var j=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,B=-1,K=-1,ue=0,Ne=0,ke=l,be=null;t:for(;;){for(var Oe;ke!==p||j!==0&&ke.nodeType!==3||(B=A+j),ke!==S||x!==0&&ke.nodeType!==3||(K=A+x),ke.nodeType===3&&(A+=ke.nodeValue.length),(Oe=ke.firstChild)!==null;)be=ke,ke=Oe;for(;;){if(ke===l)break t;if(be===p&&++ue===j&&(B=A),be===S&&++Ne===x&&(K=A),(Oe=ke.nextSibling)!==null)break;ke=be,be=ke.parentNode}ke=Oe}p=B===-1||K===-1?null:{start:B,end:K}}else p=null}p=p||{start:0,end:0}}else p=null;for(ap={focusedElem:l,selectionRange:p},wd=!1,De=d;De!==null;)if(d=De,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,De=l;else for(;De!==null;){d=De;try{var _e=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Fe=_e.memoizedProps,mn=_e.memoizedState,se=d.stateNode,Q=se.getSnapshotBeforeUpdate(d.elementType===d.type?Fe:cs(d.type,Fe),mn);se.__reactInternalSnapshotBeforeUpdate=Q}break;case 3:var le=d.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ee){ln(d,d.return,Ee)}if(l=d.sibling,l!==null){l.return=d.return,De=l;break}De=d.return}return _e=Bv,Bv=!1,_e}function gc(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&l)===l){var S=j.destroy;j.destroy=void 0,S!==void 0&&qp(d,p,S)}j=j.next}while(j!==x)}}function nu(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function Gp(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function Vv(l){var d=l.alternate;d!==null&&(l.alternate=null,Vv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Es],delete d[ic],delete d[dp],delete d[ME],delete d[AE])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function Hv(l){return l.tag===5||l.tag===3||l.tag===4}function Wv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Hv(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Jp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=Pd));else if(x!==4&&(l=l.child,l!==null))for(Jp(l,d,p),l=l.sibling;l!==null;)Jp(l,d,p),l=l.sibling}function Yp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(Yp(l,d,p),l=l.sibling;l!==null;)Yp(l,d,p),l=l.sibling}var zn=null,ds=!1;function Fi(l,d,p){for(p=p.child;p!==null;)Uv(l,d,p),p=p.sibling}function Uv(l,d,p){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(V,p)}catch{}switch(p.tag){case 5:Yn||Xo(p,d);case 6:var x=zn,j=ds;zn=null,Fi(l,d,p),zn=x,ds=j,zn!==null&&(ds?(l=zn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):zn.removeChild(p.stateNode));break;case 18:zn!==null&&(ds?(l=zn,p=p.stateNode,l.nodeType===8?cp(l.parentNode,p):l.nodeType===1&&cp(l,p),Gl(l)):cp(zn,p.stateNode));break;case 4:x=zn,j=ds,zn=p.stateNode.containerInfo,ds=!0,Fi(l,d,p),zn=x,ds=j;break;case 0:case 11:case 14:case 15:if(!Yn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){j=x=x.next;do{var S=j,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&qp(p,d,A),j=j.next}while(j!==x)}Fi(l,d,p);break;case 1:if(!Yn&&(Xo(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(B){ln(p,d,B)}Fi(l,d,p);break;case 21:Fi(l,d,p);break;case 22:p.mode&1?(Yn=(x=Yn)||p.memoizedState!==null,Fi(l,d,p),Yn=x):Fi(l,d,p);break;default:Fi(l,d,p)}}function Kv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new KE),d.forEach(function(x){var j=n3.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function us(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=A),x&=~S}if(x=j,x=Tt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*JE(x/1960))-x,10l?16:l,Vi===null)var x=!1;else{if(l=Vi,Vi=null,ou=0,(mt&6)!==0)throw Error(n(331));var j=mt;for(mt|=4,De=l.current;De!==null;){var S=De,A=S.child;if((De.flags&16)!==0){var B=S.deletions;if(B!==null){for(var K=0;KTt()-Zp?Ka(l,0):Xp|=p),wr(l,d)}function ib(l,d){d===0&&((l.mode&1)===0?d=1:(d=_n,_n<<=1,(_n&130023424)===0&&(_n=4194304)));var p=ur();l=ri(l,d),l!==null&&(Qs(l,d,p),wr(l,p))}function t3(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),ib(l,p)}function n3(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,j=l.memoizedState;j!==null&&(p=j.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),ib(l,p)}var ab;ab=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||xr.current)vr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return vr=!1,HE(l,d,p);vr=(l.flags&131072)!==0}else vr=!1,Yt&&(d.flags&1048576)!==0&&$y(d,$d,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;eu(l,d),l=d.pendingProps;var j=Ho(d,qn.current);Jo(d,p),j=Ap(null,d,x,l,j,p);var S=Ip();return d.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,yr(x)?(S=!0,Ld(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,jp(d),j.updater=Xd,d.stateNode=j,j._reactInternals=d,_p(d,x,l,p),d=Bp(null,d,x,!0,S,p)):(d.tag=0,Yt&&S&&fp(d),dr(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(eu(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=s3(x),l=cs(x,l),j){case 0:d=Fp(null,d,x,l,p);break e;case 1:d=Rv(null,d,x,l,p);break e;case 11:d=Ev(null,d,x,l,p);break e;case 14:d=Tv(null,d,x,cs(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:cs(x,j),Fp(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:cs(x,j),Rv(l,d,x,j,p);case 3:e:{if(Pv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,Gy(l,d),Ud(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=Qo(Error(n(423)),d),d=Ov(l,d,x,p,j);break e}else if(x!==j){j=Qo(Error(n(424)),d),d=Ov(l,d,x,p,j);break e}else for(Mr=Oi(d.stateNode.containerInfo.firstChild),Tr=d,Yt=!0,ls=null,p=Ky(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Ko(),x===j){d=ii(l,d,p);break e}dr(l,d,x,p)}d=d.child}return d;case 5:return Qy(d),l===null&&gp(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,op(x,j)?A=null:S!==null&&op(x,S)&&(d.flags|=32),Iv(l,d),dr(l,d,A,p),d.child;case 6:return l===null&&gp(d),null;case 13:return Dv(l,d,p);case 4:return kp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=qo(d,null,x,p):dr(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:cs(x,j),Ev(l,d,x,j,p);case 7:return dr(l,d,d.pendingProps,p),d.child;case 8:return dr(l,d,d.pendingProps.children,p),d.child;case 12:return dr(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,j=d.pendingProps,S=d.memoizedProps,A=j.value,Lt(Vd,x._currentValue),x._currentValue=A,S!==null)if(as(S.value,A)){if(S.children===j.children&&!xr.current){d=ii(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var B=S.dependencies;if(B!==null){A=S.child;for(var K=B.firstContext;K!==null;){if(K.context===x){if(S.tag===1){K=si(-1,p&-p),K.tag=2;var ue=S.updateQueue;if(ue!==null){ue=ue.shared;var Ne=ue.pending;Ne===null?K.next=K:(K.next=Ne.next,Ne.next=K),ue.pending=K}}S.lanes|=p,K=S.alternate,K!==null&&(K.lanes|=p),wp(S.return,p,d),B.lanes|=p;break}K=K.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,B=A.alternate,B!==null&&(B.lanes|=p),wp(A,p,d),A=S.sibling}else A=S.child;if(A!==null)A.return=S;else for(A=S;A!==null;){if(A===d){A=null;break}if(S=A.sibling,S!==null){S.return=A.return,A=S;break}A=A.return}S=A}dr(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,Jo(d,p),j=Vr(j),x=x(j),d.flags|=1,dr(l,d,x,p),d.child;case 14:return x=d.type,j=cs(x,d.pendingProps),j=cs(x.type,j),Tv(l,d,x,j,p);case 15:return Mv(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:cs(x,j),eu(l,d),d.tag=1,yr(x)?(l=!0,Ld(d)):l=!1,Jo(d,p),bv(d,x,j),_p(d,x,j,p),Bp(null,d,x,!0,l,p);case 19:return _v(l,d,p);case 22:return Av(l,d,p)}throw Error(n(156,d.tag))};function ob(l,d){return To(l,d)}function r3(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ur(l,d,p,x){return new r3(l,d,p,x)}function om(l){return l=l.prototype,!(!l||!l.isReactComponent)}function s3(l){if(typeof l=="function")return om(l)?1:0;if(l!=null){if(l=l.$$typeof,l===ee)return 11;if(l===R)return 14}return 2}function Ui(l,d){var p=l.alternate;return p===null?(p=Ur(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function uu(l,d,p,x,j,S){var A=2;if(x=l,typeof l=="function")om(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case D:return Ga(p.children,j,S,d);case P:A=8,j|=8;break;case L:return l=Ur(12,p,d,j|2),l.elementType=L,l.lanes=S,l;case Y:return l=Ur(13,p,d,j),l.elementType=Y,l.lanes=S,l;case U:return l=Ur(19,p,d,j),l.elementType=U,l.lanes=S,l;case re:return hu(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case _:A=10;break e;case J:A=9;break e;case ee:A=11;break e;case R:A=14;break e;case F:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Ur(A,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function Ga(l,d,p,x){return l=Ur(7,l,x,d),l.lanes=p,l}function hu(l,d,p,x){return l=Ur(22,l,x,d),l.elementType=re,l.lanes=p,l.stateNode={isHidden:!1},l}function lm(l,d,p){return l=Ur(6,l,null,d),l.lanes=p,l}function cm(l,d,p){return d=Ur(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function i3(l,d,p,x,j){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ro(0),this.expirationTimes=Ro(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ro(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function dm(l,d,p,x,j,S,A,B,K){return l=new i3(l,d,p,B,K),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Ur(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},jp(S),l}function a3(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),gm.exports=y3(),gm.exports}var wb;function v3(){if(wb)return vu;wb=1;var t=TN();return vu.createRoot=t.createRoot,vu.hydrateRoot=t.hydrateRoot,vu}var b3=v3(),dd=TN();const MN=EN(dd);/**
+`+S.stack}return{value:l,source:d,stack:j,digest:null}}function $p(l,d,p){return{value:l,source:null,stack:p??null,digest:d??null}}function Fp(l,d){try{console.error(d.value)}catch(p){setTimeout(function(){throw p})}}var FE=typeof WeakMap=="function"?WeakMap:Map;function jv(l,d,p){p=ni(-1,p),p.tag=3,p.payload={element:null};var x=d.value;return p.callback=function(){au||(au=!0,tm=x),Fp(l,d)},p}function kv(l,d,p){p=ni(-1,p),p.tag=3;var x=l.type.getDerivedStateFromError;if(typeof x=="function"){var j=d.value;p.payload=function(){return x(j)},p.callback=function(){Fp(l,d)}}var S=l.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(p.callback=function(){Fp(l,d),typeof x!="function"&&(Vi===null?Vi=new Set([this]):Vi.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})}),p}function Sv(l,d,p){var x=l.pingCache;if(x===null){x=l.pingCache=new FE;var j=new Set;x.set(d,j)}else j=x.get(d),j===void 0&&(j=new Set,x.set(d,j));j.has(p)||(j.add(p),l=e3.bind(null,l,d,p),d.then(l,l))}function Cv(l){do{var d;if((d=l.tag===13)&&(d=l.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return l;l=l.return}while(l!==null);return null}function Ev(l,d,p,x,j){return(l.mode&1)===0?(l===d?l.flags|=65536:(l.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(d=ni(-1,1),d.tag=2,Fi(p,d,1))),p.lanes|=1),l):(l.flags|=65536,l.lanes=j,l)}var BE=T.ReactCurrentOwner,br=!1;function hr(l,d,p,x){d.child=l===null?qy(d,null,p,x):Uo(d,l.child,p,x)}function Tv(l,d,p,x,j){p=p.render;var S=d.ref;return qo(d,j),x=Ip(l,d,p,x,S,j),p=Rp(),l!==null&&!br?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~j,ri(l,d,j)):(en&&p&&pp(d),d.flags|=1,hr(l,d,x,j),d.child)}function Mv(l,d,p,x,j){if(l===null){var S=p.type;return typeof S=="function"&&!lm(S)&&S.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(d.tag=15,d.type=S,Av(l,d,S,x,j)):(l=hu(p.type,null,x,d,d.mode,j),l.ref=d.ref,l.return=d,d.child=l)}if(S=l.child,(l.lanes&j)===0){var A=S.memoizedProps;if(p=p.compare,p=p!==null?p:tc,p(A,x)&&l.ref===d.ref)return ri(l,d,j)}return d.flags|=1,l=Ki(S,x),l.ref=d.ref,l.return=d,d.child=l}function Av(l,d,p,x,j){if(l!==null){var S=l.memoizedProps;if(tc(S,x)&&l.ref===d.ref)if(br=!1,d.pendingProps=x=S,(l.lanes&j)!==0)(l.flags&131072)!==0&&(br=!0);else return d.lanes=l.lanes,ri(l,d,j)}return Bp(l,d,p,x,j)}function Iv(l,d,p){var x=d.pendingProps,j=x.children,S=l!==null?l.memoizedState:null;if(x.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},$t(Qo,Ir),Ir|=p;else{if((p&1073741824)===0)return l=S!==null?S.baseLanes|p:p,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:l,cachePool:null,transitions:null},d.updateQueue=null,$t(Qo,Ir),Ir|=l,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=S!==null?S.baseLanes:p,$t(Qo,Ir),Ir|=x}else S!==null?(x=S.baseLanes|p,d.memoizedState=null):x=p,$t(Qo,Ir),Ir|=x;return hr(l,d,j,p),d.child}function Rv(l,d){var p=d.ref;(l===null&&p!==null||l!==null&&l.ref!==p)&&(d.flags|=512,d.flags|=2097152)}function Bp(l,d,p,x,j){var S=vr(p)?$a:Jn.current;return S=Bo(d,S),qo(d,j),p=Ip(l,d,p,x,S,j),x=Rp(),l!==null&&!br?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~j,ri(l,d,j)):(en&&x&&pp(d),d.flags|=1,hr(l,d,p,j),d.child)}function Pv(l,d,p,x,j){if(vr(p)){var S=!0;_d(d)}else S=!1;if(qo(d,j),d.stateNode===null)tu(l,d),wv(d,p,x),zp(d,p,x,j),x=!0;else if(l===null){var A=d.stateNode,B=d.memoizedProps;A.props=B;var K=A.context,ue=p.contextType;typeof ue=="object"&&ue!==null?ue=Wr(ue):(ue=vr(p)?$a:Jn.current,ue=Bo(d,ue));var Ne=p.getDerivedStateFromProps,ke=typeof Ne=="function"||typeof A.getSnapshotBeforeUpdate=="function";ke||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(B!==x||K!==ue)&&Nv(d,A,x,ue),$i=!1;var ve=d.memoizedState;A.state=ve,Kd(d,x,A,j),K=d.memoizedState,B!==x||ve!==K||yr.current||$i?(typeof Ne=="function"&&(_p(d,p,Ne,x),K=d.memoizedState),(B=$i||bv(d,p,B,x,ve,K,ue))?(ke||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(d.flags|=4194308)):(typeof A.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=x,d.memoizedState=K),A.props=x,A.state=K,A.context=ue,x=B):(typeof A.componentDidMount=="function"&&(d.flags|=4194308),x=!1)}else{A=d.stateNode,Jy(l,d),B=d.memoizedProps,ue=d.type===d.elementType?B:us(d.type,B),A.props=ue,ke=d.pendingProps,ve=A.context,K=p.contextType,typeof K=="object"&&K!==null?K=Wr(K):(K=vr(p)?$a:Jn.current,K=Bo(d,K));var Oe=p.getDerivedStateFromProps;(Ne=typeof Oe=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(B!==ke||ve!==K)&&Nv(d,A,x,K),$i=!1,ve=d.memoizedState,A.state=ve,Kd(d,x,A,j);var _e=d.memoizedState;B!==ke||ve!==_e||yr.current||$i?(typeof Oe=="function"&&(_p(d,p,Oe,x),_e=d.memoizedState),(ue=$i||bv(d,p,ue,x,ve,_e,K)||!1)?(Ne||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(x,_e,K),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(x,_e,K)),typeof A.componentDidUpdate=="function"&&(d.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof A.componentDidUpdate!="function"||B===l.memoizedProps&&ve===l.memoizedState||(d.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||B===l.memoizedProps&&ve===l.memoizedState||(d.flags|=1024),d.memoizedProps=x,d.memoizedState=_e),A.props=x,A.state=_e,A.context=K,x=ue):(typeof A.componentDidUpdate!="function"||B===l.memoizedProps&&ve===l.memoizedState||(d.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||B===l.memoizedProps&&ve===l.memoizedState||(d.flags|=1024),x=!1)}return Vp(l,d,p,x,S,j)}function Vp(l,d,p,x,j,S){Rv(l,d);var A=(d.flags&128)!==0;if(!x&&!A)return j&&zy(d,p,!1),ri(l,d,S);x=d.stateNode,BE.current=d;var B=A&&typeof p.getDerivedStateFromError!="function"?null:x.render();return d.flags|=1,l!==null&&A?(d.child=Uo(d,l.child,null,S),d.child=Uo(d,null,B,S)):hr(l,d,B,S),d.memoizedState=x.state,j&&zy(d,p,!0),d.child}function Ov(l){var d=l.stateNode;d.pendingContext?Ly(l,d.pendingContext,d.pendingContext!==d.context):d.context&&Ly(l,d.context,!1),Sp(l,d.containerInfo)}function Dv(l,d,p,x,j){return Wo(),yp(j),d.flags|=256,hr(l,d,p,x),d.child}var Hp={dehydrated:null,treeContext:null,retryLane:0};function Wp(l){return{baseLanes:l,cachePool:null,transitions:null}}function Lv(l,d,p){var x=d.pendingProps,j=rn.current,S=!1,A=(d.flags&128)!==0,B;if((B=A)||(B=l!==null&&l.memoizedState===null?!1:(j&2)!==0),B?(S=!0,d.flags&=-129):(l===null||l.memoizedState!==null)&&(j|=1),$t(rn,j&1),l===null)return xp(d),l=d.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((d.mode&1)===0?d.lanes=1:l.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(A=x.children,l=x.fallback,S?(x=d.mode,S=d.child,A={mode:"hidden",children:A},(x&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=A):S=fu(A,x,0,null),l=Ja(l,x,p,null),S.return=d,l.return=d,S.sibling=l,d.child=S,d.child.memoizedState=Wp(p),d.memoizedState=Hp,l):Up(d,A));if(j=l.memoizedState,j!==null&&(B=j.dehydrated,B!==null))return VE(l,d,A,x,B,j,p);if(S){S=x.fallback,A=d.mode,j=l.child,B=j.sibling;var K={mode:"hidden",children:x.children};return(A&1)===0&&d.child!==j?(x=d.child,x.childLanes=0,x.pendingProps=K,d.deletions=null):(x=Ki(j,K),x.subtreeFlags=j.subtreeFlags&14680064),B!==null?S=Ki(B,S):(S=Ja(S,A,p,null),S.flags|=2),S.return=d,x.return=d,x.sibling=S,d.child=x,x=S,S=d.child,A=l.child.memoizedState,A=A===null?Wp(p):{baseLanes:A.baseLanes|p,cachePool:null,transitions:A.transitions},S.memoizedState=A,S.childLanes=l.childLanes&~p,d.memoizedState=Hp,x}return S=l.child,l=S.sibling,x=Ki(S,{mode:"visible",children:x.children}),(d.mode&1)===0&&(x.lanes=p),x.return=d,x.sibling=null,l!==null&&(p=d.deletions,p===null?(d.deletions=[l],d.flags|=16):p.push(l)),d.child=x,d.memoizedState=null,x}function Up(l,d){return d=fu({mode:"visible",children:d},l.mode,0,null),d.return=l,l.child=d}function eu(l,d,p,x){return x!==null&&yp(x),Uo(d,l.child,null,p),l=Up(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function VE(l,d,p,x,j,S,A){if(p)return d.flags&256?(d.flags&=-257,x=$p(Error(n(422))),eu(l,d,A,x)):d.memoizedState!==null?(d.child=l.child,d.flags|=128,null):(S=x.fallback,j=d.mode,x=fu({mode:"visible",children:x.children},j,0,null),S=Ja(S,j,A,null),S.flags|=2,x.return=d,S.return=d,x.sibling=S,d.child=x,(d.mode&1)!==0&&Uo(d,l.child,null,A),d.child.memoizedState=Wp(A),d.memoizedState=Hp,S);if((d.mode&1)===0)return eu(l,d,A,null);if(j.data==="$!"){if(x=j.nextSibling&&j.nextSibling.dataset,x)var B=x.dgst;return x=B,S=Error(n(419)),x=$p(S,x,void 0),eu(l,d,A,x)}if(B=(A&l.childLanes)!==0,br||B){if(x=Pn,x!==null){switch(A&-A){case 4:j=2;break;case 16:j=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:j=32;break;case 536870912:j=268435456;break;default:j=0}j=(j&(x.suspendedLanes|A))!==0?0:j,j!==0&&j!==S.retryLane&&(S.retryLane=j,ti(l,j),ps(x,l,j,-1))}return om(),x=$p(Error(n(421))),eu(l,d,A,x)}return j.data==="$?"?(d.flags|=128,d.child=l.child,d=t3.bind(null,l),j._reactRetry=d,null):(l=S.treeContext,Ar=Di(j.nextSibling),Mr=d,en=!0,ds=null,l!==null&&(Vr[Hr++]=Zs,Vr[Hr++]=ei,Vr[Hr++]=Fa,Zs=l.id,ei=l.overflow,Fa=d),d=Up(d,x.children),d.flags|=4096,d)}function _v(l,d,p){l.lanes|=d;var x=l.alternate;x!==null&&(x.lanes|=d),Np(l.return,d,p)}function Kp(l,d,p,x,j){var S=l.memoizedState;S===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:x,tail:p,tailMode:j}:(S.isBackwards=d,S.rendering=null,S.renderingStartTime=0,S.last=x,S.tail=p,S.tailMode=j)}function zv(l,d,p){var x=d.pendingProps,j=x.revealOrder,S=x.tail;if(hr(l,d,x.children,p),x=rn.current,(x&2)!==0)x=x&1|2,d.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&_v(l,p,d);else if(l.tag===19)_v(l,p,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}x&=1}if($t(rn,x),(d.mode&1)===0)d.memoizedState=null;else switch(j){case"forwards":for(p=d.child,j=null;p!==null;)l=p.alternate,l!==null&&qd(l)===null&&(j=p),p=p.sibling;p=j,p===null?(j=d.child,d.child=null):(j=p.sibling,p.sibling=null),Kp(d,!1,j,p,S);break;case"backwards":for(p=null,j=d.child,d.child=null;j!==null;){if(l=j.alternate,l!==null&&qd(l)===null){d.child=j;break}l=j.sibling,j.sibling=p,p=j,j=l}Kp(d,!0,p,null,S);break;case"together":Kp(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function tu(l,d){(d.mode&1)===0&&l!==null&&(l.alternate=null,d.alternate=null,d.flags|=2)}function ri(l,d,p){if(l!==null&&(d.dependencies=l.dependencies),Ua|=d.lanes,(p&d.childLanes)===0)return null;if(l!==null&&d.child!==l.child)throw Error(n(153));if(d.child!==null){for(l=d.child,p=Ki(l,l.pendingProps),d.child=p,p.return=d;l.sibling!==null;)l=l.sibling,p=p.sibling=Ki(l,l.pendingProps),p.return=d;p.sibling=null}return d.child}function HE(l,d,p){switch(d.tag){case 3:Ov(d),Wo();break;case 5:Xy(d);break;case 1:vr(d.type)&&_d(d);break;case 4:Sp(d,d.stateNode.containerInfo);break;case 10:var x=d.type._context,j=d.memoizedProps.value;$t(Hd,x._currentValue),x._currentValue=j;break;case 13:if(x=d.memoizedState,x!==null)return x.dehydrated!==null?($t(rn,rn.current&1),d.flags|=128,null):(p&d.child.childLanes)!==0?Lv(l,d,p):($t(rn,rn.current&1),l=ri(l,d,p),l!==null?l.sibling:null);$t(rn,rn.current&1);break;case 19:if(x=(p&d.childLanes)!==0,(l.flags&128)!==0){if(x)return zv(l,d,p);d.flags|=128}if(j=d.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),$t(rn,rn.current),x)break;return null;case 22:case 23:return d.lanes=0,Iv(l,d,p)}return ri(l,d,p)}var $v,qp,Fv,Bv;$v=function(l,d){for(var p=d.child;p!==null;){if(p.tag===5||p.tag===6)l.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},qp=function(){},Fv=function(l,d,p,x){var j=l.memoizedProps;if(j!==x){l=d.stateNode,Ha(Es.current);var S=null;switch(p){case"input":j=Dt(l,j),x=Dt(l,x),S=[];break;case"select":j=G({},j,{value:void 0}),x=G({},x,{value:void 0}),S=[];break;case"textarea":j=mt(l,j),x=mt(l,x),S=[];break;default:typeof j.onClick!="function"&&typeof x.onClick=="function"&&(l.onclick=Od)}Ni(p,x);var A;p=null;for(ue in j)if(!x.hasOwnProperty(ue)&&j.hasOwnProperty(ue)&&j[ue]!=null)if(ue==="style"){var B=j[ue];for(A in B)B.hasOwnProperty(A)&&(p||(p={}),p[A]="")}else ue!=="dangerouslySetInnerHTML"&&ue!=="children"&&ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&ue!=="autoFocus"&&(i.hasOwnProperty(ue)?S||(S=[]):(S=S||[]).push(ue,null));for(ue in x){var K=x[ue];if(B=j!=null?j[ue]:void 0,x.hasOwnProperty(ue)&&K!==B&&(K!=null||B!=null))if(ue==="style")if(B){for(A in B)!B.hasOwnProperty(A)||K&&K.hasOwnProperty(A)||(p||(p={}),p[A]="");for(A in K)K.hasOwnProperty(A)&&B[A]!==K[A]&&(p||(p={}),p[A]=K[A])}else p||(S||(S=[]),S.push(ue,p)),p=K;else ue==="dangerouslySetInnerHTML"?(K=K?K.__html:void 0,B=B?B.__html:void 0,K!=null&&B!==K&&(S=S||[]).push(ue,K)):ue==="children"?typeof K!="string"&&typeof K!="number"||(S=S||[]).push(ue,""+K):ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&(i.hasOwnProperty(ue)?(K!=null&&ue==="onScroll"&&Kt("scroll",l),S||B===K||(S=[])):(S=S||[]).push(ue,K))}p&&(S=S||[]).push("style",p);var ue=S;(d.updateQueue=ue)&&(d.flags|=4)}},Bv=function(l,d,p,x){p!==x&&(d.flags|=4)};function gc(l,d){if(!en)switch(l.tailMode){case"hidden":d=l.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?l.tail=null:p.sibling=null;break;case"collapsed":p=l.tail;for(var x=null;p!==null;)p.alternate!==null&&(x=p),p=p.sibling;x===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:x.sibling=null}}function Qn(l){var d=l.alternate!==null&&l.alternate.child===l.child,p=0,x=0;if(d)for(var j=l.child;j!==null;)p|=j.lanes|j.childLanes,x|=j.subtreeFlags&14680064,x|=j.flags&14680064,j.return=l,j=j.sibling;else for(j=l.child;j!==null;)p|=j.lanes|j.childLanes,x|=j.subtreeFlags,x|=j.flags,j.return=l,j=j.sibling;return l.subtreeFlags|=x,l.childLanes=p,d}function WE(l,d,p){var x=d.pendingProps;switch(mp(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qn(d),null;case 1:return vr(d.type)&&Ld(),Qn(d),null;case 3:return x=d.stateNode,Go(),qt(yr),qt(Jn),Tp(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(l===null||l.child===null)&&(Bd(d)?d.flags|=4:l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,ds!==null&&(sm(ds),ds=null))),qp(l,d),Qn(d),null;case 5:Cp(d);var j=Ha(uc.current);if(p=d.type,l!==null&&d.stateNode!=null)Fv(l,d,p,x,j),l.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!x){if(d.stateNode===null)throw Error(n(166));return Qn(d),null}if(l=Ha(Es.current),Bd(d)){x=d.stateNode,p=d.type;var S=d.memoizedProps;switch(x[Cs]=d,x[ac]=S,l=(d.mode&1)!==0,p){case"dialog":Kt("cancel",x),Kt("close",x);break;case"iframe":case"object":case"embed":Kt("load",x);break;case"video":case"audio":for(j=0;j<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[Cs]=d,l[ac]=x,$v(l,d,!1,!1),d.stateNode=l;e:{switch(A=ji(p,x),p){case"dialog":Kt("cancel",l),Kt("close",l),j=x;break;case"iframe":case"object":case"embed":Kt("load",l),j=x;break;case"video":case"audio":for(j=0;jXo&&(d.flags|=128,x=!0,gc(S,!1),d.lanes=4194304)}else{if(!x)if(l=qd(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),gc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!en)return Qn(d),null}else 2*zt()-S.renderingStartTime>Xo&&p!==1073741824&&(d.flags|=128,x=!0,gc(S,!1),d.lanes=4194304);S.isBackwards?(A.sibling=d.child,d.child=A):(p=S.last,p!==null?p.sibling=A:d.child=A,S.last=A)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=zt(),d.sibling=null,p=rn.current,$t(rn,x?p&1|2:p&1),d):(Qn(d),null);case 22:case 23:return am(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Ir&1073741824)!==0&&(Qn(d),d.subtreeFlags&6&&(d.flags|=8192)):Qn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function UE(l,d){switch(mp(d),d.tag){case 1:return vr(d.type)&&Ld(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Go(),qt(yr),qt(Jn),Tp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Cp(d),null;case 13:if(qt(rn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Wo()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return qt(rn),null;case 4:return Go(),null;case 10:return wp(d.type._context),null;case 22:case 23:return am(),null;case 24:return null;default:return null}}var nu=!1,Xn=!1,KE=typeof WeakSet=="function"?WeakSet:Set,De=null;function Yo(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){cn(l,d,x)}else p.current=null}function Gp(l,d,p){try{p()}catch(x){cn(l,d,x)}}var Vv=!1;function qE(l,d){if(ap=Nd,l=by(),Xf(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var j=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,B=-1,K=-1,ue=0,Ne=0,ke=l,ve=null;t:for(;;){for(var Oe;ke!==p||j!==0&&ke.nodeType!==3||(B=A+j),ke!==S||x!==0&&ke.nodeType!==3||(K=A+x),ke.nodeType===3&&(A+=ke.nodeValue.length),(Oe=ke.firstChild)!==null;)ve=ke,ke=Oe;for(;;){if(ke===l)break t;if(ve===p&&++ue===j&&(B=A),ve===S&&++Ne===x&&(K=A),(Oe=ke.nextSibling)!==null)break;ke=ve,ve=ke.parentNode}ke=Oe}p=B===-1||K===-1?null:{start:B,end:K}}else p=null}p=p||{start:0,end:0}}else p=null;for(op={focusedElem:l,selectionRange:p},Nd=!1,De=d;De!==null;)if(d=De,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,De=l;else for(;De!==null;){d=De;try{var _e=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Fe=_e.memoizedProps,gn=_e.memoizedState,se=d.stateNode,Q=se.getSnapshotBeforeUpdate(d.elementType===d.type?Fe:us(d.type,Fe),gn);se.__reactInternalSnapshotBeforeUpdate=Q}break;case 3:var le=d.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ee){cn(d,d.return,Ee)}if(l=d.sibling,l!==null){l.return=d.return,De=l;break}De=d.return}return _e=Vv,Vv=!1,_e}function xc(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&l)===l){var S=j.destroy;j.destroy=void 0,S!==void 0&&Gp(d,p,S)}j=j.next}while(j!==x)}}function ru(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function Jp(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function Hv(l){var d=l.alternate;d!==null&&(l.alternate=null,Hv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Cs],delete d[ac],delete d[up],delete d[ME],delete d[AE])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function Wv(l){return l.tag===5||l.tag===3||l.tag===4}function Uv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Wv(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Yp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=Od));else if(x!==4&&(l=l.child,l!==null))for(Yp(l,d,p),l=l.sibling;l!==null;)Yp(l,d,p),l=l.sibling}function Qp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(Qp(l,d,p),l=l.sibling;l!==null;)Qp(l,d,p),l=l.sibling}var Fn=null,hs=!1;function Bi(l,d,p){for(p=p.child;p!==null;)Kv(l,d,p),p=p.sibling}function Kv(l,d,p){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(H,p)}catch{}switch(p.tag){case 5:Xn||Yo(p,d);case 6:var x=Fn,j=hs;Fn=null,Bi(l,d,p),Fn=x,hs=j,Fn!==null&&(hs?(l=Fn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Fn.removeChild(p.stateNode));break;case 18:Fn!==null&&(hs?(l=Fn,p=p.stateNode,l.nodeType===8?dp(l.parentNode,p):l.nodeType===1&&dp(l,p),Jl(l)):dp(Fn,p.stateNode));break;case 4:x=Fn,j=hs,Fn=p.stateNode.containerInfo,hs=!0,Bi(l,d,p),Fn=x,hs=j;break;case 0:case 11:case 14:case 15:if(!Xn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){j=x=x.next;do{var S=j,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&Gp(p,d,A),j=j.next}while(j!==x)}Bi(l,d,p);break;case 1:if(!Xn&&(Yo(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(B){cn(p,d,B)}Bi(l,d,p);break;case 21:Bi(l,d,p);break;case 22:p.mode&1?(Xn=(x=Xn)||p.memoizedState!==null,Bi(l,d,p),Xn=x):Bi(l,d,p);break;default:Bi(l,d,p)}}function qv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new KE),d.forEach(function(x){var j=n3.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function fs(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=A),x&=~S}if(x=j,x=zt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*JE(x/1960))-x,10l?16:l,Hi===null)var x=!1;else{if(l=Hi,Hi=null,lu=0,(xt&6)!==0)throw Error(n(331));var j=xt;for(xt|=4,De=l.current;De!==null;){var S=De,A=S.child;if((De.flags&16)!==0){var B=S.deletions;if(B!==null){for(var K=0;Kzt()-em?qa(l,0):Zp|=p),Nr(l,d)}function ab(l,d){d===0&&((l.mode&1)===0?d=1:(d=$n,$n<<=1,($n&130023424)===0&&($n=4194304)));var p=fr();l=ti(l,d),l!==null&&(Ri(l,d,p),Nr(l,p))}function t3(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),ab(l,p)}function n3(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,j=l.memoizedState;j!==null&&(p=j.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),ab(l,p)}var ob;ob=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||yr.current)br=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return br=!1,HE(l,d,p);br=(l.flags&131072)!==0}else br=!1,en&&(d.flags&1048576)!==0&&Fy(d,Fd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;tu(l,d),l=d.pendingProps;var j=Bo(d,Jn.current);qo(d,p),j=Ip(null,d,x,l,j,p);var S=Rp();return d.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,vr(x)?(S=!0,_d(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,kp(d),j.updater=Zd,d.stateNode=j,j._reactInternals=d,zp(d,x,l,p),d=Vp(null,d,x,!0,S,p)):(d.tag=0,en&&S&&pp(d),hr(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(tu(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=s3(x),l=us(x,l),j){case 0:d=Bp(null,d,x,l,p);break e;case 1:d=Pv(null,d,x,l,p);break e;case 11:d=Tv(null,d,x,l,p);break e;case 14:d=Mv(null,d,x,us(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:us(x,j),Bp(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:us(x,j),Pv(l,d,x,j,p);case 3:e:{if(Ov(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,Jy(l,d),Kd(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=Jo(Error(n(423)),d),d=Dv(l,d,x,p,j);break e}else if(x!==j){j=Jo(Error(n(424)),d),d=Dv(l,d,x,p,j);break e}else for(Ar=Di(d.stateNode.containerInfo.firstChild),Mr=d,en=!0,ds=null,p=qy(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Wo(),x===j){d=ri(l,d,p);break e}hr(l,d,x,p)}d=d.child}return d;case 5:return Xy(d),l===null&&xp(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,lp(x,j)?A=null:S!==null&&lp(x,S)&&(d.flags|=32),Rv(l,d),hr(l,d,A,p),d.child;case 6:return l===null&&xp(d),null;case 13:return Lv(l,d,p);case 4:return Sp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=Uo(d,null,x,p):hr(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:us(x,j),Tv(l,d,x,j,p);case 7:return hr(l,d,d.pendingProps,p),d.child;case 8:return hr(l,d,d.pendingProps.children,p),d.child;case 12:return hr(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,j=d.pendingProps,S=d.memoizedProps,A=j.value,$t(Hd,x._currentValue),x._currentValue=A,S!==null)if(cs(S.value,A)){if(S.children===j.children&&!yr.current){d=ri(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var B=S.dependencies;if(B!==null){A=S.child;for(var K=B.firstContext;K!==null;){if(K.context===x){if(S.tag===1){K=ni(-1,p&-p),K.tag=2;var ue=S.updateQueue;if(ue!==null){ue=ue.shared;var Ne=ue.pending;Ne===null?K.next=K:(K.next=Ne.next,Ne.next=K),ue.pending=K}}S.lanes|=p,K=S.alternate,K!==null&&(K.lanes|=p),Np(S.return,p,d),B.lanes|=p;break}K=K.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,B=A.alternate,B!==null&&(B.lanes|=p),Np(A,p,d),A=S.sibling}else A=S.child;if(A!==null)A.return=S;else for(A=S;A!==null;){if(A===d){A=null;break}if(S=A.sibling,S!==null){S.return=A.return,A=S;break}A=A.return}S=A}hr(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,qo(d,p),j=Wr(j),x=x(j),d.flags|=1,hr(l,d,x,p),d.child;case 14:return x=d.type,j=us(x,d.pendingProps),j=us(x.type,j),Mv(l,d,x,j,p);case 15:return Av(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:us(x,j),tu(l,d),d.tag=1,vr(x)?(l=!0,_d(d)):l=!1,qo(d,p),wv(d,x,j),zp(d,x,j,p),Vp(null,d,x,!0,l,p);case 19:return zv(l,d,p);case 22:return Iv(l,d,p)}throw Error(n(156,d.tag))};function lb(l,d){return Ei(l,d)}function r3(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(l,d,p,x){return new r3(l,d,p,x)}function lm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function s3(l){if(typeof l=="function")return lm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===ee)return 11;if(l===R)return 14}return 2}function Ki(l,d){var p=l.alternate;return p===null?(p=qr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function hu(l,d,p,x,j,S){var A=2;if(x=l,typeof l=="function")lm(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case D:return Ja(p.children,j,S,d);case P:A=8,j|=8;break;case L:return l=qr(12,p,d,j|2),l.elementType=L,l.lanes=S,l;case Y:return l=qr(13,p,d,j),l.elementType=Y,l.lanes=S,l;case U:return l=qr(19,p,d,j),l.elementType=U,l.lanes=S,l;case re:return fu(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case _:A=10;break e;case J:A=9;break e;case ee:A=11;break e;case R:A=14;break e;case F:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=qr(A,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function Ja(l,d,p,x){return l=qr(7,l,x,d),l.lanes=p,l}function fu(l,d,p,x){return l=qr(22,l,x,d),l.elementType=re,l.lanes=p,l.stateNode={isHidden:!1},l}function cm(l,d,p){return l=qr(6,l,null,d),l.lanes=p,l}function dm(l,d,p){return d=qr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function i3(l,d,p,x,j){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hl(0),this.expirationTimes=Hl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hl(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function um(l,d,p,x,j,S,A,B,K){return l=new i3(l,d,p,B,K),d===1?(d=1,S===!0&&(d|=8)):d=0,S=qr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},kp(S),l}function a3(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),xm.exports=y3(),xm.exports}var Nb;function v3(){if(Nb)return bu;Nb=1;var t=MN();return bu.createRoot=t.createRoot,bu.hydrateRoot=t.hydrateRoot,bu}var b3=v3(),ud=MN();const AN=TN(ud);/**
* @remix-run/router v1.23.2
*
* Copyright (c) Remix Software Inc.
@@ -46,7 +46,7 @@ Error generating stack: `+S.message+`
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
- */function Kc(){return Kc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Ex(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function N3(){return Math.random().toString(36).substr(2,8)}function jb(t,e){return{usr:t.state,key:t.key,idx:e}}function gg(t,e,n,r){return n===void 0&&(n=null),Kc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Rl(e):e,{state:n,key:e&&e.key||r||N3()})}function sh(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Rl(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function j3(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,c=sa.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Kc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=sa.Pop;let b=f(),k=b==null?null:b-h;h=b,u&&u({action:c,location:N.location,delta:k})}function g(b,k){c=sa.Push;let C=gg(N.location,b,k);h=f()+1;let E=jb(C,h),T=N.createHref(C);try{o.pushState(E,"",T)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(T)}a&&u&&u({action:c,location:N.location,delta:1})}function y(b,k){c=sa.Replace;let C=gg(N.location,b,k);h=f();let E=jb(C,h),T=N.createHref(C);o.replaceState(E,"",T),a&&u&&u({action:c,location:N.location,delta:0})}function w(b){let k=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof b=="string"?b:sh(b);return C=C.replace(/ $/,"%20"),xn(k,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,k)}let N={get action(){return c},get location(){return t(i,o)},listen(b){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(Nb,m),u=b,()=>{i.removeEventListener(Nb,m),u=null}},createHref(b){return e(i,b)},createURL:w,encodeLocation(b){let k=w(b);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(b){return o.go(b)}};return N}var kb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(kb||(kb={}));function k3(t,e,n){return n===void 0&&(n="/"),S3(t,e,n)}function S3(t,e,n,r){let i=typeof e=="string"?Rl(e):e,a=Tx(i.pathname||"/",n);if(a==null)return null;let o=AN(t);C3(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};u.relativePath.startsWith("/")&&(xn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=ca([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(xn(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),AN(a.children,e,f,h)),!(a.path==null&&!a.index)&&e.push({path:h,score:P3(h,a.index),routesMeta:f})};return t.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))i(a,o);else for(let u of IN(a.path))i(a,o,u)}),e}function IN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=IN(r.join("/")),c=[];return c.push(...o.map(u=>u===""?a:[a,u].join("/"))),i&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function C3(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:O3(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const E3=/^:[\w-]+$/,T3=3,M3=2,A3=1,I3=10,R3=-2,Sb=t=>t==="*";function P3(t,e){let n=t.split("/"),r=n.length;return n.some(Sb)&&(r+=R3),e&&(r+=M3),n.filter(i=>!Sb(i)).reduce((i,a)=>i+(E3.test(a)?T3:a===""?A3:I3),r)}function O3(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function D3(t,e,n){let{routesMeta:r}=t,i={},a="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let N=c[m]||"";o=a.slice(0,a.length-N.length).replace(/(.)\/+$/,"$1")}const w=c[m];return y&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:o,pattern:t}}function _3(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Ex(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function z3(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ex(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Tx(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const $3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,F3=t=>$3.test(t);function B3(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Rl(t):t,a;if(n)if(F3(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Ex(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=Cb(n.substring(1),"/"):a=Cb(n,e)}else a=e;return{pathname:a,search:W3(r),hash:U3(i)}}function Cb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function vm(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function V3(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Mx(t,e){let n=V3(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Ax(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Rl(t):(i=Kc({},t),xn(!i.pathname||!i.pathname.includes("?"),vm("?","pathname","search",i)),xn(!i.pathname||!i.pathname.includes("#"),vm("#","pathname","hash",i)),xn(!i.search||!i.search.includes("#"),vm("#","search","hash",i)));let a=t===""||i.pathname==="",o=a?"/":i.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;i.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=B3(i,c),h=o&&o!=="/"&&o.endsWith("/"),f=(a||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const ca=t=>t.join("/").replace(/\/\/+/g,"/"),H3=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),W3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,U3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function K3(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const RN=["post","put","patch","delete"];new Set(RN);const q3=["get",...RN];new Set(q3);/**
+ */function qc(){return qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Tx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function N3(){return Math.random().toString(36).substr(2,8)}function kb(t,e){return{usr:t.state,key:t.key,idx:e}}function xg(t,e,n,r){return n===void 0&&(n=null),qc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Al(e):e,{state:n,key:e&&e.key||r||N3()})}function ih(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Al(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function j3(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,c=ia.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(qc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=ia.Pop;let b=f(),k=b==null?null:b-h;h=b,u&&u({action:c,location:N.location,delta:k})}function g(b,k){c=ia.Push;let C=xg(N.location,b,k);h=f()+1;let E=kb(C,h),T=N.createHref(C);try{o.pushState(E,"",T)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(T)}a&&u&&u({action:c,location:N.location,delta:1})}function y(b,k){c=ia.Replace;let C=xg(N.location,b,k);h=f();let E=kb(C,h),T=N.createHref(C);o.replaceState(E,"",T),a&&u&&u({action:c,location:N.location,delta:0})}function w(b){let k=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof b=="string"?b:ih(b);return C=C.replace(/ $/,"%20"),yn(k,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,k)}let N={get action(){return c},get location(){return t(i,o)},listen(b){if(u)throw new Error("A history only accepts one active listener");return i.addEventListener(jb,m),u=b,()=>{i.removeEventListener(jb,m),u=null}},createHref(b){return e(i,b)},createURL:w,encodeLocation(b){let k=w(b);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(b){return o.go(b)}};return N}var Sb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Sb||(Sb={}));function k3(t,e,n){return n===void 0&&(n="/"),S3(t,e,n)}function S3(t,e,n,r){let i=typeof e=="string"?Al(e):e,a=Mx(i.pathname||"/",n);if(a==null)return null;let o=IN(t);C3(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};u.relativePath.startsWith("/")&&(yn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=da([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(yn(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),IN(a.children,e,f,h)),!(a.path==null&&!a.index)&&e.push({path:h,score:P3(h,a.index),routesMeta:f})};return t.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))i(a,o);else for(let u of RN(a.path))i(a,o,u)}),e}function RN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=RN(r.join("/")),c=[];return c.push(...o.map(u=>u===""?a:[a,u].join("/"))),i&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function C3(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:O3(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const E3=/^:[\w-]+$/,T3=3,M3=2,A3=1,I3=10,R3=-2,Cb=t=>t==="*";function P3(t,e){let n=t.split("/"),r=n.length;return n.some(Cb)&&(r+=R3),e&&(r+=M3),n.filter(i=>!Cb(i)).reduce((i,a)=>i+(E3.test(a)?T3:a===""?A3:I3),r)}function O3(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function D3(t,e,n){let{routesMeta:r}=t,i={},a="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let N=c[m]||"";o=a.slice(0,a.length-N.length).replace(/(.)\/+$/,"$1")}const w=c[m];return y&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:o,pattern:t}}function _3(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Tx(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function z3(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Tx(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Mx(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const $3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,F3=t=>$3.test(t);function B3(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Al(t):t,a;if(n)if(F3(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Tx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=Eb(n.substring(1),"/"):a=Eb(n,e)}else a=e;return{pathname:a,search:W3(r),hash:U3(i)}}function Eb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function bm(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function V3(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Ax(t,e){let n=V3(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Ix(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Al(t):(i=qc({},t),yn(!i.pathname||!i.pathname.includes("?"),bm("?","pathname","search",i)),yn(!i.pathname||!i.pathname.includes("#"),bm("#","pathname","hash",i)),yn(!i.search||!i.search.includes("#"),bm("#","search","hash",i)));let a=t===""||i.pathname==="",o=a?"/":i.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;i.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=B3(i,c),h=o&&o!=="/"&&o.endsWith("/"),f=(a||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const da=t=>t.join("/").replace(/\/\/+/g,"/"),H3=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),W3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,U3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function K3(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const PN=["post","put","patch","delete"];new Set(PN);const q3=["get",...PN];new Set(q3);/**
* React Router v6.30.3
*
* Copyright (c) Remix Software Inc.
@@ -55,7 +55,7 @@ Error generating stack: `+S.message+`
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
- */function qc(){return qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),v.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=Ax(h,JSON.parse(o),a,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:ca([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,a,t])}const Q3=v.createContext(null);function X3(t){let e=v.useContext(Ni).outlet;return e&&v.createElement(Q3.Provider,{value:t},e)}function DN(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=v.useContext(wa),{matches:i}=v.useContext(Ni),{pathname:a}=Na(),o=JSON.stringify(Mx(i,r.v7_relativeSplatPath));return v.useMemo(()=>Ax(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function Z3(t,e){return eT(t,e)}function eT(t,e,n,r){Pl()||xn(!1);let{navigator:i}=v.useContext(wa),{matches:a}=v.useContext(Ni),o=a[a.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Na(),f;if(e){var m;let b=typeof e=="string"?Rl(e):e;u==="/"||(m=b.pathname)!=null&&m.startsWith(u)||xn(!1),f=b}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let b=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(b.length).join("/")}let w=k3(t,{pathname:y}),N=iT(w&&w.map(b=>Object.assign({},b,{params:Object.assign({},c,b.params),pathname:ca([u,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?u:ca([u,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),a,n,r);return e&&N?v.createElement(lf.Provider,{value:{location:qc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:sa.Pop}},N):N}function tT(){let t=cT(),e=K3(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:i},n):null,null)}const nT=v.createElement(tT,null);class rT extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?v.createElement(Ni.Provider,{value:this.props.routeContext},v.createElement(PN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sT(t){let{routeContext:e,match:n,children:r}=t,i=v.useContext(Ix);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Ni.Provider,{value:e},r)}function iT(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var a;if(!n)return null;if(n.errors)t=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(i=n)==null?void 0:i.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||xn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let y,w=!1,N=null,b=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,N=m.route.errorElement||nT,u&&(h<0&&g===0?(uT("route-fallback"),w=!0,b=null):h===g&&(w=!0,b=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),C=()=>{let E;return y?E=N:w?E=b:m.route.Component?E=v.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=f,v.createElement(sT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:E})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?v.createElement(rT,{location:n.location,revalidation:n.revalidation,component:N,error:y,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):C()},null)}var LN=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(LN||{}),_N=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(_N||{});function aT(t){let e=v.useContext(Ix);return e||xn(!1),e}function oT(t){let e=v.useContext(G3);return e||xn(!1),e}function lT(t){let e=v.useContext(Ni);return e||xn(!1),e}function zN(t){let e=lT(),n=e.matches[e.matches.length-1];return n.route.id||xn(!1),n.route.id}function cT(){var t;let e=v.useContext(PN),n=oT(),r=zN();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function dT(){let{router:t}=aT(LN.UseNavigateStable),e=zN(_N.UseNavigateStable),n=v.useRef(!1);return ON(()=>{n.current=!0}),v.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,qc({fromRouteId:e},a)))},[t,e])}const Eb={};function uT(t,e,n){Eb[t]||(Eb[t]=!0)}function hT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function bm(t){let{to:e,replace:n,state:r,relative:i}=t;Pl()||xn(!1);let{future:a,static:o}=v.useContext(wa),{matches:c}=v.useContext(Ni),{pathname:u}=Na(),h=ja(),f=Ax(e,Mx(c,a.v7_relativeSplatPath),u,i==="path"),m=JSON.stringify(f);return v.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:i}),[h,m,i,n,r]),null}function fT(t){return X3(t.context)}function Wt(t){xn(!1)}function pT(t){let{basename:e="/",children:n=null,location:r,navigationType:i=sa.Pop,navigator:a,static:o=!1,future:c}=t;Pl()&&xn(!1);let u=e.replace(/^\/*/,"/"),h=v.useMemo(()=>({basename:u,navigator:a,static:o,future:qc({v7_relativeSplatPath:!1},c)}),[u,c,a,o]);typeof r=="string"&&(r=Rl(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:w="default"}=r,N=v.useMemo(()=>{let b=Tx(f,u);return b==null?null:{location:{pathname:b,search:m,hash:g,state:y,key:w},navigationType:i}},[u,f,m,g,y,w,i]);return N==null?null:v.createElement(wa.Provider,{value:h},v.createElement(lf.Provider,{children:n,value:N}))}function mT(t){let{children:e,location:n}=t;return Z3(xg(e),n)}new Promise(()=>{});function xg(t,e){e===void 0&&(e=[]);let n=[];return v.Children.forEach(t,(r,i)=>{if(!v.isValidElement(r))return;let a=[...e,i];if(r.type===v.Fragment){n.push.apply(n,xg(r.props.children,a));return}r.type!==Wt&&xn(!1),!r.props.index||!r.props.children||xn(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=xg(r.props.children,a)),n.push(o)}),n}/**
+ */function Gc(){return Gc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),v.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=Ix(h,JSON.parse(o),a,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:da([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,a,t])}const Q3=v.createContext(null);function X3(t){let e=v.useContext(bi).outlet;return e&&v.createElement(Q3.Provider,{value:t},e)}function LN(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=v.useContext(Na),{matches:i}=v.useContext(bi),{pathname:a}=ja(),o=JSON.stringify(Ax(i,r.v7_relativeSplatPath));return v.useMemo(()=>Ix(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function Z3(t,e){return eT(t,e)}function eT(t,e,n,r){Il()||yn(!1);let{navigator:i}=v.useContext(Na),{matches:a}=v.useContext(bi),o=a[a.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=ja(),f;if(e){var m;let b=typeof e=="string"?Al(e):e;u==="/"||(m=b.pathname)!=null&&m.startsWith(u)||yn(!1),f=b}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let b=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(b.length).join("/")}let w=k3(t,{pathname:y}),N=iT(w&&w.map(b=>Object.assign({},b,{params:Object.assign({},c,b.params),pathname:da([u,i.encodeLocation?i.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?u:da([u,i.encodeLocation?i.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),a,n,r);return e&&N?v.createElement(cf.Provider,{value:{location:Gc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:ia.Pop}},N):N}function tT(){let t=cT(),e=K3(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:i},n):null,null)}const nT=v.createElement(tT,null);class rT extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?v.createElement(bi.Provider,{value:this.props.routeContext},v.createElement(ON.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sT(t){let{routeContext:e,match:n,children:r}=t,i=v.useContext(Rx);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(bi.Provider,{value:e},r)}function iT(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var a;if(!n)return null;if(n.errors)t=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(i=n)==null?void 0:i.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||yn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let y,w=!1,N=null,b=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,N=m.route.errorElement||nT,u&&(h<0&&g===0?(uT("route-fallback"),w=!0,b=null):h===g&&(w=!0,b=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),C=()=>{let E;return y?E=N:w?E=b:m.route.Component?E=v.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=f,v.createElement(sT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:E})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?v.createElement(rT,{location:n.location,revalidation:n.revalidation,component:N,error:y,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):C()},null)}var _N=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(_N||{}),zN=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(zN||{});function aT(t){let e=v.useContext(Rx);return e||yn(!1),e}function oT(t){let e=v.useContext(G3);return e||yn(!1),e}function lT(t){let e=v.useContext(bi);return e||yn(!1),e}function $N(t){let e=lT(),n=e.matches[e.matches.length-1];return n.route.id||yn(!1),n.route.id}function cT(){var t;let e=v.useContext(ON),n=oT(),r=$N();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function dT(){let{router:t}=aT(_N.UseNavigateStable),e=$N(zN.UseNavigateStable),n=v.useRef(!1);return DN(()=>{n.current=!0}),v.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Gc({fromRouteId:e},a)))},[t,e])}const Tb={};function uT(t,e,n){Tb[t]||(Tb[t]=!0)}function hT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function wm(t){let{to:e,replace:n,state:r,relative:i}=t;Il()||yn(!1);let{future:a,static:o}=v.useContext(Na),{matches:c}=v.useContext(bi),{pathname:u}=ja(),h=ka(),f=Ix(e,Ax(c,a.v7_relativeSplatPath),u,i==="path"),m=JSON.stringify(f);return v.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:i}),[h,m,i,n,r]),null}function fT(t){return X3(t.context)}function Gt(t){yn(!1)}function pT(t){let{basename:e="/",children:n=null,location:r,navigationType:i=ia.Pop,navigator:a,static:o=!1,future:c}=t;Il()&&yn(!1);let u=e.replace(/^\/*/,"/"),h=v.useMemo(()=>({basename:u,navigator:a,static:o,future:Gc({v7_relativeSplatPath:!1},c)}),[u,c,a,o]);typeof r=="string"&&(r=Al(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:w="default"}=r,N=v.useMemo(()=>{let b=Mx(f,u);return b==null?null:{location:{pathname:b,search:m,hash:g,state:y,key:w},navigationType:i}},[u,f,m,g,y,w,i]);return N==null?null:v.createElement(Na.Provider,{value:h},v.createElement(cf.Provider,{children:n,value:N}))}function mT(t){let{children:e,location:n}=t;return Z3(yg(e),n)}new Promise(()=>{});function yg(t,e){e===void 0&&(e=[]);let n=[];return v.Children.forEach(t,(r,i)=>{if(!v.isValidElement(r))return;let a=[...e,i];if(r.type===v.Fragment){n.push.apply(n,yg(r.props.children,a));return}r.type!==Gt&&yn(!1),!r.props.index||!r.props.children||yn(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=yg(r.props.children,a)),n.push(o)}),n}/**
* React Router DOM v6.30.3
*
* Copyright (c) Remix Software Inc.
@@ -64,12 +64,12 @@ Error generating stack: `+S.message+`
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
- */function yg(){return yg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function xT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yT(t,e){return t.button===0&&(!e||e==="_self")&&!xT(t)}function vg(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function vT(t,e){let n=vg(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(a=>{n.append(i,a)})}),n}const bT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],wT="6";try{window.__reactRouterVersion=wT}catch{}const NT="startTransition",Tb=of[NT];function jT(t){let{basename:e,children:n,future:r,window:i}=t,a=v.useRef();a.current==null&&(a.current=w3({window:i,v5Compat:!0}));let o=a.current,[c,u]=v.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=v.useCallback(m=>{h&&Tb?Tb(()=>u(m)):u(m)},[u,h]);return v.useLayoutEffect(()=>o.listen(f),[o,f]),v.useEffect(()=>hT(r),[r]),v.createElement(pT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const kT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ST=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bg=v.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=gT(e,bT),{basename:y}=v.useContext(wa),w,N=!1;if(typeof h=="string"&&ST.test(h)&&(w=h,kT))try{let E=new URL(window.location.href),T=h.startsWith("//")?new URL(E.protocol+h):new URL(h),I=Tx(T.pathname,y);T.origin===E.origin&&I!=null?h=I+T.search+T.hash:N=!0}catch{}let b=J3(h,{relative:i}),k=CT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:i,viewTransition:m});function C(E){r&&r(E),E.defaultPrevented||k(E)}return v.createElement("a",yg({},g,{href:w||b,onClick:N||a?r:C,ref:n,target:u}))});var Mb;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Mb||(Mb={}));var Ab;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Ab||(Ab={}));function CT(t,e){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:c}=e===void 0?{}:e,u=ja(),h=Na(),f=DN(t,{relative:o});return v.useCallback(m=>{if(yT(m,n)){m.preventDefault();let g=r!==void 0?r:sh(h)===sh(f);u(t,{replace:g,state:i,preventScrollReset:a,relative:o,viewTransition:c})}},[h,u,f,r,i,n,t,a,o,c])}function $N(t){let e=v.useRef(vg(t)),n=v.useRef(!1),r=Na(),i=v.useMemo(()=>vT(r.search,n.current?null:e.current),[r.search]),a=ja(),o=v.useCallback((c,u)=>{const h=vg(typeof c=="function"?c(i):c);n.current=!0,a("?"+h,u)},[a,i]);return[i,o]}/**
+ */function vg(){return vg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function xT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yT(t,e){return t.button===0&&(!e||e==="_self")&&!xT(t)}function bg(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function vT(t,e){let n=bg(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(a=>{n.append(i,a)})}),n}const bT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],wT="6";try{window.__reactRouterVersion=wT}catch{}const NT="startTransition",Mb=lf[NT];function jT(t){let{basename:e,children:n,future:r,window:i}=t,a=v.useRef();a.current==null&&(a.current=w3({window:i,v5Compat:!0}));let o=a.current,[c,u]=v.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=v.useCallback(m=>{h&&Mb?Mb(()=>u(m)):u(m)},[u,h]);return v.useLayoutEffect(()=>o.listen(f),[o,f]),v.useEffect(()=>hT(r),[r]),v.createElement(pT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const kT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ST=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wg=v.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=gT(e,bT),{basename:y}=v.useContext(Na),w,N=!1;if(typeof h=="string"&&ST.test(h)&&(w=h,kT))try{let E=new URL(window.location.href),T=h.startsWith("//")?new URL(E.protocol+h):new URL(h),I=Mx(T.pathname,y);T.origin===E.origin&&I!=null?h=I+T.search+T.hash:N=!0}catch{}let b=J3(h,{relative:i}),k=CT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:i,viewTransition:m});function C(E){r&&r(E),E.defaultPrevented||k(E)}return v.createElement("a",vg({},g,{href:w||b,onClick:N||a?r:C,ref:n,target:u}))});var Ab;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Ab||(Ab={}));var Ib;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Ib||(Ib={}));function CT(t,e){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:c}=e===void 0?{}:e,u=ka(),h=ja(),f=LN(t,{relative:o});return v.useCallback(m=>{if(yT(m,n)){m.preventDefault();let g=r!==void 0?r:ih(h)===ih(f);u(t,{replace:g,state:i,preventScrollReset:a,relative:o,viewTransition:c})}},[h,u,f,r,i,n,t,a,o,c])}function FN(t){let e=v.useRef(bg(t)),n=v.useRef(!1),r=ja(),i=v.useMemo(()=>vT(r.search,n.current?null:e.current),[r.search]),a=ka(),o=v.useCallback((c,u)=>{const h=bg(typeof c=="function"?c(i):c);n.current=!0,a("?"+h,u)},[a,i]);return[i,o]}/**
* @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 ET=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),TT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Ib=t=>{const e=TT(t);return e.charAt(0).toUpperCase()+e.slice(1)},FN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),MT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
+ */const ET=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),TT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Rb=t=>{const e=TT(t);return e.charAt(0).toUpperCase()+e.slice(1)},BN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),MT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -79,22 +79,22 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const IT=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:o,...c},u)=>v.createElement("svg",{ref:u,...AT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:FN("lucide",i),...!a&&!MT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>v.createElement(h,f)),...Array.isArray(a)?a:[a]]));/**
+ */const IT=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:o,...c},u)=>v.createElement("svg",{ref:u,...AT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:BN("lucide",i),...!a&&!MT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>v.createElement(h,f)),...Array.isArray(a)?a:[a]]));/**
* @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 Ce=(t,e)=>{const n=v.forwardRef(({className:r,...i},a)=>v.createElement(IT,{ref:a,iconNode:e,className:FN(`lucide-${ET(Ib(t))}`,`lucide-${t}`,r),...i}));return n.displayName=Ib(t),n};/**
+ */const Ce=(t,e)=>{const n=v.forwardRef(({className:r,...i},a)=>v.createElement(IT,{ref:a,iconNode:e,className:BN(`lucide-${ET(Rb(t))}`,`lucide-${t}`,r),...i}));return n.displayName=Rb(t),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 RT=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],wm=Ce("arrow-up-down",RT);/**
+ */const RT=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Nm=Ce("arrow-up-down",RT);/**
* @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 PT=[["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"}]],Rb=Ce("bitcoin",PT);/**
+ */const PT=[["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"}]],Pb=Ce("bitcoin",PT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -104,12 +104,12 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const LT=[["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"}]],Yr=Ce("book-open",LT);/**
+ */const LT=[["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"}]],Xr=Ce("book-open",LT);/**
* @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 _T=[["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"}]],ih=Ce("calendar",_T);/**
+ */const _T=[["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"}]],ah=Ce("calendar",_T);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -119,12 +119,12 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const FT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cf=Ce("check",FT);/**
+ */const FT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],df=Ce("check",FT);/**
* @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 BT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Gc=Ce("chevron-down",BT);/**
+ */const BT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Jc=Ce("chevron-down",BT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -134,47 +134,47 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const WT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fl=Ce("chevron-right",WT);/**
+ */const WT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ul=Ce("chevron-right",WT);/**
* @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 UT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],BN=Ce("chevron-up",UT);/**
+ */const UT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],VN=Ce("chevron-up",UT);/**
* @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 KT=[["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"}]],VN=Ce("circle-alert",KT);/**
+ */const KT=[["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"}]],HN=Ce("circle-alert",KT);/**
* @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 qT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Pb=Ce("circle-check-big",qT);/**
+ */const qT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ob=Ce("circle-check-big",qT);/**
* @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 GT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],wg=Ce("circle-check",GT);/**
+ */const GT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ng=Ce("circle-check",GT);/**
* @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 JT=[["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"}]],HN=Ce("circle-question-mark",JT);/**
+ */const JT=[["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"}]],WN=Ce("circle-question-mark",JT);/**
* @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 YT=[["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"}]],Nm=Ce("circle-user",YT);/**
+ */const YT=[["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=Ce("circle-user",YT);/**
* @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 QT=[["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"}]],WN=Ce("circle-x",QT);/**
+ */const QT=[["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"}]],UN=Ce("circle-x",QT);/**
* @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 XT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ng=Ce("clock",XT);/**
+ */const XT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],jg=Ce("clock",XT);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -184,22 +184,22 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const tM=[["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"}]],UN=Ce("copy",tM);/**
+ */const tM=[["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"}]],KN=Ce("copy",tM);/**
* @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 nM=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Ob=Ce("credit-card",nM);/**
+ */const nM=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Db=Ce("credit-card",nM);/**
* @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 rM=[["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"}]],xl=Ce("crown",rM);/**
+ */const rM=[["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"}]],ml=Ce("crown",rM);/**
* @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 sM=[["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"}]],ah=Ce("dollar-sign",sM);/**
+ */const sM=[["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"}]],oh=Ce("dollar-sign",sM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -209,12 +209,12 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const oM=[["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"}]],_s=Ce("external-link",oM);/**
+ */const oM=[["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"}]],Ls=Ce("external-link",oM);/**
* @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 lM=[["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"}]],jg=Ce("eye",lM);/**
+ */const lM=[["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"}]],kg=Ce("eye",lM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -224,7 +224,7 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const uM=[["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"}]],KN=Ce("funnel",uM);/**
+ */const uM=[["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"}]],qN=Ce("funnel",uM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -239,7 +239,7 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const gM=[["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"}]],kg=Ce("globe",gM);/**
+ */const gM=[["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"}]],Sg=Ce("globe",gM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -249,7 +249,7 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const vM=[["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"}]],oi=Ce("grip-vertical",vM);/**
+ */const vM=[["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"}]],ii=Ce("grip-vertical",vM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -259,7 +259,7 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const NM=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Db=Ce("hash",NM);/**
+ */const NM=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Lb=Ce("hash",NM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -284,12 +284,12 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const IM=[["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"}]],qN=Ce("image",IM);/**
+ */const IM=[["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"}]],GN=Ce("image",IM);/**
* @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 RM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],bu=Ce("info",RM);/**
+ */const RM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],wu=Ce("info",RM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -309,12 +309,12 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const $M=[["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"}]],gs=Ce("link-2",$M);/**
+ */const $M=[["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"}]],ys=Ce("link-2",$M);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const FM=[["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"}]],Sg=Ce("link",FM);/**
+ */const FM=[["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"}]],Cg=Ce("link",FM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -339,7 +339,7 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const JM=[["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"}]],GN=Ce("map-pin",JM);/**
+ */const JM=[["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"}]],JN=Ce("map-pin",JM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -359,7 +359,7 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const nA=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],pl=Ce("navigation",nA);/**
+ */const nA=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],hl=Ce("navigation",nA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -369,12 +369,12 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const iA=[["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"}]],_t=Ce("pen-line",iA);/**
+ */const iA=[["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"}]],Ft=Ce("pen-line",iA);/**
* @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 aA=[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],JN=Ce("pencil",aA);/**
+ */const aA=[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],YN=Ce("pencil",aA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -394,12 +394,12 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const fA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],dn=Ce("plus",fA);/**
+ */const fA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],un=Ce("plus",fA);/**
* @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 pA=[["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"}]],Lb=Ce("qr-code",pA);/**
+ */const pA=[["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"}]],_b=Ce("qr-code",pA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -414,17 +414,17 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const vA=[["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"}]],Ge=Ce("refresh-cw",vA);/**
+ */const vA=[["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"}]],Je=Ce("refresh-cw",vA);/**
* @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 bA=[["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"}]],gn=Ce("save",bA);/**
+ */const bA=[["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"}]],xn=Ce("save",bA);/**
* @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 wA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],da=Ce("search",wA);/**
+ */const wA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ua=Ce("search",wA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -434,32 +434,32 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const kA=[["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"}]],so=Ce("settings",kA);/**
+ */const kA=[["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"}]],io=Ce("settings",kA);/**
* @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 SA=[["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"}]],wu=Ce("settings-2",SA);/**
+ */const SA=[["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"}]],Nu=Ce("settings-2",SA);/**
* @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 CA=[["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"}]],Rx=Ce("shield-check",CA);/**
+ */const CA=[["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"}]],Px=Ce("shield-check",CA);/**
* @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 EA=[["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"}]],Cg=Ce("shopping-bag",EA);/**
+ */const EA=[["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"}]],Eg=Ce("shopping-bag",EA);/**
* @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 TA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],uo=Ce("smartphone",TA);/**
+ */const TA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ho=Ce("smartphone",TA);/**
* @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 MA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ml=Ce("star",MA);/**
+ */const MA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],fl=Ce("star",MA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -474,27 +474,27 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const OA=[["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"}]],qu=Ce("tag",OA);/**
+ */const OA=[["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"}]],Gu=Ce("tag",OA);/**
* @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 DA=[["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"}]],Bn=Ce("trash-2",DA);/**
+ */const DA=[["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"}]],Hn=Ce("trash-2",DA);/**
* @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 LA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Oc=Ce("trending-up",LA);/**
+ */const LA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Dc=Ce("trending-up",LA);/**
* @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 _A=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],_b=Ce("trophy",_A);/**
+ */const _A=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],zb=Ce("trophy",_A);/**
* @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 zA=[["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"}]],YN=Ce("undo-2",zA);/**
+ */const zA=[["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"}]],QN=Ce("undo-2",zA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -504,42 +504,42 @@ Error generating stack: `+S.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const BA=[["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"}]],oh=Ce("upload",BA);/**
+ */const BA=[["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"}]],lh=Ce("upload",BA);/**
* @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 VA=[["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"}]],Eg=Ce("user-plus",VA);/**
+ */const VA=[["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"}]],Tg=Ce("user-plus",VA);/**
* @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 HA=[["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"}]],yl=Ce("user",HA);/**
+ */const HA=[["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"}]],gl=Ce("user",HA);/**
* @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 WA=[["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"}]],Un=Ce("users",WA);/**
+ */const WA=[["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"}]],qn=Ce("users",WA);/**
* @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 UA=[["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"}]],jl=Ce("wallet",UA);/**
+ */const UA=[["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"}]],wl=Ce("wallet",UA);/**
* @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 KA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xn=Ce("x",KA);/**
+ */const KA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],er=Ce("x",KA);/**
* @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 qA=[["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"}]],ia=Ce("zap",qA),Px="admin_token";function Ox(){try{return localStorage.getItem(Px)}catch{return null}}function GA(t){try{localStorage.setItem(Px,t)}catch{}}function JA(){try{localStorage.removeItem(Px)}catch{}}const YA="https://soulapi.quwanzhi.com",QA=15e3,zb=6e4,XA=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):YA};function ho(t){const e=XA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function df(t,e={}){const{data:n,...r}=e,i=ho(t),a=new Headers(r.headers),o=Ox();o&&a.set("Authorization",`Bearer ${o}`),n!=null&&!a.has("Content-Type")&&a.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=r.timeout??QA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(i,{...r,headers:a,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),y=(m.headers.get("Content-Type")||"").includes("application/json")?await m.json():m,w=N=>{const b=N,k=((b==null?void 0:b.message)||(b==null?void 0:b.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){w(y);const N=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw N.status=m.status,N.data=y,N}return w(y),y}function Le(t,e){return df(t,{...e,method:"GET"})}function wt(t,e,n){return df(t,{...n,method:"POST",data:e})}function Mt(t,e,n){return df(t,{...n,method:"PUT",data:e})}function Ps(t,e){return df(t,{...e,method:"DELETE"})}function ZA(){const[t,e]=v.useState(!1),[n,r]=v.useState("");return v.useEffect(()=>{const i=a=>{const o=a.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",i),()=>window.removeEventListener("recharge-alert",i)},[]),t?s.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 bg-red-900/80 border-b border-red-600/50 text-red-100",role:"alert",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(VN,{className:"w-5 h-5 shrink-0 text-red-400"}),s.jsxs("span",{className:"text-sm font-medium",children:[n,s.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),s.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:s.jsx(Xn,{className:"w-4 h-4"})})]}):null}const eI=[{icon:zM,label:"数据概览",href:"/dashboard"},{icon:Yr,label:"内容管理",href:"/content"},{icon:Un,label:"用户管理",href:"/users"},{icon:mM,label:"找伙伴",href:"/find-partner"},{icon:jl,label:"推广中心",href:"/distribution"}];function tI(){const t=Na(),e=ja(),[n,r]=v.useState(!1),[i,a]=v.useState(!1);v.useEffect(()=>{r(!0)},[]),v.useEffect(()=>{if(!n)return;a(!1);let c=!1;return Le("/api/admin").then(u=>{c||(u&&u.success!==!1?a(!0):e("/login",{replace:!0}))}).catch(()=>{c||e("/login",{replace:!0})}),()=>{c=!0}},[n,e]);const o=async()=>{JA();try{await wt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!i?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[eI.map(c=>{const u=t.pathname===c.href;return s.jsxs(bg,{to:c.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${u?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(bg,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(so,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.jsxs("button",{type:"button",onClick:o,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:[s.jsx(GM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(ZA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(fT,{})})]})]})}function $b(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Dx(...t){return e=>{let n=!1;const r=t.map(i=>{const a=$b(i,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i{let{children:a,...o}=r;QN(a)&&typeof lh=="function"&&(a=lh(a._payload));const c=v.Children.toArray(a),u=c.find(aI);if(u){const h=u.props.children,f=c.map(m=>m===u?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:i,children:v.isValidElement(h)?v.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}var ZN=XN("Slot");function sI(t){const e=v.forwardRef((n,r)=>{let{children:i,...a}=n;if(QN(i)&&typeof lh=="function"&&(i=lh(i._payload)),v.isValidElement(i)){const o=lI(i),c=oI(a,i.props);return i.type!==v.Fragment&&(c.ref=r?Dx(r,o):o),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iI=Symbol("radix.slottable");function aI(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iI}function oI(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...c)=>{const u=a(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function lI(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function ej(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Bb=tj,nj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Bb(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:a}=e,o=Object.keys(i).map(h=>{const f=n==null?void 0:n[h],m=a==null?void 0:a[h];if(f===null)return null;const g=Fb(f)||Fb(m);return i[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(w=>{let[N,b]=w;return Array.isArray(b)?b.includes({...a,...c}[N]):{...a,...c}[N]===b})?[...h,m,g]:h},[]);return Bb(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},cI=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),rj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),ch="-",Vb=[],uI="arbitrary..",hI=t=>{const e=pI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return fI(o);const c=o.split(ch),u=c[0]===""&&c.length>1?1:0;return sj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?cI(h,u):u:h||Vb}return n[o]||Vb}}},sj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],a=n.nextPart.get(i);if(a){const h=sj(t,e+1,a);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(ch):t.slice(e).join(ch),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?uI+r:void 0})(),pI=t=>{const{theme:e,classGroups:n}=t;return mI(n,e)},mI=(t,e)=>{const n=rj();for(const r in t){const i=t[r];Lx(i,n,r,e)}return n},Lx=(t,e,n,r)=>{const i=t.length;for(let a=0;a{if(typeof t=="string"){xI(t,e,n);return}if(typeof t=="function"){yI(t,e,n,r);return}vI(t,e,n,r)},xI=(t,e,n)=>{const r=t===""?e:ij(e,t);r.classGroupId=n},yI=(t,e,n,r)=>{if(bI(t)){Lx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(dI(n,t))},vI=(t,e,n,r)=>{const i=Object.entries(t),a=i.length;for(let o=0;o{let n=t;const r=e.split(ch),i=r.length;for(let a=0;a"isThemeGetter"in t&&t.isThemeGetter===!0,wI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(a,o)=>{n[a]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return i(a,o),o},set(a,o){a in n?n[a]=o:i(a,o)}}},Tg="!",Hb=":",NI=[],Wb=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),jI=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const a=[];let o=0,c=0,u=0,h;const f=i.length;for(let N=0;Nu?h-u:void 0;return Wb(a,y,g,w)};if(e){const i=e+Hb,a=r;r=o=>o.startsWith(i)?a(o.slice(i.length)):Wb(NI,!1,o,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},kI=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},SI=t=>({cache:wI(t.cacheSize),parseClassName:jI(t),sortModifiers:kI(t),...hI(t)}),CI=/\s+/,EI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=e,o=[],c=t.trim().split(CI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:N}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let b=!!N,k=r(b?w.substring(0,N):w);if(!k){if(!b){u=f+(u.length>0?" "+u:u);continue}if(k=r(w),!k){u=f+(u.length>0?" "+u:u);continue}b=!1}const C=g.length===0?"":g.length===1?g[0]:a(g).join(":"),E=y?C+Tg:C,T=E+k;if(o.indexOf(T)>-1)continue;o.push(T);const I=i(k,b);for(let O=0;O0?" "+u:u)}return u},TI=(...t)=>{let e=0,n,r,i="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,i,a;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=SI(h),r=n.cache.get,i=n.cache.set,a=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=EI(u,n);return i(u,f),f};return a=o,(...u)=>a(TI(...u))},AI=[],Cn=t=>{const e=n=>n[t]||AI;return e.isThemeGetter=!0,e},oj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,II=/^\d+\/\d+$/,RI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PI=/\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$/,OI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nl=t=>II.test(t),ct=t=>!!t&&!Number.isNaN(Number(t)),qi=t=>!!t&&Number.isInteger(Number(t)),jm=t=>t.endsWith("%")&&ct(t.slice(0,-1)),li=t=>RI.test(t),_I=()=>!0,zI=t=>PI.test(t)&&!OI.test(t),cj=()=>!1,$I=t=>DI.test(t),FI=t=>LI.test(t),BI=t=>!ze(t)&&!$e(t),VI=t=>Ol(t,hj,cj),ze=t=>oj.test(t),Ja=t=>Ol(t,fj,zI),km=t=>Ol(t,qI,ct),Ub=t=>Ol(t,dj,cj),HI=t=>Ol(t,uj,FI),Nu=t=>Ol(t,pj,$I),$e=t=>lj.test(t),Nc=t=>Dl(t,fj),WI=t=>Dl(t,GI),Kb=t=>Dl(t,dj),UI=t=>Dl(t,hj),KI=t=>Dl(t,uj),ju=t=>Dl(t,pj,!0),Ol=(t,e,n)=>{const r=oj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Dl=(t,e,n=!1)=>{const r=lj.exec(t);return r?r[1]?e(r[1]):n:!1},dj=t=>t==="position"||t==="percentage",uj=t=>t==="image"||t==="url",hj=t=>t==="length"||t==="size"||t==="bg-size",fj=t=>t==="length",qI=t=>t==="number",GI=t=>t==="family-name",pj=t=>t==="shadow",JI=()=>{const t=Cn("color"),e=Cn("font"),n=Cn("text"),r=Cn("font-weight"),i=Cn("tracking"),a=Cn("leading"),o=Cn("breakpoint"),c=Cn("container"),u=Cn("spacing"),h=Cn("radius"),f=Cn("shadow"),m=Cn("inset-shadow"),g=Cn("text-shadow"),y=Cn("drop-shadow"),w=Cn("blur"),N=Cn("perspective"),b=Cn("aspect"),k=Cn("ease"),C=Cn("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...T(),$e,ze],O=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],P=()=>[$e,ze,u],L=()=>[nl,"full","auto",...P()],_=()=>[qi,"none","subgrid",$e,ze],J=()=>["auto",{span:["full",qi,$e,ze]},qi,$e,ze],ee=()=>[qi,"auto",$e,ze],Y=()=>["auto","min","max","fr",$e,ze],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...P()],re=()=>[nl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],z=()=>[t,$e,ze],ie=()=>[...T(),Kb,Ub,{position:[$e,ze]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",UI,VI,{size:[$e,ze]}],H=()=>[jm,Nc,Ja],ce=()=>["","none","full",h,$e,ze],W=()=>["",ct,Nc,Ja],fe=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[ct,jm,Kb,Ub],he=()=>["","none",w,$e,ze],we=()=>["none",ct,$e,ze],Te=()=>["none",ct,$e,ze],Ve=()=>[ct,$e,ze],He=()=>[nl,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[li],breakpoint:[li],color:[_I],container:[li],"drop-shadow":[li],ease:["in","out","in-out"],font:[BI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[li],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[li],shadow:[li],spacing:["px",ct],text:[li],"text-shadow":[li],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nl,ze,$e,b]}],container:["container"],columns:[{columns:[ct,ze,$e,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:I()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[qi,"auto",$e,ze]}],basis:[{basis:[nl,"full","auto",c,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ct,nl,"auto","initial","none",ze]}],grow:[{grow:["",ct,$e,ze]}],shrink:[{shrink:["",ct,$e,ze]}],order:[{order:[qi,"first","last","none",$e,ze]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:J()}],"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":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:re()}],w:[{w:[c,"screen",...re()]}],"min-w":[{"min-w":[c,"screen","none",...re()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...re()]}],h:[{h:["screen","lh",...re()]}],"min-h":[{"min-h":["screen","lh","none",...re()]}],"max-h":[{"max-h":["screen","lh",...re()]}],"font-size":[{text:["base",n,Nc,Ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,$e,km]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jm,ze]}],"font-family":[{font:[WI,ze,e]}],"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:[i,$e,ze]}],"line-clamp":[{"line-clamp":[ct,"none",$e,km]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",$e,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[ct,"from-font","auto",$e,Ja]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[ct,"auto",$e,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e,ze]}],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",$e,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qi,$e,ze],radial:["",$e,ze],conic:[qi,$e,ze]},KI,HI]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ct,$e,ze]}],"outline-w":[{outline:["",ct,Nc,Ja]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,ju,Nu]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",m,ju,Nu]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[ct,Ja]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",g,ju,Nu]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[ct,$e,ze]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[$e,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,ze]}],filter:[{filter:["","none",$e,ze]}],blur:[{blur:he()}],brightness:[{brightness:[ct,$e,ze]}],contrast:[{contrast:[ct,$e,ze]}],"drop-shadow":[{"drop-shadow":["","none",y,ju,Nu]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",ct,$e,ze]}],"hue-rotate":[{"hue-rotate":[ct,$e,ze]}],invert:[{invert:["",ct,$e,ze]}],saturate:[{saturate:[ct,$e,ze]}],sepia:[{sepia:["",ct,$e,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,ze]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[ct,$e,ze]}],"backdrop-contrast":[{"backdrop-contrast":[ct,$e,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ct,$e,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ct,$e,ze]}],"backdrop-invert":[{"backdrop-invert":["",ct,$e,ze]}],"backdrop-opacity":[{"backdrop-opacity":[ct,$e,ze]}],"backdrop-saturate":[{"backdrop-saturate":[ct,$e,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",ct,$e,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",$e,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ct,"initial",$e,ze]}],ease:[{ease:["linear","initial",k,$e,ze]}],delay:[{delay:[ct,$e,ze]}],animate:[{animate:["none",C,$e,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,$e,ze]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Ve()}],"skew-x":[{"skew-x":Ve()}],"skew-y":[{"skew-y":Ve()}],transform:[{transform:[$e,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:He()}],"translate-x":[{"translate-x":He()}],"translate-y":[{"translate-y":He()}],"translate-z":[{"translate-z":He()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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",$e,ze]}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",$e,ze]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[ct,Nc,Ja,km]}],stroke:[{stroke:["none",...z()]}],"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"]}},YI=MI(JI);function Ct(...t){return YI(tj(t))}const QI=nj("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 te({className:t,variant:e,size:n,asChild:r=!1,...i}){const a=r?ZN:"button";return s.jsx(a,{"data-slot":"button",className:Ct(QI({variant:e,size:n,className:t})),...i})}function oe({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Ct("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",t),...n})}function XI(){const t=ja(),[e,n]=v.useState(""),[r,i]=v.useState(""),[a,o]=v.useState(""),[c,u]=v.useState(!1),h=async()=>{o(""),u(!0);try{const f=await wt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){GA(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return s.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),s.jsxs("div",{className:"w-full max-w-md relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.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:s.jsx(Rx,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(yl,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(oe,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(KM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(oe,{type:"password",value:r,onChange:f=>i(f.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),a&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:a}),s.jsx(te,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Me=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Me.displayName="Card";const rt=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex flex-col space-y-1.5 p-6",t),...e}));rt.displayName="CardHeader";const st=v.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Ct("font-semibold leading-none tracking-tight",t),...e}));st.displayName="CardTitle";const $t=v.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Ct("text-sm text-muted-foreground",t),...e}));$t.displayName="CardDescription";const Ae=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("p-6 pt-0",t),...e}));Ae.displayName="CardContent";const ZI=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex items-center p-6 pt-0",t),...e}));ZI.displayName="CardFooter";const e5={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Sm(t,e="info",n=3e3){const r=`toast-${Date.now()}`,i=e5[e],a=document.createElement("div");a.id=r,a.setAttribute("role","alert"),Object.assign(a.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:i.bg,border:`1.5px solid ${i.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:i.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=i.icon;const c=document.createElement("span");c.textContent=t,a.appendChild(o),a.appendChild(c),document.body.appendChild(a),requestAnimationFrame(()=>{a.style.opacity="1",a.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const ae={success:(t,e)=>Sm(t,"success",e),error:(t,e)=>Sm(t,"error",e),info:(t,e)=>Sm(t,"info",e)};function at(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function t5(t,e){const n=v.createContext(e),r=a=>{const{children:o,...c}=a,u=v.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function i(a){const o=v.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,i]}function ka(t,e=[]){let n=[];function r(a,o){const c=v.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...w}=m,N=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,b=v.useMemo(()=>w,Object.values(w));return s.jsx(N.Provider,{value:b,children:y})};h.displayName=a+"Provider";function f(m,g){var N;const y=((N=g==null?void 0:g[t])==null?void 0:N[u])||c,w=v.useContext(y);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,f]}const i=()=>{const a=n.map(o=>v.createContext(o));return function(c){const u=(c==null?void 0:c[t])||a;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return i.scopeName=t,[r,n5(i,...e)]}function n5(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(a)[`__scope${h}`];return{...c,...m}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Zn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},r5=of[" useId ".trim().toString()]||(()=>{}),s5=0;function ua(t){const[e,n]=v.useState(r5());return Zn(()=>{n(r=>r??String(s5++))},[t]),e?`radix-${e}`:""}var i5=of[" useInsertionEffect ".trim().toString()]||Zn;function fo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,a,o]=a5({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:i;{const f=v.useRef(t!==void 0);v.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"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.`),f.current=c},[c,r])}const h=v.useCallback(f=>{var m;if(c){const g=o5(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else a(f)},[c,t,a,o]);return[u,h]}function a5({defaultProp:t,onChange:e}){const[n,r]=v.useState(t),i=v.useRef(n),a=v.useRef(e);return i5(()=>{a.current=e},[e]),v.useEffect(()=>{var o;i.current!==n&&((o=a.current)==null||o.call(a,n),i.current=n)},[n,i]),[n,r,a]}function o5(t){return typeof t=="function"}function Jc(t){const e=l5(t),n=v.forwardRef((r,i)=>{const{children:a,...o}=r,c=v.Children.toArray(a),u=c.find(d5);if(u){const h=u.props.children,f=c.map(m=>m===u?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:i,children:v.isValidElement(h)?v.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}function l5(t){const e=v.forwardRef((n,r)=>{const{children:i,...a}=n;if(v.isValidElement(i)){const o=h5(i),c=u5(a,i.props);return i.type!==v.Fragment&&(c.ref=r?Dx(r,o):o),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var c5=Symbol("radix.slottable");function d5(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===c5}function u5(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...c)=>{const u=a(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function h5(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var f5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dt=f5.reduce((t,e)=>{const n=Jc(`Primitive.${e}`),r=v.forwardRef((i,a)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function p5(t,e){t&&dd.flushSync(()=>t.dispatchEvent(e))}function ga(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function m5(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var g5="DismissableLayer",Mg="dismissableLayer.update",x5="dismissableLayer.pointerDownOutside",y5="dismissableLayer.focusOutside",qb,mj=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_x=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,h=v.useContext(mj),[f,m]=v.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),w=St(e,D=>m(D)),N=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=N.indexOf(b),C=f?N.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,T=C>=k,I=w5(D=>{const P=D.target,L=[...h.branches].some(_=>_.contains(P));!T||L||(i==null||i(D),o==null||o(D),D.defaultPrevented||c==null||c())},g),O=N5(D=>{const P=D.target;[...h.branches].some(_=>_.contains(P))||(a==null||a(D),o==null||o(D),D.defaultPrevented||c==null||c())},g);return m5(D=>{C===h.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},g),v.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(qb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Gb(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=qb)}},[f,g,n,h]),v.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Gb())},[f,h]),v.useEffect(()=>{const D=()=>y({});return document.addEventListener(Mg,D),()=>document.removeEventListener(Mg,D)},[]),s.jsx(dt.div,{...u,ref:w,style:{pointerEvents:E?T?"auto":"none":void 0,...t.style},onFocusCapture:at(t.onFocusCapture,O.onFocusCapture),onBlurCapture:at(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:at(t.onPointerDownCapture,I.onPointerDownCapture)})});_x.displayName=g5;var v5="DismissableLayerBranch",b5=v.forwardRef((t,e)=>{const n=v.useContext(mj),r=v.useRef(null),i=St(e,r);return v.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(dt.div,{...t,ref:i})});b5.displayName=v5;function w5(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const a=c=>{if(c.target&&!r.current){let u=function(){gj(x5,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function N5(t,e=globalThis==null?void 0:globalThis.document){const n=ga(t),r=v.useRef(!1);return v.useEffect(()=>{const i=a=>{a.target&&!r.current&&gj(y5,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Gb(){const t=new CustomEvent(Mg);document.dispatchEvent(t)}function gj(t,e,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?p5(i,a):i.dispatchEvent(a)}var Cm="focusScope.autoFocusOnMount",Em="focusScope.autoFocusOnUnmount",Jb={bubbles:!1,cancelable:!0},j5="FocusScope",zx=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=t,[c,u]=v.useState(null),h=ga(i),f=ga(a),m=v.useRef(null),g=St(e,N=>u(N)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let N=function(E){if(y.paused||!c)return;const T=E.target;c.contains(T)?m.current=T:Yi(m.current,{select:!0})},b=function(E){if(y.paused||!c)return;const T=E.relatedTarget;T!==null&&(c.contains(T)||Yi(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const I of E)I.removedNodes.length>0&&Yi(c)};document.addEventListener("focusin",N),document.addEventListener("focusout",b);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",b),C.disconnect()}}},[r,c,y.paused]),v.useEffect(()=>{if(c){Qb.add(y);const N=document.activeElement;if(!c.contains(N)){const k=new CustomEvent(Cm,Jb);c.addEventListener(Cm,h),c.dispatchEvent(k),k.defaultPrevented||(k5(M5(xj(c)),{select:!0}),document.activeElement===N&&Yi(c))}return()=>{c.removeEventListener(Cm,h),setTimeout(()=>{const k=new CustomEvent(Em,Jb);c.addEventListener(Em,f),c.dispatchEvent(k),k.defaultPrevented||Yi(N??document.body,{select:!0}),c.removeEventListener(Em,f),Qb.remove(y)},0)}}},[c,h,f,y]);const w=v.useCallback(N=>{if(!n&&!r||y.paused)return;const b=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,k=document.activeElement;if(b&&k){const C=N.currentTarget,[E,T]=S5(C);E&&T?!N.shiftKey&&k===T?(N.preventDefault(),n&&Yi(E,{select:!0})):N.shiftKey&&k===E&&(N.preventDefault(),n&&Yi(T,{select:!0})):k===C&&N.preventDefault()}},[n,r,y.paused]);return s.jsx(dt.div,{tabIndex:-1,...o,ref:g,onKeyDown:w})});zx.displayName=j5;function k5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Yi(r,{select:e}),document.activeElement!==n)return}function S5(t){const e=xj(t),n=Yb(e,t),r=Yb(e.reverse(),t);return[n,r]}function xj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Yb(t,e){for(const n of t)if(!C5(n,{upTo:e}))return n}function C5(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function E5(t){return t instanceof HTMLInputElement&&"select"in t}function Yi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&E5(t)&&e&&t.select()}}var Qb=T5();function T5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Xb(t,e),t.unshift(e)},remove(e){var n;t=Xb(t,e),(n=t[0])==null||n.resume()}}}function Xb(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function M5(t){return t.filter(e=>e.tagName!=="A")}var A5="Portal",$x=v.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,a]=v.useState(!1);Zn(()=>a(!0),[]);const o=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?MN.createPortal(s.jsx(dt.div,{...r,ref:e}),o):null});$x.displayName=A5;function I5(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var ud=t=>{const{present:e,children:n}=t,r=R5(e),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),a=St(r.ref,P5(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:a}):null};ud.displayName="Presence";function R5(t){const[e,n]=v.useState(),r=v.useRef(null),i=v.useRef(t),a=v.useRef("none"),o=t?"mounted":"unmounted",[c,u]=I5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const h=ku(r.current);a.current=c==="mounted"?h:"none"},[c]),Zn(()=>{const h=r.current,f=i.current;if(f!==t){const g=a.current,y=ku(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,u]),Zn(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const N=ku(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&N&&(u("ANIMATION_END"),!i.current)){const b=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},g=y=>{y.target===e&&(a.current=ku(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:v.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function ku(t){return(t==null?void 0:t.animationName)||"none"}function P5(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Tm=0;function yj(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Zb()),document.body.insertAdjacentElement("beforeend",t[1]??Zb()),Tm++,()=>{Tm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Tm--}},[])}function Zb(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Os=function(){return Os=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return Y5;var e=Q5(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},Z5=Nj(),vl="data-scroll-locked",eR=function(t,e,n,r){var i=t.left,a=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),`
+ */const qA=[["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"}]],aa=Ce("zap",qA),Ox="admin_token";function Dx(){try{return localStorage.getItem(Ox)}catch{return null}}function GA(t){try{localStorage.setItem(Ox,t)}catch{}}function JA(){try{localStorage.removeItem(Ox)}catch{}}const YA="https://soulapi.quwanzhi.com",QA=15e3,$b=6e4,XA=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):YA};function fo(t){const e=XA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function uf(t,e={}){const{data:n,...r}=e,i=fo(t),a=new Headers(r.headers),o=Dx();o&&a.set("Authorization",`Bearer ${o}`),n!=null&&!a.has("Content-Type")&&a.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=r.timeout??QA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(i,{...r,headers:a,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),y=(m.headers.get("Content-Type")||"").includes("application/json")?await m.json():m,w=N=>{const b=N,k=((b==null?void 0:b.message)||(b==null?void 0:b.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){w(y);const N=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw N.status=m.status,N.data=y,N}return w(y),y}function Le(t,e){return uf(t,{...e,method:"GET"})}function yt(t,e,n){return uf(t,{...n,method:"POST",data:e})}function It(t,e,n){return uf(t,{...n,method:"PUT",data:e})}function Rs(t,e){return uf(t,{...e,method:"DELETE"})}function ZA(){const[t,e]=v.useState(!1),[n,r]=v.useState("");return v.useEffect(()=>{const i=a=>{const o=a.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",i),()=>window.removeEventListener("recharge-alert",i)},[]),t?s.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 bg-red-900/80 border-b border-red-600/50 text-red-100",role:"alert",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(HN,{className:"w-5 h-5 shrink-0 text-red-400"}),s.jsxs("span",{className:"text-sm font-medium",children:[n,s.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),s.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:s.jsx(er,{className:"w-4 h-4"})})]}):null}const eI=[{icon:zM,label:"数据概览",href:"/dashboard"},{icon:Xr,label:"内容管理",href:"/content"},{icon:qn,label:"用户管理",href:"/users"},{icon:mM,label:"找伙伴",href:"/find-partner"},{icon:wl,label:"推广中心",href:"/distribution"}];function tI(){const t=ja(),e=ka(),[n,r]=v.useState(!1),[i,a]=v.useState(!1);v.useEffect(()=>{r(!0)},[]),v.useEffect(()=>{if(!n)return;a(!1);let c=!1;return Le("/api/admin").then(u=>{c||(u&&u.success!==!1?a(!0):e("/login",{replace:!0}))}).catch(()=>{c||e("/login",{replace:!0})}),()=>{c=!0}},[n,e]);const o=async()=>{JA();try{await yt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!i?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[eI.map(c=>{const u=t.pathname===c.href;return s.jsxs(wg,{to:c.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${u?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(wg,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(io,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.jsxs("button",{type:"button",onClick:o,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:[s.jsx(GM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(ZA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(fT,{})})]})]})}function Fb(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Lx(...t){return e=>{let n=!1;const r=t.map(i=>{const a=Fb(i,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i{let{children:a,...o}=r;XN(a)&&typeof ch=="function"&&(a=ch(a._payload));const c=v.Children.toArray(a),u=c.find(aI);if(u){const h=u.props.children,f=c.map(m=>m===u?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:i,children:v.isValidElement(h)?v.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}var ej=ZN("Slot");function sI(t){const e=v.forwardRef((n,r)=>{let{children:i,...a}=n;if(XN(i)&&typeof ch=="function"&&(i=ch(i._payload)),v.isValidElement(i)){const o=lI(i),c=oI(a,i.props);return i.type!==v.Fragment&&(c.ref=r?Lx(r,o):o),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iI=Symbol("radix.slottable");function aI(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iI}function oI(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...c)=>{const u=a(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function lI(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function tj(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Vb=nj,rj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Vb(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:a}=e,o=Object.keys(i).map(h=>{const f=n==null?void 0:n[h],m=a==null?void 0:a[h];if(f===null)return null;const g=Bb(f)||Bb(m);return i[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(w=>{let[N,b]=w;return Array.isArray(b)?b.includes({...a,...c}[N]):{...a,...c}[N]===b})?[...h,m,g]:h},[]);return Vb(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},cI=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),sj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),dh="-",Hb=[],uI="arbitrary..",hI=t=>{const e=pI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return fI(o);const c=o.split(dh),u=c[0]===""&&c.length>1?1:0;return ij(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?cI(h,u):u:h||Hb}return n[o]||Hb}}},ij=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],a=n.nextPart.get(i);if(a){const h=ij(t,e+1,a);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(dh):t.slice(e).join(dh),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?uI+r:void 0})(),pI=t=>{const{theme:e,classGroups:n}=t;return mI(n,e)},mI=(t,e)=>{const n=sj();for(const r in t){const i=t[r];_x(i,n,r,e)}return n},_x=(t,e,n,r)=>{const i=t.length;for(let a=0;a{if(typeof t=="string"){xI(t,e,n);return}if(typeof t=="function"){yI(t,e,n,r);return}vI(t,e,n,r)},xI=(t,e,n)=>{const r=t===""?e:aj(e,t);r.classGroupId=n},yI=(t,e,n,r)=>{if(bI(t)){_x(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(dI(n,t))},vI=(t,e,n,r)=>{const i=Object.entries(t),a=i.length;for(let o=0;o{let n=t;const r=e.split(dh),i=r.length;for(let a=0;a"isThemeGetter"in t&&t.isThemeGetter===!0,wI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(a,o)=>{n[a]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return i(a,o),o},set(a,o){a in n?n[a]=o:i(a,o)}}},Mg="!",Wb=":",NI=[],Ub=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),jI=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const a=[];let o=0,c=0,u=0,h;const f=i.length;for(let N=0;Nu?h-u:void 0;return Ub(a,y,g,w)};if(e){const i=e+Wb,a=r;r=o=>o.startsWith(i)?a(o.slice(i.length)):Ub(NI,!1,o,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},kI=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},SI=t=>({cache:wI(t.cacheSize),parseClassName:jI(t),sortModifiers:kI(t),...hI(t)}),CI=/\s+/,EI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=e,o=[],c=t.trim().split(CI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:w,maybePostfixModifierPosition:N}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let b=!!N,k=r(b?w.substring(0,N):w);if(!k){if(!b){u=f+(u.length>0?" "+u:u);continue}if(k=r(w),!k){u=f+(u.length>0?" "+u:u);continue}b=!1}const C=g.length===0?"":g.length===1?g[0]:a(g).join(":"),E=y?C+Mg:C,T=E+k;if(o.indexOf(T)>-1)continue;o.push(T);const I=i(k,b);for(let O=0;O0?" "+u:u)}return u},TI=(...t)=>{let e=0,n,r,i="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,i,a;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=SI(h),r=n.cache.get,i=n.cache.set,a=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=EI(u,n);return i(u,f),f};return a=o,(...u)=>a(TI(...u))},AI=[],Tn=t=>{const e=n=>n[t]||AI;return e.isThemeGetter=!0,e},lj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,II=/^\d+\/\d+$/,RI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PI=/\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$/,OI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,el=t=>II.test(t),ut=t=>!!t&&!Number.isNaN(Number(t)),Gi=t=>!!t&&Number.isInteger(Number(t)),km=t=>t.endsWith("%")&&ut(t.slice(0,-1)),ai=t=>RI.test(t),_I=()=>!0,zI=t=>PI.test(t)&&!OI.test(t),dj=()=>!1,$I=t=>DI.test(t),FI=t=>LI.test(t),BI=t=>!ze(t)&&!$e(t),VI=t=>Rl(t,fj,dj),ze=t=>lj.test(t),Ya=t=>Rl(t,pj,zI),Sm=t=>Rl(t,qI,ut),Kb=t=>Rl(t,uj,dj),HI=t=>Rl(t,hj,FI),ju=t=>Rl(t,mj,$I),$e=t=>cj.test(t),jc=t=>Pl(t,pj),WI=t=>Pl(t,GI),qb=t=>Pl(t,uj),UI=t=>Pl(t,fj),KI=t=>Pl(t,hj),ku=t=>Pl(t,mj,!0),Rl=(t,e,n)=>{const r=lj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Pl=(t,e,n=!1)=>{const r=cj.exec(t);return r?r[1]?e(r[1]):n:!1},uj=t=>t==="position"||t==="percentage",hj=t=>t==="image"||t==="url",fj=t=>t==="length"||t==="size"||t==="bg-size",pj=t=>t==="length",qI=t=>t==="number",GI=t=>t==="family-name",mj=t=>t==="shadow",JI=()=>{const t=Tn("color"),e=Tn("font"),n=Tn("text"),r=Tn("font-weight"),i=Tn("tracking"),a=Tn("leading"),o=Tn("breakpoint"),c=Tn("container"),u=Tn("spacing"),h=Tn("radius"),f=Tn("shadow"),m=Tn("inset-shadow"),g=Tn("text-shadow"),y=Tn("drop-shadow"),w=Tn("blur"),N=Tn("perspective"),b=Tn("aspect"),k=Tn("ease"),C=Tn("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...T(),$e,ze],O=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],P=()=>[$e,ze,u],L=()=>[el,"full","auto",...P()],_=()=>[Gi,"none","subgrid",$e,ze],J=()=>["auto",{span:["full",Gi,$e,ze]},Gi,$e,ze],ee=()=>[Gi,"auto",$e,ze],Y=()=>["auto","min","max","fr",$e,ze],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...P()],re=()=>[el,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],z=()=>[t,$e,ze],ie=()=>[...T(),qb,Kb,{position:[$e,ze]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",UI,VI,{size:[$e,ze]}],V=()=>[km,jc,Ya],ce=()=>["","none","full",h,$e,ze],W=()=>["",ut,jc,Ya],fe=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[ut,km,qb,Kb],he=()=>["","none",w,$e,ze],be=()=>["none",ut,$e,ze],Te=()=>["none",ut,$e,ze],Ve=()=>[ut,$e,ze],He=()=>[el,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ai],breakpoint:[ai],color:[_I],container:[ai],"drop-shadow":[ai],ease:["in","out","in-out"],font:[BI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ai],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ai],shadow:[ai],spacing:["px",ut],text:[ai],"text-shadow":[ai],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",el,ze,$e,b]}],container:["container"],columns:[{columns:[ut,ze,$e,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:I()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Gi,"auto",$e,ze]}],basis:[{basis:[el,"full","auto",c,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,el,"auto","initial","none",ze]}],grow:[{grow:["",ut,$e,ze]}],shrink:[{shrink:["",ut,$e,ze]}],order:[{order:[Gi,"first","last","none",$e,ze]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:J()}],"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":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:re()}],w:[{w:[c,"screen",...re()]}],"min-w":[{"min-w":[c,"screen","none",...re()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...re()]}],h:[{h:["screen","lh",...re()]}],"min-h":[{"min-h":["screen","lh","none",...re()]}],"max-h":[{"max-h":["screen","lh",...re()]}],"font-size":[{text:["base",n,jc,Ya]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,$e,Sm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",km,ze]}],"font-family":[{font:[WI,ze,e]}],"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:[i,$e,ze]}],"line-clamp":[{"line-clamp":[ut,"none",$e,Sm]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",$e,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",$e,Ya]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[ut,"auto",$e,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e,ze]}],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",$e,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gi,$e,ze],radial:["",$e,ze],conic:[Gi,$e,ze]},KI,HI]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,$e,ze]}],"outline-w":[{outline:["",ut,jc,Ya]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,ku,ju]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",m,ku,ju]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[ut,Ya]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",g,ku,ju]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[ut,$e,ze]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[$e,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,ze]}],filter:[{filter:["","none",$e,ze]}],blur:[{blur:he()}],brightness:[{brightness:[ut,$e,ze]}],contrast:[{contrast:[ut,$e,ze]}],"drop-shadow":[{"drop-shadow":["","none",y,ku,ju]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",ut,$e,ze]}],"hue-rotate":[{"hue-rotate":[ut,$e,ze]}],invert:[{invert:["",ut,$e,ze]}],saturate:[{saturate:[ut,$e,ze]}],sepia:[{sepia:["",ut,$e,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,ze]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[ut,$e,ze]}],"backdrop-contrast":[{"backdrop-contrast":[ut,$e,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,$e,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,$e,ze]}],"backdrop-invert":[{"backdrop-invert":["",ut,$e,ze]}],"backdrop-opacity":[{"backdrop-opacity":[ut,$e,ze]}],"backdrop-saturate":[{"backdrop-saturate":[ut,$e,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,$e,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",$e,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",$e,ze]}],ease:[{ease:["linear","initial",k,$e,ze]}],delay:[{delay:[ut,$e,ze]}],animate:[{animate:["none",C,$e,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,$e,ze]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Ve()}],"skew-x":[{"skew-x":Ve()}],"skew-y":[{"skew-y":Ve()}],transform:[{transform:[$e,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:He()}],"translate-x":[{"translate-x":He()}],"translate-y":[{"translate-y":He()}],"translate-z":[{"translate-z":He()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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",$e,ze]}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",$e,ze]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[ut,jc,Ya,Sm]}],stroke:[{stroke:["none",...z()]}],"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"]}},YI=MI(JI);function Mt(...t){return YI(nj(t))}const QI=rj("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 te({className:t,variant:e,size:n,asChild:r=!1,...i}){const a=r?ej:"button";return s.jsx(a,{"data-slot":"button",className:Mt(QI({variant:e,size:n,className:t})),...i})}function oe({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Mt("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",t),...n})}function XI(){const t=ka(),[e,n]=v.useState(""),[r,i]=v.useState(""),[a,o]=v.useState(""),[c,u]=v.useState(!1),h=async()=>{o(""),u(!0);try{const f=await yt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){GA(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return s.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),s.jsxs("div",{className:"w-full max-w-md relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.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:s.jsx(Px,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(gl,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(oe,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(KM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(oe,{type:"password",value:r,onChange:f=>i(f.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),a&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:a}),s.jsx(te,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Me=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Mt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Me.displayName="Card";const rt=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Mt("flex flex-col space-y-1.5 p-6",t),...e}));rt.displayName="CardHeader";const st=v.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Mt("font-semibold leading-none tracking-tight",t),...e}));st.displayName="CardTitle";const Vt=v.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Mt("text-sm text-muted-foreground",t),...e}));Vt.displayName="CardDescription";const Ae=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Mt("p-6 pt-0",t),...e}));Ae.displayName="CardContent";const ZI=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Mt("flex items-center p-6 pt-0",t),...e}));ZI.displayName="CardFooter";const e5={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Cm(t,e="info",n=3e3){const r=`toast-${Date.now()}`,i=e5[e],a=document.createElement("div");a.id=r,a.setAttribute("role","alert"),Object.assign(a.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:i.bg,border:`1.5px solid ${i.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:i.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=i.icon;const c=document.createElement("span");c.textContent=t,a.appendChild(o),a.appendChild(c),document.body.appendChild(a),requestAnimationFrame(()=>{a.style.opacity="1",a.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const ae={success:(t,e)=>Cm(t,"success",e),error:(t,e)=>Cm(t,"error",e),info:(t,e)=>Cm(t,"info",e)};function ot(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function t5(t,e){const n=v.createContext(e),r=a=>{const{children:o,...c}=a,u=v.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function i(a){const o=v.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,i]}function Sa(t,e=[]){let n=[];function r(a,o){const c=v.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...w}=m,N=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,b=v.useMemo(()=>w,Object.values(w));return s.jsx(N.Provider,{value:b,children:y})};h.displayName=a+"Provider";function f(m,g){var N;const y=((N=g==null?void 0:g[t])==null?void 0:N[u])||c,w=v.useContext(y);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,f]}const i=()=>{const a=n.map(o=>v.createContext(o));return function(c){const u=(c==null?void 0:c[t])||a;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return i.scopeName=t,[r,n5(i,...e)]}function n5(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(a)[`__scope${h}`];return{...c,...m}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var tr=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},r5=lf[" useId ".trim().toString()]||(()=>{}),s5=0;function ha(t){const[e,n]=v.useState(r5());return tr(()=>{n(r=>r??String(s5++))},[t]),e?`radix-${e}`:""}var i5=lf[" useInsertionEffect ".trim().toString()]||tr;function po({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,a,o]=a5({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:i;{const f=v.useRef(t!==void 0);v.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"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.`),f.current=c},[c,r])}const h=v.useCallback(f=>{var m;if(c){const g=o5(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else a(f)},[c,t,a,o]);return[u,h]}function a5({defaultProp:t,onChange:e}){const[n,r]=v.useState(t),i=v.useRef(n),a=v.useRef(e);return i5(()=>{a.current=e},[e]),v.useEffect(()=>{var o;i.current!==n&&((o=a.current)==null||o.call(a,n),i.current=n)},[n,i]),[n,r,a]}function o5(t){return typeof t=="function"}function Yc(t){const e=l5(t),n=v.forwardRef((r,i)=>{const{children:a,...o}=r,c=v.Children.toArray(a),u=c.find(d5);if(u){const h=u.props.children,f=c.map(m=>m===u?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:i,children:v.isValidElement(h)?v.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:i,children:a})});return n.displayName=`${t}.Slot`,n}function l5(t){const e=v.forwardRef((n,r)=>{const{children:i,...a}=n;if(v.isValidElement(i)){const o=h5(i),c=u5(a,i.props);return i.type!==v.Fragment&&(c.ref=r?Lx(r,o):o),v.cloneElement(i,c)}return v.Children.count(i)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var c5=Symbol("radix.slottable");function d5(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===c5}function u5(t,e){const n={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...c)=>{const u=a(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...t,...n}}function h5(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var f5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=f5.reduce((t,e)=>{const n=Yc(`Primitive.${e}`),r=v.forwardRef((i,a)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function p5(t,e){t&&ud.flushSync(()=>t.dispatchEvent(e))}function xa(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function m5(t,e=globalThis==null?void 0:globalThis.document){const n=xa(t);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var g5="DismissableLayer",Ag="dismissableLayer.update",x5="dismissableLayer.pointerDownOutside",y5="dismissableLayer.focusOutside",Gb,gj=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zx=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,h=v.useContext(gj),[f,m]=v.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),w=Tt(e,D=>m(D)),N=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=N.indexOf(b),C=f?N.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,T=C>=k,I=w5(D=>{const P=D.target,L=[...h.branches].some(_=>_.contains(P));!T||L||(i==null||i(D),o==null||o(D),D.defaultPrevented||c==null||c())},g),O=N5(D=>{const P=D.target;[...h.branches].some(_=>_.contains(P))||(a==null||a(D),o==null||o(D),D.defaultPrevented||c==null||c())},g);return m5(D=>{C===h.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},g),v.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Gb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Jb(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Gb)}},[f,g,n,h]),v.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Jb())},[f,h]),v.useEffect(()=>{const D=()=>y({});return document.addEventListener(Ag,D),()=>document.removeEventListener(Ag,D)},[]),s.jsx(ht.div,{...u,ref:w,style:{pointerEvents:E?T?"auto":"none":void 0,...t.style},onFocusCapture:ot(t.onFocusCapture,O.onFocusCapture),onBlurCapture:ot(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ot(t.onPointerDownCapture,I.onPointerDownCapture)})});zx.displayName=g5;var v5="DismissableLayerBranch",b5=v.forwardRef((t,e)=>{const n=v.useContext(gj),r=v.useRef(null),i=Tt(e,r);return v.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),s.jsx(ht.div,{...t,ref:i})});b5.displayName=v5;function w5(t,e=globalThis==null?void 0:globalThis.document){const n=xa(t),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const a=c=>{if(c.target&&!r.current){let u=function(){xj(x5,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function N5(t,e=globalThis==null?void 0:globalThis.document){const n=xa(t),r=v.useRef(!1);return v.useEffect(()=>{const i=a=>{a.target&&!r.current&&xj(y5,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Jb(){const t=new CustomEvent(Ag);document.dispatchEvent(t)}function xj(t,e,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?p5(i,a):i.dispatchEvent(a)}var Em="focusScope.autoFocusOnMount",Tm="focusScope.autoFocusOnUnmount",Yb={bubbles:!1,cancelable:!0},j5="FocusScope",$x=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=t,[c,u]=v.useState(null),h=xa(i),f=xa(a),m=v.useRef(null),g=Tt(e,N=>u(N)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let N=function(E){if(y.paused||!c)return;const T=E.target;c.contains(T)?m.current=T:Qi(m.current,{select:!0})},b=function(E){if(y.paused||!c)return;const T=E.relatedTarget;T!==null&&(c.contains(T)||Qi(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const I of E)I.removedNodes.length>0&&Qi(c)};document.addEventListener("focusin",N),document.addEventListener("focusout",b);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",b),C.disconnect()}}},[r,c,y.paused]),v.useEffect(()=>{if(c){Xb.add(y);const N=document.activeElement;if(!c.contains(N)){const k=new CustomEvent(Em,Yb);c.addEventListener(Em,h),c.dispatchEvent(k),k.defaultPrevented||(k5(M5(yj(c)),{select:!0}),document.activeElement===N&&Qi(c))}return()=>{c.removeEventListener(Em,h),setTimeout(()=>{const k=new CustomEvent(Tm,Yb);c.addEventListener(Tm,f),c.dispatchEvent(k),k.defaultPrevented||Qi(N??document.body,{select:!0}),c.removeEventListener(Tm,f),Xb.remove(y)},0)}}},[c,h,f,y]);const w=v.useCallback(N=>{if(!n&&!r||y.paused)return;const b=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,k=document.activeElement;if(b&&k){const C=N.currentTarget,[E,T]=S5(C);E&&T?!N.shiftKey&&k===T?(N.preventDefault(),n&&Qi(E,{select:!0})):N.shiftKey&&k===E&&(N.preventDefault(),n&&Qi(T,{select:!0})):k===C&&N.preventDefault()}},[n,r,y.paused]);return s.jsx(ht.div,{tabIndex:-1,...o,ref:g,onKeyDown:w})});$x.displayName=j5;function k5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Qi(r,{select:e}),document.activeElement!==n)return}function S5(t){const e=yj(t),n=Qb(e,t),r=Qb(e.reverse(),t);return[n,r]}function yj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Qb(t,e){for(const n of t)if(!C5(n,{upTo:e}))return n}function C5(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function E5(t){return t instanceof HTMLInputElement&&"select"in t}function Qi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&E5(t)&&e&&t.select()}}var Xb=T5();function T5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Zb(t,e),t.unshift(e)},remove(e){var n;t=Zb(t,e),(n=t[0])==null||n.resume()}}}function Zb(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function M5(t){return t.filter(e=>e.tagName!=="A")}var A5="Portal",Fx=v.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,a]=v.useState(!1);tr(()=>a(!0),[]);const o=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?AN.createPortal(s.jsx(ht.div,{...r,ref:e}),o):null});Fx.displayName=A5;function I5(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var hd=t=>{const{present:e,children:n}=t,r=R5(e),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),a=Tt(r.ref,P5(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:a}):null};hd.displayName="Presence";function R5(t){const[e,n]=v.useState(),r=v.useRef(null),i=v.useRef(t),a=v.useRef("none"),o=t?"mounted":"unmounted",[c,u]=I5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const h=Su(r.current);a.current=c==="mounted"?h:"none"},[c]),tr(()=>{const h=r.current,f=i.current;if(f!==t){const g=a.current,y=Su(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,u]),tr(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const N=Su(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&N&&(u("ANIMATION_END"),!i.current)){const b=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},g=y=>{y.target===e&&(a.current=Su(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:v.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Su(t){return(t==null?void 0:t.animationName)||"none"}function P5(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Mm=0;function vj(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??e1()),document.body.insertAdjacentElement("beforeend",t[1]??e1()),Mm++,()=>{Mm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Mm--}},[])}function e1(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Ps=function(){return Ps=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return Y5;var e=Q5(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},Z5=jj(),xl="data-scroll-locked",eR=function(t,e,n,r){var i=t.left,a=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),`
.`.concat(D5,` {
overflow: hidden `).concat(r,`;
padding-right: `).concat(c,"px ").concat(r,`;
}
- body[`).concat(vl,`] {
+ body[`).concat(xl,`] {
overflow: hidden `).concat(r,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
@@ -552,42 +552,42 @@ Error generating stack: `+S.message+`
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
}
- .`).concat(Gu,` {
+ .`).concat(Ju,` {
right: `).concat(c,"px ").concat(r,`;
}
- .`).concat(Ju,` {
+ .`).concat(Yu,` {
margin-right: `).concat(c,"px ").concat(r,`;
}
- .`).concat(Gu," .").concat(Gu,` {
+ .`).concat(Ju," .").concat(Ju,` {
right: 0 `).concat(r,`;
}
- .`).concat(Ju," .").concat(Ju,` {
+ .`).concat(Yu," .").concat(Yu,` {
margin-right: 0 `).concat(r,`;
}
- body[`).concat(vl,`] {
+ body[`).concat(xl,`] {
`).concat(L5,": ").concat(c,`px;
}
-`)},t1=function(){var t=parseInt(document.body.getAttribute(vl)||"0",10);return isFinite(t)?t:0},tR=function(){v.useEffect(function(){return document.body.setAttribute(vl,(t1()+1).toString()),function(){var t=t1()-1;t<=0?document.body.removeAttribute(vl):document.body.setAttribute(vl,t.toString())}},[])},nR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;tR();var a=v.useMemo(function(){return X5(i)},[i]);return v.createElement(Z5,{styles:eR(a,!e,i,n?"":"!important")})},Ag=!1;if(typeof window<"u")try{var Su=Object.defineProperty({},"passive",{get:function(){return Ag=!0,!0}});window.addEventListener("test",Su,Su),window.removeEventListener("test",Su,Su)}catch{Ag=!1}var rl=Ag?{passive:!1}:!1,rR=function(t){return t.tagName==="TEXTAREA"},jj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!rR(t)&&n[e]==="visible")},sR=function(t){return jj(t,"overflowY")},iR=function(t){return jj(t,"overflowX")},n1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=kj(t,r);if(i){var a=Sj(t,r),o=a[1],c=a[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},aR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},oR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},kj=function(t,e){return t==="v"?sR(e):iR(e)},Sj=function(t,e){return t==="v"?aR(e):oR(e)},lR=function(t,e){return t==="h"&&e==="rtl"?-1:1},cR=function(t,e,n,r,i){var a=lR(t,window.getComputedStyle(e).direction),o=a*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=Sj(t,c),w=y[0],N=y[1],b=y[2],k=N-b-a*w;(w||k)&&kj(t,c)&&(m+=k,g+=w);var C=c.parentNode;c=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},Cu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},r1=function(t){return[t.deltaX,t.deltaY]},s1=function(t){return t&&"current"in t?t.current:t},dR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},uR=function(t){return`
+`)},n1=function(){var t=parseInt(document.body.getAttribute(xl)||"0",10);return isFinite(t)?t:0},tR=function(){v.useEffect(function(){return document.body.setAttribute(xl,(n1()+1).toString()),function(){var t=n1()-1;t<=0?document.body.removeAttribute(xl):document.body.setAttribute(xl,t.toString())}},[])},nR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;tR();var a=v.useMemo(function(){return X5(i)},[i]);return v.createElement(Z5,{styles:eR(a,!e,i,n?"":"!important")})},Ig=!1;if(typeof window<"u")try{var Cu=Object.defineProperty({},"passive",{get:function(){return Ig=!0,!0}});window.addEventListener("test",Cu,Cu),window.removeEventListener("test",Cu,Cu)}catch{Ig=!1}var tl=Ig?{passive:!1}:!1,rR=function(t){return t.tagName==="TEXTAREA"},kj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!rR(t)&&n[e]==="visible")},sR=function(t){return kj(t,"overflowY")},iR=function(t){return kj(t,"overflowX")},r1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Sj(t,r);if(i){var a=Cj(t,r),o=a[1],c=a[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},aR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},oR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Sj=function(t,e){return t==="v"?sR(e):iR(e)},Cj=function(t,e){return t==="v"?aR(e):oR(e)},lR=function(t,e){return t==="h"&&e==="rtl"?-1:1},cR=function(t,e,n,r,i){var a=lR(t,window.getComputedStyle(e).direction),o=a*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=Cj(t,c),w=y[0],N=y[1],b=y[2],k=N-b-a*w;(w||k)&&Sj(t,c)&&(m+=k,g+=w);var C=c.parentNode;c=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},Eu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},s1=function(t){return[t.deltaX,t.deltaY]},i1=function(t){return t&&"current"in t?t.current:t},dR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},uR=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
-`)},hR=0,sl=[];function fR(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(hR++)[0],a=v.useState(Nj)[0],o=v.useRef(t);v.useEffect(function(){o.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var N=O5([t.lockRef.current],(t.shards||[]).map(s1),!0).filter(Boolean);return N.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),N.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=v.useCallback(function(N,b){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!o.current.allowPinchZoom;var k=Cu(N),C=n.current,E="deltaX"in N?N.deltaX:C[0]-k[0],T="deltaY"in N?N.deltaY:C[1]-k[1],I,O=N.target,D=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in N&&D==="h"&&O.type==="range")return!1;var P=window.getSelection(),L=P&&P.anchorNode,_=L?L===O||L.contains(O):!1;if(_)return!1;var J=n1(D,O);if(!J)return!0;if(J?I=D:(I=D==="v"?"h":"v",J=n1(D,O)),!J)return!1;if(!r.current&&"changedTouches"in N&&(E||T)&&(r.current=I),!I)return!0;var ee=r.current||I;return cR(ee,b,N,ee==="h"?E:T)},[]),u=v.useCallback(function(N){var b=N;if(!(!sl.length||sl[sl.length-1]!==a)){var k="deltaY"in b?r1(b):Cu(b),C=e.current.filter(function(I){return I.name===b.type&&(I.target===b.target||b.target===I.shadowParent)&&dR(I.delta,k)})[0];if(C&&C.should){b.cancelable&&b.preventDefault();return}if(!C){var E=(o.current.shards||[]).map(s1).filter(Boolean).filter(function(I){return I.contains(b.target)}),T=E.length>0?c(b,E[0]):!o.current.noIsolation;T&&b.cancelable&&b.preventDefault()}}},[]),h=v.useCallback(function(N,b,k,C){var E={name:N,delta:b,target:k,should:C,shadowParent:pR(k)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(T){return T!==E})},1)},[]),f=v.useCallback(function(N){n.current=Cu(N),r.current=void 0},[]),m=v.useCallback(function(N){h(N.type,r1(N),N.target,c(N,t.lockRef.current))},[]),g=v.useCallback(function(N){h(N.type,Cu(N),N.target,c(N,t.lockRef.current))},[]);v.useEffect(function(){return sl.push(a),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,rl),document.addEventListener("touchmove",u,rl),document.addEventListener("touchstart",f,rl),function(){sl=sl.filter(function(N){return N!==a}),document.removeEventListener("wheel",u,rl),document.removeEventListener("touchmove",u,rl),document.removeEventListener("touchstart",f,rl)}},[]);var y=t.removeScrollBar,w=t.inert;return v.createElement(v.Fragment,null,w?v.createElement(a,{styles:uR(i)}):null,y?v.createElement(nR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function pR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const mR=H5(wj,fR);var Fx=v.forwardRef(function(t,e){return v.createElement(uf,Os({},t,{ref:e,sideCar:mR}))});Fx.classNames=uf.classNames;var gR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},il=new WeakMap,Eu=new WeakMap,Tu={},Rm=0,Cj=function(t){return t&&(t.host||Cj(t.parentNode))},xR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Cj(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},yR=function(t,e,n,r){var i=xR(e,Array.isArray(t)?t:[t]);Tu[n]||(Tu[n]=new WeakMap);var a=Tu[n],o=[],c=new Set,u=new Set(i),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};i.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var y=g.getAttribute(r),w=y!==null&&y!=="false",N=(il.get(g)||0)+1,b=(a.get(g)||0)+1;il.set(g,N),a.set(g,b),o.push(g),N===1&&w&&Eu.set(g,!0),b===1&&g.setAttribute(n,"true"),w||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Rm++,function(){o.forEach(function(m){var g=il.get(m)-1,y=a.get(m)-1;il.set(m,g),a.set(m,y),g||(Eu.has(m)||m.removeAttribute(r),Eu.delete(m)),y||m.removeAttribute(n)}),Rm--,Rm||(il=new WeakMap,il=new WeakMap,Eu=new WeakMap,Tu={})}},Ej=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=gR(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),yR(r,i,n,"aria-hidden")):function(){return null}},hf="Dialog",[Tj]=ka(hf),[vR,bs]=Tj(hf),Mj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=t,c=v.useRef(null),u=v.useRef(null),[h,f]=fo({prop:r,defaultProp:i??!1,onChange:a,caller:hf});return s.jsx(vR,{scope:e,triggerRef:c,contentRef:u,contentId:ua(),titleId:ua(),descriptionId:ua(),open:h,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Mj.displayName=hf;var Aj="DialogTrigger",bR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs(Aj,n),a=St(e,i.triggerRef);return s.jsx(dt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Hx(i.open),...r,ref:a,onClick:at(t.onClick,i.onOpenToggle)})});bR.displayName=Aj;var Bx="DialogPortal",[wR,Ij]=Tj(Bx,{forceMount:void 0}),Rj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,a=bs(Bx,e);return s.jsx(wR,{scope:e,forceMount:n,children:v.Children.map(r,o=>s.jsx(ud,{present:n||a.open,children:s.jsx($x,{asChild:!0,container:i,children:o})}))})};Rj.displayName=Bx;var dh="DialogOverlay",Pj=v.forwardRef((t,e)=>{const n=Ij(dh,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=bs(dh,t.__scopeDialog);return a.modal?s.jsx(ud,{present:r||a.open,children:s.jsx(jR,{...i,ref:e})}):null});Pj.displayName=dh;var NR=Jc("DialogOverlay.RemoveScroll"),jR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs(dh,n);return s.jsx(Fx,{as:NR,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(dt.div,{"data-state":Hx(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),po="DialogContent",Oj=v.forwardRef((t,e)=>{const n=Ij(po,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=bs(po,t.__scopeDialog);return s.jsx(ud,{present:r||a.open,children:a.modal?s.jsx(kR,{...i,ref:e}):s.jsx(SR,{...i,ref:e})})});Oj.displayName=po;var kR=v.forwardRef((t,e)=>{const n=bs(po,t.__scopeDialog),r=v.useRef(null),i=St(e,n.contentRef,r);return v.useEffect(()=>{const a=r.current;if(a)return Ej(a)},[]),s.jsx(Dj,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:at(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:at(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&a.preventDefault()}),onFocusOutside:at(t.onFocusOutside,a=>a.preventDefault())})}),SR=v.forwardRef((t,e)=>{const n=bs(po,t.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return s.jsx(Dj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,a),a.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),Dj=v.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=t,c=bs(po,n),u=v.useRef(null),h=St(e,u);return yj(),s.jsxs(s.Fragment,{children:[s.jsx(zx,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:s.jsx(_x,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Hx(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(CR,{titleId:c.titleId}),s.jsx(TR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Vx="DialogTitle",Lj=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs(Vx,n);return s.jsx(dt.h2,{id:i.titleId,...r,ref:e})});Lj.displayName=Vx;var _j="DialogDescription",zj=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs(_j,n);return s.jsx(dt.p,{id:i.descriptionId,...r,ref:e})});zj.displayName=_j;var $j="DialogClose",Fj=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=bs($j,n);return s.jsx(dt.button,{type:"button",...r,ref:e,onClick:at(t.onClick,()=>i.onOpenChange(!1))})});Fj.displayName=$j;function Hx(t){return t?"open":"closed"}var Bj="DialogTitleWarning",[HV,Vj]=t5(Bj,{contentName:po,titleName:Vx,docsSlug:"dialog"}),CR=({titleId:t})=>{const e=Vj(Bj),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
+`)},hR=0,nl=[];function fR(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(hR++)[0],a=v.useState(jj)[0],o=v.useRef(t);v.useEffect(function(){o.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var N=O5([t.lockRef.current],(t.shards||[]).map(i1),!0).filter(Boolean);return N.forEach(function(b){return b.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),N.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=v.useCallback(function(N,b){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!o.current.allowPinchZoom;var k=Eu(N),C=n.current,E="deltaX"in N?N.deltaX:C[0]-k[0],T="deltaY"in N?N.deltaY:C[1]-k[1],I,O=N.target,D=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in N&&D==="h"&&O.type==="range")return!1;var P=window.getSelection(),L=P&&P.anchorNode,_=L?L===O||L.contains(O):!1;if(_)return!1;var J=r1(D,O);if(!J)return!0;if(J?I=D:(I=D==="v"?"h":"v",J=r1(D,O)),!J)return!1;if(!r.current&&"changedTouches"in N&&(E||T)&&(r.current=I),!I)return!0;var ee=r.current||I;return cR(ee,b,N,ee==="h"?E:T)},[]),u=v.useCallback(function(N){var b=N;if(!(!nl.length||nl[nl.length-1]!==a)){var k="deltaY"in b?s1(b):Eu(b),C=e.current.filter(function(I){return I.name===b.type&&(I.target===b.target||b.target===I.shadowParent)&&dR(I.delta,k)})[0];if(C&&C.should){b.cancelable&&b.preventDefault();return}if(!C){var E=(o.current.shards||[]).map(i1).filter(Boolean).filter(function(I){return I.contains(b.target)}),T=E.length>0?c(b,E[0]):!o.current.noIsolation;T&&b.cancelable&&b.preventDefault()}}},[]),h=v.useCallback(function(N,b,k,C){var E={name:N,delta:b,target:k,should:C,shadowParent:pR(k)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(T){return T!==E})},1)},[]),f=v.useCallback(function(N){n.current=Eu(N),r.current=void 0},[]),m=v.useCallback(function(N){h(N.type,s1(N),N.target,c(N,t.lockRef.current))},[]),g=v.useCallback(function(N){h(N.type,Eu(N),N.target,c(N,t.lockRef.current))},[]);v.useEffect(function(){return nl.push(a),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,tl),document.addEventListener("touchmove",u,tl),document.addEventListener("touchstart",f,tl),function(){nl=nl.filter(function(N){return N!==a}),document.removeEventListener("wheel",u,tl),document.removeEventListener("touchmove",u,tl),document.removeEventListener("touchstart",f,tl)}},[]);var y=t.removeScrollBar,w=t.inert;return v.createElement(v.Fragment,null,w?v.createElement(a,{styles:uR(i)}):null,y?v.createElement(nR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function pR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const mR=H5(Nj,fR);var Bx=v.forwardRef(function(t,e){return v.createElement(hf,Ps({},t,{ref:e,sideCar:mR}))});Bx.classNames=hf.classNames;var gR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rl=new WeakMap,Tu=new WeakMap,Mu={},Pm=0,Ej=function(t){return t&&(t.host||Ej(t.parentNode))},xR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Ej(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},yR=function(t,e,n,r){var i=xR(e,Array.isArray(t)?t:[t]);Mu[n]||(Mu[n]=new WeakMap);var a=Mu[n],o=[],c=new Set,u=new Set(i),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};i.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var y=g.getAttribute(r),w=y!==null&&y!=="false",N=(rl.get(g)||0)+1,b=(a.get(g)||0)+1;rl.set(g,N),a.set(g,b),o.push(g),N===1&&w&&Tu.set(g,!0),b===1&&g.setAttribute(n,"true"),w||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Pm++,function(){o.forEach(function(m){var g=rl.get(m)-1,y=a.get(m)-1;rl.set(m,g),a.set(m,y),g||(Tu.has(m)||m.removeAttribute(r),Tu.delete(m)),y||m.removeAttribute(n)}),Pm--,Pm||(rl=new WeakMap,rl=new WeakMap,Tu=new WeakMap,Mu={})}},Tj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=gR(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),yR(r,i,n,"aria-hidden")):function(){return null}},ff="Dialog",[Mj]=Sa(ff),[vR,Ns]=Mj(ff),Aj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=t,c=v.useRef(null),u=v.useRef(null),[h,f]=po({prop:r,defaultProp:i??!1,onChange:a,caller:ff});return s.jsx(vR,{scope:e,triggerRef:c,contentRef:u,contentId:ha(),titleId:ha(),descriptionId:ha(),open:h,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Aj.displayName=ff;var Ij="DialogTrigger",bR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(Ij,n),a=Tt(e,i.triggerRef);return s.jsx(ht.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Wx(i.open),...r,ref:a,onClick:ot(t.onClick,i.onOpenToggle)})});bR.displayName=Ij;var Vx="DialogPortal",[wR,Rj]=Mj(Vx,{forceMount:void 0}),Pj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,a=Ns(Vx,e);return s.jsx(wR,{scope:e,forceMount:n,children:v.Children.map(r,o=>s.jsx(hd,{present:n||a.open,children:s.jsx(Fx,{asChild:!0,container:i,children:o})}))})};Pj.displayName=Vx;var uh="DialogOverlay",Oj=v.forwardRef((t,e)=>{const n=Rj(uh,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=Ns(uh,t.__scopeDialog);return a.modal?s.jsx(hd,{present:r||a.open,children:s.jsx(jR,{...i,ref:e})}):null});Oj.displayName=uh;var NR=Yc("DialogOverlay.RemoveScroll"),jR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(uh,n);return s.jsx(Bx,{as:NR,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(ht.div,{"data-state":Wx(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),mo="DialogContent",Dj=v.forwardRef((t,e)=>{const n=Rj(mo,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,a=Ns(mo,t.__scopeDialog);return s.jsx(hd,{present:r||a.open,children:a.modal?s.jsx(kR,{...i,ref:e}):s.jsx(SR,{...i,ref:e})})});Dj.displayName=mo;var kR=v.forwardRef((t,e)=>{const n=Ns(mo,t.__scopeDialog),r=v.useRef(null),i=Tt(e,n.contentRef,r);return v.useEffect(()=>{const a=r.current;if(a)return Tj(a)},[]),s.jsx(Lj,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ot(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ot(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&a.preventDefault()}),onFocusOutside:ot(t.onFocusOutside,a=>a.preventDefault())})}),SR=v.forwardRef((t,e)=>{const n=Ns(mo,t.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return s.jsx(Lj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,a),a.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),Lj=v.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=t,c=Ns(mo,n),u=v.useRef(null),h=Tt(e,u);return vj(),s.jsxs(s.Fragment,{children:[s.jsx($x,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:s.jsx(zx,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Wx(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(CR,{titleId:c.titleId}),s.jsx(TR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Hx="DialogTitle",_j=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(Hx,n);return s.jsx(ht.h2,{id:i.titleId,...r,ref:e})});_j.displayName=Hx;var zj="DialogDescription",$j=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(zj,n);return s.jsx(ht.p,{id:i.descriptionId,...r,ref:e})});$j.displayName=zj;var Fj="DialogClose",Bj=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ns(Fj,n);return s.jsx(ht.button,{type:"button",...r,ref:e,onClick:ot(t.onClick,()=>i.onOpenChange(!1))})});Bj.displayName=Fj;function Wx(t){return t?"open":"closed"}var Vj="DialogTitleWarning",[HV,Hj]=t5(Vj,{contentName:mo,titleName:Hx,docsSlug:"dialog"}),CR=({titleId:t})=>{const e=Hj(Vj),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
-For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},ER="DialogDescriptionWarning",TR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vj(ER).contentName}}.`;return v.useEffect(()=>{var a;const i=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},MR=Mj,AR=Rj,IR=Pj,RR=Oj,PR=Lj,OR=zj,DR=Fj;function Kt(t){return s.jsx(MR,{"data-slot":"dialog",...t})}function LR(t){return s.jsx(AR,{...t})}const Hj=v.forwardRef(({className:t,...e},n)=>s.jsx(IR,{ref:n,className:Ct("fixed inset-0 z-50 bg-black/50",t),...e}));Hj.displayName="DialogOverlay";const zt=v.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},i)=>s.jsxs(LR,{children:[s.jsx(Hj,{}),s.jsxs(RR,{ref:i,"aria-describedby":void 0,className:Ct("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",t),...r,children:[e,n&&s.jsxs(DR,{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:[s.jsx(Xn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zt.displayName="DialogContent";function qt({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col gap-2 text-center sm:text-left",t),...e})}function hn({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Gt(t){return s.jsx(PR,{className:"text-lg font-semibold leading-none",...t})}function Wx(t){return s.jsx(OR,{className:"text-sm text-muted-foreground",...t})}const _R=nj("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 Ue({className:t,variant:e,asChild:n=!1,...r}){const i=n?ZN:"span";return s.jsx(i,{className:Ct(_R({variant:e}),t),...r})}var zR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$R=zR.reduce((t,e)=>{const n=XN(`Primitive.${e}`),r=v.forwardRef((i,a)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),FR="Label",Wj=v.forwardRef((t,e)=>s.jsx($R.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Wj.displayName=FR;var Uj=Wj;const Z=v.forwardRef(({className:t,...e},n)=>s.jsx(Uj,{ref:n,className:Ct("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Z.displayName=Uj.displayName;function Ux(t){const e=t+"CollectionProvider",[n,r]=ka(e),[i,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=N=>{const{scope:b,children:k}=N,C=hr.useRef(null),E=hr.useRef(new Map).current;return s.jsx(i,{scope:b,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Jc(c),h=hr.forwardRef((N,b)=>{const{scope:k,children:C}=N,E=a(c,k),T=St(b,E.collectionRef);return s.jsx(u,{ref:T,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Jc(f),y=hr.forwardRef((N,b)=>{const{scope:k,children:C,...E}=N,T=hr.useRef(null),I=St(b,T),O=a(f,k);return hr.useEffect(()=>(O.itemMap.set(T,{ref:T,...E}),()=>void O.itemMap.delete(T))),s.jsx(g,{[m]:"",ref:I,children:C})});y.displayName=f;function w(N){const b=a(t+"CollectionConsumer",N);return hr.useCallback(()=>{const C=b.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(b.itemMap.values()).sort((O,D)=>E.indexOf(O.ref.current)-E.indexOf(D.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},w,r]}var BR=v.createContext(void 0);function ff(t){const e=v.useContext(BR);return t||e||"ltr"}var Pm="rovingFocusGroup.onEntryFocus",VR={bubbles:!1,cancelable:!0},hd="RovingFocusGroup",[Ig,Kj,HR]=Ux(hd),[WR,qj]=ka(hd,[HR]),[UR,KR]=WR(hd),Gj=v.forwardRef((t,e)=>s.jsx(Ig.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Ig.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(qR,{...t,ref:e})})}));Gj.displayName=hd;var qR=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=v.useRef(null),y=St(e,g),w=ff(a),[N,b]=fo({prop:o,defaultProp:c??null,onChange:u,caller:hd}),[k,C]=v.useState(!1),E=ga(h),T=Kj(n),I=v.useRef(!1),[O,D]=v.useState(0);return v.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Pm,E),()=>P.removeEventListener(Pm,E)},[E]),s.jsx(UR,{scope:n,orientation:r,dir:w,loop:i,currentTabStopId:N,onItemFocus:v.useCallback(P=>b(P),[b]),onItemShiftTab:v.useCallback(()=>C(!0),[]),onFocusableItemAdd:v.useCallback(()=>D(P=>P+1),[]),onFocusableItemRemove:v.useCallback(()=>D(P=>P-1),[]),children:s.jsx(dt.div,{tabIndex:k||O===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:at(t.onMouseDown,()=>{I.current=!0}),onFocus:at(t.onFocus,P=>{const L=!I.current;if(P.target===P.currentTarget&&L&&!k){const _=new CustomEvent(Pm,VR);if(P.currentTarget.dispatchEvent(_),!_.defaultPrevented){const J=T().filter(F=>F.focusable),ee=J.find(F=>F.active),Y=J.find(F=>F.id===N),R=[ee,Y,...J].filter(Boolean).map(F=>F.ref.current);Qj(R,f)}}I.current=!1}),onBlur:at(t.onBlur,()=>C(!1))})})}),Jj="RovingFocusGroupItem",Yj=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...c}=t,u=ua(),h=a||u,f=KR(Jj,n),m=f.currentTabStopId===h,g=Kj(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:N}=f;return v.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),s.jsx(Ig.ItemSlot,{scope:n,id:h,focusable:r,active:i,children:s.jsx(dt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:at(t.onMouseDown,b=>{r?f.onItemFocus(h):b.preventDefault()}),onFocus:at(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:at(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){f.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const k=YR(b,f.orientation,f.dir);if(k!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const T=E.indexOf(b.currentTarget);E=f.loop?QR(E,T+1):E.slice(T+1)}setTimeout(()=>Qj(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:N!=null}):o})})});Yj.displayName=Jj;var GR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function YR(t,e,n){const r=JR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GR[r]}function Qj(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function QR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var XR=Gj,ZR=Yj,pf="Tabs",[eP]=ka(pf,[qj]),Xj=qj(),[tP,Kx]=eP(pf),Zj=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=ff(c),[m,g]=fo({prop:r,onChange:i,defaultProp:a??"",caller:pf});return s.jsx(tP,{scope:n,baseId:ua(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(dt.div,{dir:f,"data-orientation":o,...h,ref:e})})});Zj.displayName=pf;var ek="TabsList",tk=v.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,a=Kx(ek,n),o=Xj(n);return s.jsx(XR,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:s.jsx(dt.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:e})})});tk.displayName=ek;var nk="TabsTrigger",rk=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=t,o=Kx(nk,n),c=Xj(n),u=ak(o.baseId,r),h=ok(o.baseId,r),f=r===o.value;return s.jsx(ZR,{asChild:!0,...c,focusable:!i,active:f,children:s.jsx(dt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...a,ref:e,onMouseDown:at(t.onMouseDown,m=>{!i&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:at(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:at(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!i&&m&&o.onValueChange(r)})})})});rk.displayName=nk;var sk="TabsContent",ik=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=t,c=Kx(sk,n),u=ak(c.baseId,r),h=ok(c.baseId,r),f=r===c.value,m=v.useRef(f);return v.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(ud,{present:i||f,children:({present:g})=>s.jsx(dt.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&a})})});ik.displayName=sk;function ak(t,e){return`${t}-trigger-${e}`}function ok(t,e){return`${t}-content-${e}`}var nP=Zj,lk=tk,ck=rk,dk=ik;const fd=nP,Ll=v.forwardRef(({className:t,...e},n)=>s.jsx(lk,{ref:n,className:Ct("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Ll.displayName=lk.displayName;const tn=v.forwardRef(({className:t,...e},n)=>s.jsx(ck,{ref:n,className:Ct("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",t),...e}));tn.displayName=ck.displayName;const nn=v.forwardRef(({className:t,...e},n)=>s.jsx(dk,{ref:n,className:Ct("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));nn.displayName=dk.displayName;function qx(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function Gx(t){const[e,n]=v.useState(void 0);return Zn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let o,c;if("borderBoxSize"in a){const u=a.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var mf="Switch",[rP]=ka(mf),[sP,iP]=rP(mf),uk=v.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=v.useState(null),w=St(e,E=>y(E)),N=v.useRef(!1),b=g?f||!!g.closest("form"):!0,[k,C]=fo({prop:i,defaultProp:a??!1,onChange:h,caller:mf});return s.jsxs(sP,{scope:n,checked:k,disabled:c,children:[s.jsx(dt.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":mk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:w,onClick:at(t.onClick,E=>{C(T=>!T),b&&(N.current=E.isPropagationStopped(),N.current||E.stopPropagation())})}),b&&s.jsx(pk,{control:g,bubbles:!N.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});uk.displayName=mf;var hk="SwitchThumb",fk=v.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=iP(hk,n);return s.jsx(dt.span,{"data-state":mk(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});fk.displayName=hk;var aP="SwitchBubbleInput",pk=v.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...i},a)=>{const o=v.useRef(null),c=St(o,a),u=qx(n),h=Gx(e);return v.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const w=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(w)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:c,style:{...i.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});pk.displayName=aP;function mk(t){return t?"checked":"unchecked"}var gk=uk,oP=fk;const Et=v.forwardRef(({className:t,...e},n)=>s.jsx(gk,{className:Ct("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]",t),...e,ref:n,children:s.jsx(oP,{className:Ct("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")})}));Et.displayName=gk.displayName;function Jx({open:t,onClose:e,userId:n,onUserUpdated:r}){var ar;const[i,a]=v.useState(null),[o,c]=v.useState([]),[u,h]=v.useState([]),[f,m]=v.useState(!1),[g,y]=v.useState(!1),[w,N]=v.useState(!1),[b,k]=v.useState("info"),[C,E]=v.useState(""),[T,I]=v.useState(""),[O,D]=v.useState([]),[P,L]=v.useState(""),[_,J]=v.useState(""),[ee,Y]=v.useState(""),[U,R]=v.useState(!1),[F,re]=v.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[z,ie]=v.useState([]),[G,$]=v.useState(!1),[H,ce]=v.useState(!1),[W,fe]=v.useState(null),[X,de]=v.useState(null),[he,we]=v.useState(""),[Te,Ve]=v.useState(""),[He,gt]=v.useState(""),[Pt,yn]=v.useState(!1),[ht,At]=v.useState(null),[ne,Pe]=v.useState("");v.useEffect(()=>{t&&n&&(k("info"),fe(null),de(null),At(null),Pe(""),J(""),Y(""),Qe(),Le("/api/db/vip-roles").then(me=>{me!=null&&me.success&&me.data&&ie(me.data)}).catch(()=>{}))},[t,n]);async function Qe(){if(n){m(!0);try{const me=await Le(`/api/db/users?id=${encodeURIComponent(n)}`);if(me!=null&&me.success&&me.user){const ve=me.user;a(ve),E(ve.phone||""),I(ve.nickname||""),we(ve.phone||""),Ve(ve.wechatId||""),gt(ve.openId||"");try{D(typeof ve.tags=="string"?JSON.parse(ve.tags||"[]"):[])}catch{D([])}re({isVip:!!(ve.isVip??!1),vipExpireDate:ve.vipExpireDate?String(ve.vipExpireDate).slice(0,10):"",vipRole:String(ve.vipRole??""),vipName:String(ve.vipName??""),vipProject:String(ve.vipProject??""),vipContact:String(ve.vipContact??""),vipBio:String(ve.vipBio??"")})}try{const ve=await Le(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);ve!=null&&ve.success&&ve.tracks&&c(ve.tracks)}catch{c([])}try{const ve=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ve!=null&&ve.success&&ve.referrals&&h(ve.referrals)}catch{h([])}}catch(me){console.error("Load user detail error:",me)}finally{m(!1)}}}async function xt(){if(!(i!=null&&i.phone)){ae.info("用户未绑定手机号,无法同步");return}y(!0);try{const me=await wt("/api/ckb/sync",{action:"full_sync",phone:i.phone,userId:i.id});me!=null&&me.success?(ae.success("同步成功"),Qe()):ae.error("同步失败: "+(me==null?void 0:me.error))}catch(me){console.error("Sync CKB error:",me),ae.error("同步失败")}finally{y(!1)}}async function ft(){if(i){N(!0);try{const me={id:i.id,phone:C||void 0,nickname:T||void 0,tags:JSON.stringify(O)},ve=await Mt("/api/db/users",me);ve!=null&&ve.success?(ae.success("保存成功"),Qe(),r==null||r()):ae.error("保存失败: "+(ve==null?void 0:ve.error))}catch(me){console.error("Save user error:",me),ae.error("保存失败")}finally{N(!1)}}}const pt=()=>{P&&!O.includes(P)&&(D([...O,P]),L(""))},Nt=me=>D(O.filter(ve=>ve!==me));async function Xt(){if(i){if(!_){ae.error("请输入新密码");return}if(_!==ee){ae.error("两次密码不一致");return}if(_.length<6){ae.error("密码至少 6 位");return}R(!0);try{const me=await Mt("/api/db/users",{id:i.id,password:_});me!=null&&me.success?(ae.success("修改成功"),J(""),Y("")):ae.error("修改失败: "+((me==null?void 0:me.error)||""))}catch{ae.error("修改失败")}finally{R(!1)}}}async function Ot(){if(i){if(F.isVip&&!F.vipExpireDate.trim()){ae.error("开启 VIP 请填写有效到期日");return}$(!0);try{const me={id:i.id,isVip:F.isVip,vipExpireDate:F.isVip?F.vipExpireDate:void 0,vipRole:F.vipRole||void 0,vipName:F.vipName||void 0,vipProject:F.vipProject||void 0,vipContact:F.vipContact||void 0,vipBio:F.vipBio||void 0},ve=await Mt("/api/db/users",me);ve!=null&&ve.success?(ae.success("VIP 设置已保存"),Qe(),r==null||r()):ae.error("保存失败: "+((ve==null?void 0:ve.error)||""))}catch{ae.error("保存失败")}finally{$(!1)}}}async function Tn(){if(!he&&!He&&!Te){de("请至少输入手机号、微信号或 OpenID 中的一项");return}ce(!0),de(null),fe(null);try{const me=new URLSearchParams;he&&me.set("phone",he),He&&me.set("openId",He),Te&&me.set("wechatId",Te);const ve=await Le(`/api/admin/shensheshou/query?${me}`);ve!=null&&ve.success&&ve.data?(fe(ve.data),i&&await Dt(ve.data)):de((ve==null?void 0:ve.error)||"未查询到数据,该用户可能未在神射手收录")}catch(me){console.error("SSS query error:",me),de("请求失败,请检查神射手接口配置")}finally{ce(!1)}}async function Dt(me){if(i)try{await wt("/api/admin/shensheshou/enrich",{userId:i.id,phone:he||i.phone||"",openId:He||i.openId||"",wechatId:Te||i.wechatId||""}),Qe()}catch(ve){console.error("SSS enrich error:",ve)}}async function Kn(){if(i){yn(!0),At(null);try{const me={users:[{phone:i.phone||"",name:i.nickname||"",openId:i.openId||"",tags:O}]},ve=await wt("/api/admin/shensheshou/ingest",me);ve!=null&&ve.success&&ve.data?At(ve.data):At({error:(ve==null?void 0:ve.error)||"推送失败"})}catch(me){console.error("SSS ingest error:",me),At({error:"请求失败"})}finally{yn(!1)}}}const Zr=me=>{const or={view_chapter:Yr,purchase:Cg,match:Un,login:yl,register:yl,share:gs,bind_phone:dA,bind_wechat:ZM,fill_profile:qu,visit_page:pl}[me]||Ng;return s.jsx(or,{className:"w-4 h-4"})};return t?s.jsx(Kt,{open:t,onOpenChange:()=>e(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(yl,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(i==null?void 0:i.phone)&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(i==null?void 0:i.isVip)&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i?s.jsxs("div",{className:"flex flex-col h-[75vh]",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:i.avatar?s.jsx("img",{src:i.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((ar=i.nickname)==null?void 0:ar.charAt(0))||"?"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h3",{className:"text-lg font-bold text-white",children:i.nickname}),i.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),i.hasFullBook&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),i.vipRole&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:i.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[i.phone?`📱 ${i.phone}`:"未绑定手机",i.wechatId&&` · 💬 ${i.wechatId}`,i.mbti&&` · ${i.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",i.id.slice(0,16),"…"]}),i.referralCode&&s.jsxs("p",{className:"text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"推广码:"}),s.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:i.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(i.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(fd,{value:b,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs(Ll,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[s.jsx(tn,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),s.jsx(tn,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(pl,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),s.jsx(tn,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),s.jsxs(tn,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(ia,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),s.jsxs(nn,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:C,onChange:me=>E(me.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:T,onChange:me=>I(me.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[i.openId&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),s.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:i.openId})]}),i.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(GN,{className:"w-4 h-4 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),s.jsx("p",{className:"text-white",children:i.region})]})]}),i.industry&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),s.jsx("p",{className:"text-white",children:i.industry})]}),i.position&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),s.jsx("p",{className:"text-white",children:i.position})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:i.referralCount??0})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),s.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(i.pendingEarnings??0).toFixed(2)]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),s.jsx("p",{className:"text-sm text-white",children:i.createdAt?new Date(i.createdAt).toLocaleDateString():"-"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(LM,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(oe,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:_,onChange:me=>J(me.target.value)}),s.jsx(oe,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:ee,onChange:me=>Y(me.target.value)}),s.jsx(te,{size:"sm",onClick:Xt,disabled:U||!_||!ee,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:U?"保存中...":"确认修改"})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(xl,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-400 text-sm",children:"VIP 会员"}),s.jsx(Et,{checked:F.isVip,onCheckedChange:me=>re(ve=>({...ve,isVip:me}))})]}),F.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(oe,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:F.vipExpireDate,onChange:me=>re(ve=>({...ve,vipExpireDate:me.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:F.vipRole,onChange:me=>re(ve=>({...ve,vipRole:me.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),z.map(me=>s.jsx("option",{value:me.name,children:me.name},me.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:F.vipName,onChange:me=>re(ve=>({...ve,vipName:me.target.value}))})]}),s.jsx(te,{size:"sm",onClick:Ot,disabled:G,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:G?"保存中...":"保存 VIP"})]})]})]}),i.isVip&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(xl,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:i.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[i.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:i.vipName})]}),i.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:i.vipProject})]}),i.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:i.vipContact})]}),i.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(i.vipExpireDate).toLocaleDateString()})]})]}),i.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:i.vipBio})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(uo,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"微信归属"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:ne,onChange:me=>Pe(me.target.value)}),s.jsxs(te,{size:"sm",onClick:async()=>{if(!(!ne||!i))try{await Mt("/api/db/users",{id:i.id,wechatId:ne}),ae.success("已保存微信归属"),Qe()}catch{ae.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[s.jsx(gn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),i.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:i.wechatId})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(gs,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(te,{size:"sm",onClick:xt,disabled:g||!i.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"同步状态:"}),i.ckbSyncedAt?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"最后同步:"}),s.jsx("span",{className:"text-gray-300 ml-1",children:i.ckbSyncedAt?new Date(i.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),s.jsxs(nn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(qu,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),s.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[s.jsx(wg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),s.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(me=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:me.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:me.tags.map(ve=>s.jsxs("button",{type:"button",onClick:()=>{O.includes(ve)?Nt(ve):D([...O,ve])},className:`px-2 py-0.5 rounded text-xs border transition-all ${O.includes(ve)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[O.includes(ve)?"✓ ":"",ve]},ve))})]},me.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[O.map((me,ve)=>s.jsxs(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[me,s.jsx("button",{type:"button",onClick:()=>Nt(me),className:"ml-1 hover:text-red-400",children:s.jsx(Xn,{className:"w-3 h-3"})})]},ve)),O.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:P,onChange:me=>L(me.target.value),onKeyDown:me=>me.key==="Enter"&&pt()}),s.jsx(te,{onClick:pt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),i.ckbTags&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(qu,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof i.ckbTags=="string"?i.ckbTags.split(","):[]).map((me,ve)=>s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:me.trim()},ve))})]})]}),s.jsxs(nn,{value:"journey",className:"flex-1 overflow-auto",children:[s.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(pl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),s.jsx("div",{className:"space-y-2",children:o.length>0?o.map((me,ve)=>s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Zr(me.action)}),ve0?u.map((me,ve)=>{var Hs;const or=me;return s.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((Hs=or.nickname)==null?void 0:Hs.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:or.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[or.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-xs",children:or.createdAt?new Date(or.createdAt).toLocaleDateString():""})]})]},or.id||ve)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),s.jsxs(nn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ia,{className:"w-5 h-5 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:he,onChange:me=>we(me.target.value)})]}),s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:Te,onChange:me=>Ve(me.target.value)})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:He,onChange:me=>gt(me.target.value)})]})]}),s.jsx(te,{onClick:Tn,disabled:H,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:H?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(da,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),X&&s.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:X}),W&&s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),s.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:W.rfm_score??"-"})]}),s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:W.user_level??"-"})]})]}),W.tags&&W.tags.length>0&&s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:W.tags.map((me,ve)=>s.jsx(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:me},ve))})]}),W.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",W.last_active]})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx(ia,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),s.jsx(te,{onClick:Kn,disabled:Pt||!i.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Pt?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(ia,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!i.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),ht&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:ht.error?s.jsx("p",{className:"text-red-400",children:String(ht.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(wg,{className:"w-4 h-4"})," 推送成功"]}),ht.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(ht.new_tags_added??0)]})]})})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[s.jsxs(te,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(te,{onClick:ft,disabled:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),w?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function lP(){const t=ja(),[e,n]=v.useState(!0),[r,i]=v.useState(!0),[a,o]=v.useState(!0),[c,u]=v.useState([]),[h,f]=v.useState([]),[m,g]=v.useState(0),[y,w]=v.useState(0),[N,b]=v.useState(0),[k,C]=v.useState(0),[E,T]=v.useState(null),[I,O]=v.useState(null),[D,P]=v.useState(!1),L=U=>{const R=U;if((R==null?void 0:R.status)===401)T("登录已过期,请重新登录");else{if((R==null?void 0:R.name)==="AbortError")return;T("加载失败,请检查网络或联系管理员")}};async function _(U){const R=U?{signal:U}:void 0;n(!0),T(null);try{const z=await Le("/api/admin/dashboard/stats",R);z!=null&&z.success&&(g(z.totalUsers??0),w(z.paidOrderCount??0),b(z.totalRevenue??0),C(z.conversionRate??0))}catch(z){if((z==null?void 0:z.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",z);try{const ie=await Le("/api/admin/dashboard/overview",R);ie!=null&&ie.success&&(g(ie.totalUsers??0),w(ie.paidOrderCount??0),b(ie.totalRevenue??0),C(ie.conversionRate??0))}catch(ie){L(ie)}}}finally{n(!1)}i(!0),o(!0);const F=async()=>{try{const z=await Le("/api/admin/dashboard/recent-orders",R);if(z!=null&&z.success&&z.recentOrders)f(z.recentOrders);else throw new Error("no data")}catch(z){if((z==null?void 0:z.name)!=="AbortError")try{const ie=await Le("/api/admin/orders?page=1&pageSize=20&status=paid",R),$=((ie==null?void 0:ie.orders)??[]).filter(H=>["paid","completed","success"].includes(H.status||""));f($.slice(0,5))}catch{f([])}}finally{i(!1)}},re=async()=>{try{const z=await Le("/api/admin/dashboard/new-users",R);if(z!=null&&z.success&&z.newUsers)u(z.newUsers);else throw new Error("no data")}catch(z){if((z==null?void 0:z.name)!=="AbortError")try{const ie=await Le("/api/db/users?page=1&pageSize=10",R);u((ie==null?void 0:ie.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([F(),re()])}v.useEffect(()=>{const U=new AbortController;_(U.signal);const R=setInterval(()=>_(),3e4);return()=>{U.abort(),clearInterval(R)}},[]);const J=m,ee=U=>{const R=U.productType||"",F=U.description||"";if(F){if(R==="section"&&F.includes("章节")){if(F.includes("-")){const re=F.split("-");if(re.length>=3)return{title:`第${re[1]}章 第${re[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:F,subtitle:"章节购买"}}return R==="fullbook"||F.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:R==="match"||F.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:F,subtitle:R==="section"?"单章":R==="fullbook"?"全书":"其他"}}return R==="section"?{title:`章节 ${U.productId||""}`,subtitle:"单章购买"}:R==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:R==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:R||"其他"}},Y=[{title:"总用户数",value:e?null:J,icon:Un,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(N??0).toFixed(2)}`,icon:Oc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,icon:Cg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,icon:Yr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),E&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:E}),s.jsx("button",{type:"button",onClick:()=>_(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:Y.map((U,R)=>s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>U.link&&t(U.link),children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(st,{className:"text-sm font-medium text-gray-400",children:U.title}),s.jsx("div",{className:`p-2 rounded-lg ${U.bg}`,children:s.jsx(U.icon,{className:`w-4 h-4 ${U.color}`})})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-[2rem] flex items-center",children:U.value!=null?U.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Ge,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),s.jsx(fl,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},R))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsx(st,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>_(),disabled:r||a,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||a?s.jsx(Ge,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Ge,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ge,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,5).map(U=>{var ie;const R=U.referrerId?c.find(G=>G.id===U.referrerId):void 0,F=U.referralCode||(R==null?void 0:R.referralCode)||(R==null?void 0:R.nickname)||(U.referrerId?String(U.referrerId).slice(0,8):""),re=ee(U),z=U.userNickname||((ie=c.find(G=>G.id===U.userId))==null?void 0:ie.nickname)||"匿名用户";return s.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:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[U.userAvatar?s.jsx("img",{src:U.userAvatar,alt:z,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:G=>{G.currentTarget.style.display="none";const $=G.currentTarget.nextElementSibling;$&&$.classList.remove("hidden")}}):null,s.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 ${U.userAvatar?"hidden":""}`,children:z.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{U.userId&&(O(U.userId),P(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:z}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",children:re.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[re.subtitle&&re.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:re.subtitle}),s.jsx("span",{children:new Date(U.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),F&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",F]})]})]}),s.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(U.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:U.paymentMethod||"微信"})]})]},U.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Cg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"新注册用户"})}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-3",children:a&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ge,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(U=>{var R;return s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((R=U.nickname)==null?void 0:R.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{O(U.id),P(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:U.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:U.phone||"-"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:U.createdAt?new Date(U.createdAt).toLocaleDateString():"-"})]},U.id)}),c.length===0&&!a&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsx(Jx,{open:D,onClose:()=>{P(!1),O(null)},userId:I,onUserUpdated:()=>_()})]})}const er=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Ct("w-full caption-bottom text-sm",t),...e})}));er.displayName="Table";const tr=v.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Ct("[&_tr]:border-b",t),...e}));tr.displayName="TableHeader";const nr=v.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Ct("[&_tr:last-child]:border-0",t),...e}));nr.displayName="TableBody";const it=v.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Ct("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));it.displayName="TableRow";const je=v.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Ct("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableHead";const xe=v.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Ct("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));xe.displayName="TableCell";function Yx(t,e){const[n,r]=v.useState(t);return v.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function xs({page:t,totalPages:e,total:n,pageSize:r,onPageChange:i,onPageSizeChange:a,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!a?null:s.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[s.jsxs("span",{children:["共 ",n," 条"]}),a&&s.jsx("select",{value:r,onChange:c=>a(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>s.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>i(1),disabled:t<=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:"首页"}),s.jsx("button",{type:"button",onClick:()=>i(t-1),disabled:t<=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:"上一页"}),s.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),s.jsx("button",{type:"button",onClick:()=>i(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),s.jsx("button",{type:"button",onClick:()=>i(e),disabled:t>=e,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 cP(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[i,a]=v.useState(0),[o,c]=v.useState(0),[u,h]=v.useState(0),[f,m]=v.useState(1),[g,y]=v.useState(10),[w,N]=v.useState(""),b=Yx(w,300),[k,C]=v.useState("all"),[E,T]=v.useState(!0),[I,O]=v.useState(null),[D,P]=v.useState(null),[L,_]=v.useState(""),[J,ee]=v.useState(!1);async function Y(){T(!0),O(null);try{const G=k==="all"?"":k==="completed"?"completed":k,$=new URLSearchParams({page:String(f),pageSize:String(g),...G&&{status:G},...b&&{search:b}}),[H,ce]=await Promise.all([Le(`/api/admin/orders?${$}`),Le("/api/db/users?page=1&pageSize=500")]);H!=null&&H.success&&(e(H.orders||[]),a(H.total??0),c(H.totalRevenue??0),h(H.todayRevenue??0)),ce!=null&&ce.success&&ce.users&&r(ce.users)}catch(G){console.error("加载订单失败",G),O("加载订单失败,请检查网络后重试")}finally{T(!1)}}v.useEffect(()=>{m(1)},[b,k]),v.useEffect(()=>{Y()},[f,g,b,k]);const U=G=>{var $;return G.userNickname||(($=n.find(H=>H.id===G.userId))==null?void 0:$.nickname)||"匿名用户"},R=G=>{var $;return(($=n.find(H=>H.id===G))==null?void 0:$.phone)||"-"},F=G=>{const $=G.productType||G.type||"",H=G.description||"";if(H){if($==="section"&&H.includes("章节")){if(H.includes("-")){const ce=H.split("-");if(ce.length>=3)return{name:`第${ce[1]}章 第${ce[2]}节`,type:"《一场Soul的创业实验》"}}return{name:H,type:"章节购买"}}return $==="fullbook"||H.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:$==="vip"||H.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:$==="match"||H.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:H,type:"其他"}}return $==="section"?{name:`章节 ${G.productId||G.sectionId||""}`,type:"单章"}:$==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:$==="vip"?{name:"VIP年度会员",type:"VIP"}:$==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:$||"其他"}},re=Math.ceil(i/g)||1;async function z(){var G;if(!(!(D!=null&&D.orderSn)&&!(D!=null&&D.id))){ee(!0),O(null);try{const $=await Mt("/api/admin/orders/refund",{orderSn:D.orderSn||D.id,reason:L||void 0});$!=null&&$.success?(P(null),_(""),Y()):O(($==null?void 0:$.error)||"退款失败")}catch($){const H=$;O(((G=H==null?void 0:H.data)==null?void 0:G.error)||"退款失败,请检查网络后重试")}finally{ee(!1)}}}function ie(){if(t.length===0){ae.info("暂无数据可导出");return}const G=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],$=t.map(X=>{const de=F(X);return[X.orderSn||X.id||"",U(X),R(X.userId),de.name,Number(X.amount||0).toFixed(2),X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付",X.status==="refunded"?"已退款":X.status==="paid"||X.status==="completed"?"已完成":X.status==="pending"||X.status==="created"?"待支付":"已失败",X.status==="refunded"&&X.refundReason?X.refundReason:"-",X.referrerEarnings?Number(X.referrerEarnings).toFixed(2):"-",X.createdAt?new Date(X.createdAt).toLocaleString("zh-CN"):""].join(",")}),H="\uFEFF"+[G.join(","),...$].join(`
-`),ce=new Blob([H],{type:"text/csv;charset=utf-8"}),W=URL.createObjectURL(ce),fe=document.createElement("a");fe.href=W,fe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,fe.click(),URL.revokeObjectURL(W)}return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>O(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(te,{variant:"outline",onClick:Y,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(oe,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:w,onChange:G=>N(G.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(KN,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:G=>C(G.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(te,{variant:"outline",onClick:ie,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(aM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:E?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"订单号"}),s.jsx(je,{className:"text-gray-400",children:"用户"}),s.jsx(je,{className:"text-gray-400",children:"商品"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"支付方式"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"退款原因"}),s.jsx(je,{className:"text-gray-400",children:"分销佣金"}),s.jsx(je,{className:"text-gray-400",children:"下单时间"}),s.jsx(je,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(nr,{children:[t.map(G=>{const $=F(G);return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(xe,{className:"font-mono text-xs text-gray-400",children:[(G.orderSn||G.id||"").slice(0,12),"..."]}),s.jsx(xe,{children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:U(G)}),s.jsx("p",{className:"text-gray-500 text-xs",children:R(G.userId)})]})}),s.jsx(xe,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[$.name,(G.productType||G.type)==="vip"&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:$.type})]})}),s.jsxs(xe,{className:"text-[#38bdac] font-bold",children:["¥",Number(G.amount||0).toFixed(2)]}),s.jsx(xe,{className:"text-gray-300",children:G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付"}),s.jsx(xe,{children:G.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):G.status==="paid"||G.status==="completed"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):G.status==="pending"||G.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),s.jsx(xe,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:G.refundReason,children:G.status==="refunded"&&G.refundReason?G.refundReason:"-"}),s.jsx(xe,{className:"text-[#FFD700]",children:G.referrerEarnings?`¥${Number(G.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(xe,{className:"text-gray-400 text-sm",children:new Date(G.createdAt).toLocaleString("zh-CN")}),s.jsx(xe,{children:(G.status==="paid"||G.status==="completed")&&s.jsxs(te,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{P(G),_("")},children:[s.jsx(YN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},G.id)}),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(xs,{page:f,totalPages:re,total:i,pageSize:g,onPageChange:m,onPageSizeChange:G=>{y(G),m(1)}})]})})}),s.jsx(Kt,{open:!!D,onOpenChange:G=>!G&&P(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"订单退款"})}),D&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",D.orderSn||D.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(D.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:L,onChange:G=>_(G.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>P(null),disabled:J,children:"取消"}),s.jsx(te,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:z,disabled:J,children:J?"退款中...":"确认退款"})]})]})})]})}const _l=v.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Ct("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",t),ref:n,...e}));_l.displayName="Textarea";const Mu=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function dP(){var Js,Ai,ks,Oa,Da;const[t,e]=$N(),n=t.get("pool"),[r,i]=v.useState([]),[a,o]=v.useState(0),[c,u]=v.useState(1),[h,f]=v.useState(10),[m,g]=v.useState(""),y=Yx(m,300),w=n==="vip"?"vip":n==="complete"?"complete":"all",[N,b]=v.useState(w),[k,C]=v.useState(!0),[E,T]=v.useState(!1),[I,O]=v.useState(null),[D,P]=v.useState(!1),[L,_]=v.useState("desc");v.useEffect(()=>{n==="vip"?b("vip"):n==="complete"?b("complete"):n==="all"&&b("all")},[n]);const[J,ee]=v.useState(!1),[Y,U]=v.useState(null),[R,F]=v.useState(!1),[re,z]=v.useState(!1),[ie,G]=v.useState({referrals:[],stats:{}}),[$,H]=v.useState(!1),[ce,W]=v.useState(null),[fe,X]=v.useState(!1),[de,he]=v.useState(null),[we,Te]=v.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Ve,He]=v.useState([]),[gt,Pt]=v.useState(!1),[yn,ht]=v.useState(!1),[At,ne]=v.useState(null),[Pe,Qe]=v.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[xt,ft]=v.useState([]),[pt,Nt]=v.useState(!1),[Xt,Ot]=v.useState(null),[Tn,Dt]=v.useState(null),[Kn,Zr]=v.useState({}),[ar,me]=v.useState(!1);async function ve(V=!1){var Re;C(!0),V&&T(!0),O(null);try{if(D){const Xe=new URLSearchParams({search:y,limit:String(h*5)}),et=await Le(`/api/db/users/rfm?${Xe}`);if(et!=null&&et.success){let Mn=et.users||[];L==="asc"&&(Mn=[...Mn].reverse());const cr=(c-1)*h;i(Mn.slice(cr,cr+h)),o(((Re=et.users)==null?void 0:Re.length)??0),Mn.length===0&&(P(!1),O("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else P(!1),O((et==null?void 0:et.error)||"RFM 加载失败,已切回普通模式")}else{const Xe=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...N==="vip"&&{vip:"true"},...N==="complete"&&{pool:"complete"}}),et=await Le(`/api/db/users?${Xe}`);et!=null&&et.success?(i(et.users||[]),o(et.total??0)):O((et==null?void 0:et.error)||"加载失败")}}catch(Xe){console.error("Load users error:",Xe),O("网络错误")}finally{C(!1),V&&T(!1)}}v.useEffect(()=>{u(1)},[y,N,D]),v.useEffect(()=>{ve()},[c,h,y,N,D,L]);const or=Math.ceil(a/h)||1,Hs=()=>{D?L==="desc"?_("asc"):(P(!1),_("desc")):(P(!0),_("desc"))},ki=V=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[V||""]||"bg-gray-500/20 text-gray-400";async function Si(V){if(confirm("确定要删除这个用户吗?"))try{const Re=await Ps(`/api/db/users?id=${encodeURIComponent(V)}`);Re!=null&&Re.success?ve():ae.error("删除失败: "+((Re==null?void 0:Re.error)||""))}catch{ae.error("删除失败")}}const Sr=V=>{U(V),Te({phone:V.phone||"",nickname:V.nickname||"",password:"",isAdmin:!!(V.isAdmin??!1),hasFullBook:!!(V.hasFullBook??!1)}),ee(!0)},Aa=()=>{U(null),Te({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),ee(!0)};async function _r(){if(!we.phone||!we.nickname){ae.error("请填写手机号和昵称");return}F(!0);try{if(Y){const V=await Mt("/api/db/users",{id:Y.id,phone:we.phone||void 0,nickname:we.nickname,isAdmin:we.isAdmin,hasFullBook:we.hasFullBook,...we.password&&{password:we.password}});if(!(V!=null&&V.success)){ae.error("更新失败: "+((V==null?void 0:V.error)||""));return}}else{const V=await wt("/api/db/users",{phone:we.phone,nickname:we.nickname,password:we.password,isAdmin:we.isAdmin});if(!(V!=null&&V.success)){ae.error("创建失败: "+((V==null?void 0:V.error)||""));return}}ee(!1),ve()}catch{ae.error("保存失败")}finally{F(!1)}}async function es(V){W(V),z(!0),H(!0);try{const Re=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(V.id)}`);Re!=null&&Re.success?G({referrals:Re.referrals||[],stats:Re.stats||{}}):G({referrals:[],stats:{}})}catch{G({referrals:[],stats:{}})}finally{H(!1)}}const lr=v.useCallback(async()=>{Pt(!0);try{const V=await Le("/api/db/user-rules");V!=null&&V.success&&He(V.rules||[])}catch{}finally{Pt(!1)}},[]);async function Ci(){if(!Pe.title){ae.error("请填写规则标题");return}F(!0);try{if(At){const V=await Mt("/api/db/user-rules",{id:At.id,...Pe});if(!(V!=null&&V.success)){ae.error("更新失败: "+((V==null?void 0:V.error)||""));return}}else{const V=await wt("/api/db/user-rules",Pe);if(!(V!=null&&V.success)){ae.error("创建失败: "+((V==null?void 0:V.error)||""));return}}ht(!1),lr()}catch{ae.error("保存失败")}finally{F(!1)}}async function Ia(V){if(confirm("确定删除?"))try{const Re=await Ps(`/api/db/user-rules?id=${V}`);Re!=null&&Re.success&&lr()}catch{}}async function Ws(V){try{await Mt("/api/db/user-rules",{id:V.id,enabled:!V.enabled}),lr()}catch{}}const ot=v.useCallback(async()=>{Nt(!0);try{const V=await Le("/api/db/vip-members?limit=500");if(V!=null&&V.success&&V.data){const Re=[...V.data].map((Xe,et)=>({...Xe,vipSort:typeof Xe.vipSort=="number"?Xe.vipSort:et+1}));Re.sort((Xe,et)=>(Xe.vipSort??999999)-(et.vipSort??999999)),ft(Re)}else V&&V.error&&ae.error(V.error)}catch{ae.error("加载超级个体列表失败")}finally{Nt(!1)}},[]),[Ln,ts]=v.useState(!1),[Cr,ns]=v.useState(null),[rn,zr]=v.useState(""),[Us,$r]=v.useState(!1),Ks=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],jn=V=>{ns(V),zr(V.vipRole||""),ts(!0)},rs=async V=>{const Re=V.trim();if(Cr){if(!Re){ae.error("请选择或输入标签");return}$r(!0);try{const Xe=await Mt("/api/db/users",{id:Cr.id,vipRole:Re});if(!(Xe!=null&&Xe.success)){ae.error((Xe==null?void 0:Xe.error)||"更新超级个体标签失败");return}ae.success("已更新超级个体标签"),ts(!1),ns(null),await ot()}catch{ae.error("更新超级个体标签失败")}finally{$r(!1)}}},[Hl,Ei]=v.useState(!1),[qs,mr]=v.useState(null),[Ra,Ti]=v.useState(""),[Gs,Ns]=v.useState(!1),Mi=V=>{mr(V),Ti(V.vipSort!=null?String(V.vipSort):""),Ei(!0)},To=async()=>{if(!qs)return;const V=Number(Ra);if(!Number.isFinite(V)){ae.error("请输入有效的数字序号");return}Ns(!0);try{const Re=await Mt("/api/db/users",{id:qs.id,vipSort:V});if(!(Re!=null&&Re.success)){ae.error((Re==null?void 0:Re.error)||"更新排序序号失败");return}ae.success("已更新排序序号"),Ei(!1),mr(null),await ot()}catch{ae.error("更新排序序号失败")}finally{Ns(!1)}},js=(V,Re)=>{V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",Re),Ot(Re)},Pa=(V,Re)=>{V.preventDefault(),Tn!==Re&&Dt(Re)},Mo=()=>{Ot(null),Dt(null)},Tt=async(V,Re)=>{V.preventDefault();const Xe=V.dataTransfer.getData("text/plain")||Xt;if(Ot(null),Dt(null),!Xe||Xe===Re)return;const et=xt.find(Jt=>Jt.id===Xe),Mn=xt.find(Jt=>Jt.id===Re);if(!et||!Mn)return;const cr=et.vipSort??xt.findIndex(Jt=>Jt.id===Xe)+1,Io=Mn.vipSort??xt.findIndex(Jt=>Jt.id===Re)+1;ft(Jt=>{const _n=[...Jt],ss=_n.findIndex(Ii=>Ii.id===Xe),Ss=_n.findIndex(Ii=>Ii.id===Re);if(ss===-1||Ss===-1)return Jt;const Ys=[..._n],[Wl,La]=[Ys[ss],Ys[Ss]];return Ys[ss]={...La,vipSort:cr},Ys[Ss]={...Wl,vipSort:Io},Ys});try{const[Jt,_n]=await Promise.all([Mt("/api/db/users",{id:Xe,vipSort:Io}),Mt("/api/db/users",{id:Re,vipSort:cr})]);if(!(Jt!=null&&Jt.success)||!(_n!=null&&_n.success)){ae.error((Jt==null?void 0:Jt.error)||(_n==null?void 0:_n.error)||"更新排序失败"),await ot();return}ae.success("已更新排序"),await ot()}catch{ae.error("更新排序失败"),await ot()}},Ao=v.useCallback(async()=>{me(!0);try{const V=await Le("/api/db/users/journey-stats");V!=null&&V.success&&V.stats&&Zr(V.stats)}catch{}finally{me(!1)}},[]);return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>O(null),children:"×"})]}),s.jsx("div",{className:"flex justify-between items-center mb-6",children:s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",a," 位注册用户",D&&" · RFM 排序中"]})]})}),s.jsxs(fd,{defaultValue:"users",className:"w-full",children:[s.jsxs(Ll,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(tn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Un,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Ao,children:[s.jsx(pl,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(tn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:lr,children:[s.jsx(so,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(tn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ot,children:[s.jsx(xl,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(nn,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(te,{variant:"outline",onClick:()=>ve(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:N,onChange:V=>{const Re=V.target.value;b(Re),u(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:D,children:[s.jsx("option",{value:"all",children:"全部用户"}),s.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),s.jsx("option",{value:"complete",children:"完善资料用户"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(oe,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:V=>g(V.target.value)})]}),s.jsxs(te,{onClick:Aa,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Eg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"用户信息"}),s.jsx(je,{className:"text-gray-400",children:"绑定信息"}),s.jsx(je,{className:"text-gray-400",children:"购买状态"}),s.jsx(je,{className:"text-gray-400",children:"分销收益"}),s.jsxs(je,{className:"text-gray-400 cursor-pointer select-none",onClick:Hs,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Oc,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),D?L==="desc"?s.jsx(Gc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(BN,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(wm,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),D&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(je,{className:"text-gray-400",children:"注册时间"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(nr,{children:[r.map(V=>{var Re,Xe,et;return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:V.avatar?s.jsx("img",{src:V.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Re=V.nickname)==null?void 0:Re.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{he(V.id),X(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:V.nickname}),V.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),V.openId&&!((Xe=V.id)!=null&&Xe.startsWith("user_"))&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsx("p",{className:"text-xs text-gray-500 font-mono",children:V.openId?V.openId.slice(0,12)+"...":(et=V.id)==null?void 0:et.slice(0,12)})]})]})}),s.jsx(xe,{children:s.jsxs("div",{className:"space-y-1",children:[V.phone&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"📱"}),s.jsx("span",{className:"text-gray-300",children:V.phone})]}),V.wechatId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"💬"}),s.jsx("span",{className:"text-gray-300",children:V.wechatId})]}),V.openId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"🔗"}),s.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:V.openId,children:[V.openId.slice(0,12),"..."]})]}),!V.phone&&!V.wechatId&&!V.openId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(xe,{children:V.hasFullBook?s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),s.jsx(xe,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(V.earnings||0)).toFixed(2)]}),parseFloat(String(V.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(V.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>es(V),role:"button",tabIndex:0,onKeyDown:Mn=>Mn.key==="Enter"&&es(V),children:[s.jsx(Un,{className:"w-3 h-3"})," 绑定",V.referralCount||0,"人"]})]})}),s.jsx(xe,{children:V.rfmScore!==void 0?s.jsx("div",{className:"flex flex-col gap-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:V.rfmScore}),s.jsx(Ue,{className:`border-0 text-xs ${ki(V.rfmLevel)}`,children:V.rfmLevel})]})}):s.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",s.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),s.jsx(xe,{className:"text-gray-400",children:V.createdAt?new Date(V.createdAt).toLocaleDateString():"-"}),s.jsx(xe,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{he(V.id),X(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(jg,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Sr(V),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(_t,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Si(V.id),title:"删除",children:s.jsx(Bn,{className:"w-4 h-4"})})]})})]},V.id)}),r.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(xs,{page:c,totalPages:or,total:a,pageSize:h,onPageChange:u,onPageSizeChange:V=>{f(V),u(1)}})]})})})]}),s.jsxs(nn,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(te,{variant:"outline",onClick:Ao,disabled:ar,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${ar?"animate-spin":""}`})," 刷新数据"]})]}),s.jsxs("div",{className:"relative mb-8",children:[s.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),s.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:Mu.map((V,Re)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${V.color} text-center cursor-default`,children:[s.jsx("div",{className:"text-2xl mb-1",children:V.icon}),s.jsx("div",{className:`text-xs font-medium ${V.color.split(" ").find(Xe=>Xe.startsWith("text-"))}`,children:V.label}),Kn[V.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Kn[V.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:Re+1})]}),Res.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:V.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:V.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",V.next]})]})]},V.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Yr,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),ar?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ge,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Kn).length>0?s.jsx("div",{className:"space-y-2",children:Mu.map(V=>{const Re=Kn[V.id]||0,Xe=Math.max(...Mu.map(Mn=>Kn[Mn.id]||0),1),et=Math.round(Re/Xe*100);return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[V.icon," ",V.label]}),s.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${et}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Re})]},V.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),s.jsxs(nn,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(te,{variant:"outline",onClick:lr,disabled:gt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${gt?"animate-spin":""}`})," 刷新"]}),s.jsxs(te,{onClick:()=>{ne(null),Qe({title:"",description:"",trigger:"",sort:0,enabled:!0}),ht(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),gt?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Ve.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Yr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(te,{onClick:lr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ge,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Ve.map(V=>s.jsx("div",{className:`p-4 rounded-lg border transition-all ${V.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.jsx(_t,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium",children:V.title}),V.trigger&&s.jsxs(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",V.trigger]}),s.jsx(Ue,{className:`text-xs border-0 ${V.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:V.enabled?"启用":"禁用"})]}),V.description&&s.jsx("p",{className:"text-gray-400 text-sm ml-6",children:V.description})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[s.jsx(Et,{checked:V.enabled,onCheckedChange:()=>Ws(V)}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{ne(V),Qe({title:V.title,description:V.description,trigger:V.trigger,sort:V.sort,enabled:V.enabled}),ht(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(_t,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Ia(V.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Bn,{className:"w-4 h-4"})})]})]})},V.id))})]}),s.jsxs(nn,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(te,{variant:"outline",onClick:ot,disabled:pt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${pt?"animate-spin":""}`})," ","刷新"]})})]}),pt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):xt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(xl,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:s.jsxs(er,{children:[s.jsx(tr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-16",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),s.jsx(je,{className:"text-gray-400 w-24",children:"排序值"}),s.jsx(je,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),s.jsx(nr,{children:xt.map((V,Re)=>{var Mn;const Xe=Xt===V.id,et=Tn===V.id;return s.jsxs(it,{draggable:!0,onDragStart:cr=>js(cr,V.id),onDragOver:cr=>Pa(cr,V.id),onDrop:cr=>Tt(cr,V.id),onDragEnd:Mo,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Xe?"opacity-60":""} ${et?"bg-[#38bdac]/10":""}`,children:[s.jsx(xe,{className:"text-gray-300",children:Re+1}),s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[V.avatar?s.jsx("img",{src:V.avatar,className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((Mn=V.name)==null?void 0:Mn[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:V.name})})]})}),s.jsx(xe,{className:"text-gray-300 whitespace-nowrap",children:V.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(xe,{className:"text-gray-300",children:V.vipSort??Re+1}),s.jsx(xe,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>jn(V),title:"设置超级个体标签",children:s.jsx(qu,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{he(V.id),X(!0)},title:"编辑资料",children:s.jsx(_t,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Mi(V),title:"设置排序序号",children:s.jsx(wm,{className:"w-3.5 h-3.5"})})]})})]},V.id)})})]})})})]})]}),s.jsx(Kt,{open:Hl,onOpenChange:V=>{Ei(V),V||mr(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(wm,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",qs==null?void 0:qs.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:Ra,onChange:V=>Ti(V.target.value)})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>Ei(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:To,disabled:Gs,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),Gs?"保存中...":"保存"]})]})]})}),s.jsx(Kt,{open:Ln,onOpenChange:V=>{ts(V),V||ns(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(xl,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Cr==null?void 0:Cr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Ks.map(V=>s.jsx(te,{variant:rn===V?"default":"outline",size:"sm",className:rn===V?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>zr(V),children:V},V))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:rn,onChange:V=>zr(V.target.value)})]})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>ts(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:()=>rs(rn),disabled:Us,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),Us?"保存中...":"保存"]})]})]})}),s.jsx(Kt,{open:J,onOpenChange:ee,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[Y?s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Eg,{className:"w-5 h-5 text-[#38bdac]"}),Y?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:we.phone,onChange:V=>Te({...we,phone:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:we.nickname,onChange:V=>Te({...we,nickname:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:Y?"新密码 (留空则不修改)":"密码"}),s.jsx(oe,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:Y?"留空则不修改":"请输入密码",value:we.password,onChange:V=>Te({...we,password:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Et,{checked:we.isAdmin,onCheckedChange:V=>Te({...we,isAdmin:V})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"已购全书"}),s.jsx(Et,{checked:we.hasFullBook,onCheckedChange:V=>Te({...we,hasFullBook:V})})]})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>ee(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:_r,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Kt,{open:yn,onOpenChange:ht,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(_t,{className:"w-5 h-5 text-[#38bdac]"}),At?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Pe.title,onChange:V=>Qe({...Pe,title:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则描述"}),s.jsx(_l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Pe.description,onChange:V=>Qe({...Pe,description:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"触发条件"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Pe.trigger,onChange:V=>Qe({...Pe,trigger:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(Z,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Et,{checked:Pe.enabled,onCheckedChange:V=>Qe({...Pe,enabled:V})})]})]}),s.jsxs(hn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>ht(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:Ci,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Kt,{open:re,onOpenChange:z,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(qt,{children:s.jsxs(Gt,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",ce==null?void 0:ce.nickname]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((Js=ie.stats)==null?void 0:Js.total)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Ai=ie.stats)==null?void 0:Ai.purchased)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((ks=ie.stats)==null?void 0:ks.earnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((Oa=ie.stats)==null?void 0:Oa.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),$?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ge,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Da=ie.referrals)==null?void 0:Da.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(ie.referrals??[]).map((V,Re)=>{var et;const Xe=V;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((et=Xe.nickname)==null?void 0:et.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Xe.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Xe.phone||(Xe.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Xe.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Xe.status==="paid"&&s.jsxs(Ue,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Xe.purchasedSections,"章"]}),Xe.status==="free"&&s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Xe.createdAt?new Date(Xe.createdAt).toLocaleDateString():""})]})]},Xe.id||Re)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(hn,{children:s.jsx(te,{variant:"outline",onClick:()=>z(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(Jx,{open:fe,onClose:()=>X(!1),userId:de,onUserUpdated:ve})]})}function uh(t,[e,n]){return Math.min(n,Math.max(e,t))}var xk=["PageUp","PageDown"],yk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],vk={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},zl="Slider",[Rg,uP,hP]=Ux(zl),[bk]=ka(zl,[hP]),[fP,gf]=bk(zl),wk=v.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:a=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:w,...N}=t,b=v.useRef(new Set),k=v.useRef(0),E=o==="horizontal"?pP:mP,[T=[],I]=fo({prop:f,defaultProp:h,onChange:J=>{var Y;(Y=[...b.current][k.current])==null||Y.focus(),m(J)}}),O=v.useRef(T);function D(J){const ee=bP(T,J);_(J,ee)}function P(J){_(J,k.current)}function L(){const J=O.current[k.current];T[k.current]!==J&&g(T)}function _(J,ee,{commit:Y}={commit:!1}){const U=kP(a),R=SP(Math.round((J-r)/a)*a+r,U),F=uh(R,[r,i]);I((re=[])=>{const z=yP(re,F,ee);if(jP(z,u*a)){k.current=z.indexOf(F);const ie=String(z)!==String(re);return ie&&Y&&g(z),ie?z:re}else return re})}return s.jsx(fP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:k,thumbs:b.current,values:T,orientation:o,form:w,children:s.jsx(Rg.Provider,{scope:t.__scopeSlider,children:s.jsx(Rg.Slot,{scope:t.__scopeSlider,children:s.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...N,ref:e,onPointerDown:at(N.onPointerDown,()=>{c||(O.current=T)}),min:r,max:i,inverted:y,onSlideStart:c?void 0:D,onSlideMove:c?void 0:P,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&_(r,0,{commit:!0}),onEndKeyDown:()=>!c&&_(i,T.length-1,{commit:!0}),onStepKeyDown:({event:J,direction:ee})=>{if(!c){const R=xk.includes(J.key)||J.shiftKey&&yk.includes(J.key)?10:1,F=k.current,re=T[F],z=a*R*ee;_(re+z,F,{commit:!0})}}})})})})});wk.displayName=zl;var[Nk,jk]=bk(zl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),pP=v.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=v.useState(null),y=St(e,E=>g(E)),w=v.useRef(void 0),N=ff(i),b=N==="ltr",k=b&&!a||!b&&a;function C(E){const T=w.current||m.getBoundingClientRect(),I=[0,T.width],D=Qx(I,k?[n,r]:[r,n]);return w.current=T,D(E-T.left)}return s.jsx(Nk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(kk,{dir:N,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const T=C(E.clientX);o==null||o(T)},onSlideMove:E=>{const T=C(E.clientX);c==null||c(T)},onSlideEnd:()=>{w.current=void 0,u==null||u()},onStepKeyDown:E=>{const I=vk[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:I?-1:1})}})})}),mP=v.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=v.useRef(null),m=St(e,f),g=v.useRef(void 0),y=!i;function w(N){const b=g.current||f.current.getBoundingClientRect(),k=[0,b.height],E=Qx(k,y?[r,n]:[n,r]);return g.current=b,E(N-b.top)}return s.jsx(Nk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(kk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const b=w(N.clientY);a==null||a(b)},onSlideMove:N=>{const b=w(N.clientY);o==null||o(b)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:N=>{const k=vk[y?"from-bottom":"from-top"].includes(N.key);u==null||u({event:N,direction:k?-1:1})}})})}),kk=v.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=gf(zl,n);return s.jsx(dt.span,{...h,ref:e,onKeyDown:at(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):xk.concat(yk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:at(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:at(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&i(m)}),onPointerUp:at(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),a(m))})})}),Sk="SliderTrack",Ck=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=gf(Sk,n);return s.jsx(dt.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});Ck.displayName=Sk;var Pg="SliderRange",Ek=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=gf(Pg,n),a=jk(Pg,n),o=v.useRef(null),c=St(e,o),u=i.values.length,h=i.values.map(g=>Ak(g,i.min,i.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(dt.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[a.startEdge]:f+"%",[a.endEdge]:m+"%"}})});Ek.displayName=Pg;var Og="SliderThumb",Tk=v.forwardRef((t,e)=>{const n=uP(t.__scopeSlider),[r,i]=v.useState(null),a=St(e,c=>i(c)),o=v.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(gP,{...t,ref:a,index:o})}),gP=v.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...a}=t,o=gf(Og,n),c=jk(Og,n),[u,h]=v.useState(null),f=St(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=Gx(u),y=o.values[r],w=y===void 0?0:Ak(y,o.min,o.max),N=vP(r,o.values.length),b=g==null?void 0:g[c.size],k=b?wP(b,w,c.direction):0;return v.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${w}% + ${k}px)`},children:[s.jsx(Rg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(dt.span,{role:"slider","aria-label":t["aria-label"]||N,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...a,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:at(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(Mk,{name:i??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Tk.displayName=Og;var xP="RadioBubbleInput",Mk=v.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const i=v.useRef(null),a=St(i,r),o=qx(e);return v.useEffect(()=>{const c=i.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(dt.input,{style:{display:"none"},...n,ref:a,defaultValue:e})});Mk.displayName=xP;function yP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,a)=>i-a)}function Ak(t,e,n){const a=100/(n-e)*(t-e);return uh(a,[0,100])}function vP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function bP(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function wP(t,e,n){const r=t/2,a=Qx([0,50],[0,r]);return(r-a(e)*n)*n}function NP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function jP(t,e){if(e>0){const n=NP(t);return Math.min(...n)>=e}return!0}function Qx(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function kP(t){return(String(t).split(".")[1]||"").length}function SP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var CP=wk,EP=Ck,TP=Ek,MP=Tk;function AP({className:t,defaultValue:e,value:n,min:r=0,max:i=100,...a}){const o=v.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,i],[n,e,r,i]);return s.jsxs(CP,{defaultValue:e,value:n,min:r,max:i,className:Ct("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...a,children:[s.jsx(EP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(TP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(MP,{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"},u))]})}const IP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function Ik(t){const[e,n]=v.useState(IP),[r,i]=v.useState(!0),[a,o]=v.useState(!1);v.useEffect(()=>{Le("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await wt("/api/admin/referral-settings",h);if(!f||f.success===!1){ae.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}ae.success(`✅ 分销配置已保存成功!
+For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},ER="DialogDescriptionWarning",TR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Hj(ER).contentName}}.`;return v.useEffect(()=>{var a;const i=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},MR=Aj,AR=Pj,IR=Oj,RR=Dj,PR=_j,OR=$j,DR=Bj;function Yt(t){return s.jsx(MR,{"data-slot":"dialog",...t})}function LR(t){return s.jsx(AR,{...t})}const Wj=v.forwardRef(({className:t,...e},n)=>s.jsx(IR,{ref:n,className:Mt("fixed inset-0 z-50 bg-black/50",t),...e}));Wj.displayName="DialogOverlay";const Bt=v.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},i)=>s.jsxs(LR,{children:[s.jsx(Wj,{}),s.jsxs(RR,{ref:i,"aria-describedby":void 0,className:Mt("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",t),...r,children:[e,n&&s.jsxs(DR,{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:[s.jsx(er,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Bt.displayName="DialogContent";function Qt({className:t,...e}){return s.jsx("div",{className:Mt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function fn({className:t,...e}){return s.jsx("div",{className:Mt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Xt(t){return s.jsx(PR,{className:"text-lg font-semibold leading-none",...t})}function Ux(t){return s.jsx(OR,{className:"text-sm text-muted-foreground",...t})}const _R=rj("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 Ue({className:t,variant:e,asChild:n=!1,...r}){const i=n?ej:"span";return s.jsx(i,{className:Mt(_R({variant:e}),t),...r})}var zR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$R=zR.reduce((t,e)=>{const n=ZN(`Primitive.${e}`),r=v.forwardRef((i,a)=>{const{asChild:o,...c}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),FR="Label",Uj=v.forwardRef((t,e)=>s.jsx($R.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Uj.displayName=FR;var Kj=Uj;const Z=v.forwardRef(({className:t,...e},n)=>s.jsx(Kj,{ref:n,className:Mt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Z.displayName=Kj.displayName;function Kx(t){const e=t+"CollectionProvider",[n,r]=Sa(e),[i,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=N=>{const{scope:b,children:k}=N,C=pr.useRef(null),E=pr.useRef(new Map).current;return s.jsx(i,{scope:b,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Yc(c),h=pr.forwardRef((N,b)=>{const{scope:k,children:C}=N,E=a(c,k),T=Tt(b,E.collectionRef);return s.jsx(u,{ref:T,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Yc(f),y=pr.forwardRef((N,b)=>{const{scope:k,children:C,...E}=N,T=pr.useRef(null),I=Tt(b,T),O=a(f,k);return pr.useEffect(()=>(O.itemMap.set(T,{ref:T,...E}),()=>void O.itemMap.delete(T))),s.jsx(g,{[m]:"",ref:I,children:C})});y.displayName=f;function w(N){const b=a(t+"CollectionConsumer",N);return pr.useCallback(()=>{const C=b.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(b.itemMap.values()).sort((O,D)=>E.indexOf(O.ref.current)-E.indexOf(D.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},w,r]}var BR=v.createContext(void 0);function pf(t){const e=v.useContext(BR);return t||e||"ltr"}var Om="rovingFocusGroup.onEntryFocus",VR={bubbles:!1,cancelable:!0},fd="RovingFocusGroup",[Rg,qj,HR]=Kx(fd),[WR,Gj]=Sa(fd,[HR]),[UR,KR]=WR(fd),Jj=v.forwardRef((t,e)=>s.jsx(Rg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Rg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(qR,{...t,ref:e})})}));Jj.displayName=fd;var qR=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=v.useRef(null),y=Tt(e,g),w=pf(a),[N,b]=po({prop:o,defaultProp:c??null,onChange:u,caller:fd}),[k,C]=v.useState(!1),E=xa(h),T=qj(n),I=v.useRef(!1),[O,D]=v.useState(0);return v.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Om,E),()=>P.removeEventListener(Om,E)},[E]),s.jsx(UR,{scope:n,orientation:r,dir:w,loop:i,currentTabStopId:N,onItemFocus:v.useCallback(P=>b(P),[b]),onItemShiftTab:v.useCallback(()=>C(!0),[]),onFocusableItemAdd:v.useCallback(()=>D(P=>P+1),[]),onFocusableItemRemove:v.useCallback(()=>D(P=>P-1),[]),children:s.jsx(ht.div,{tabIndex:k||O===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:ot(t.onMouseDown,()=>{I.current=!0}),onFocus:ot(t.onFocus,P=>{const L=!I.current;if(P.target===P.currentTarget&&L&&!k){const _=new CustomEvent(Om,VR);if(P.currentTarget.dispatchEvent(_),!_.defaultPrevented){const J=T().filter(F=>F.focusable),ee=J.find(F=>F.active),Y=J.find(F=>F.id===N),R=[ee,Y,...J].filter(Boolean).map(F=>F.ref.current);Xj(R,f)}}I.current=!1}),onBlur:ot(t.onBlur,()=>C(!1))})})}),Yj="RovingFocusGroupItem",Qj=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...c}=t,u=ha(),h=a||u,f=KR(Yj,n),m=f.currentTabStopId===h,g=qj(n),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:N}=f;return v.useEffect(()=>{if(r)return y(),()=>w()},[r,y,w]),s.jsx(Rg.ItemSlot,{scope:n,id:h,focusable:r,active:i,children:s.jsx(ht.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:ot(t.onMouseDown,b=>{r?f.onItemFocus(h):b.preventDefault()}),onFocus:ot(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:ot(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){f.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const k=YR(b,f.orientation,f.dir);if(k!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const T=E.indexOf(b.currentTarget);E=f.loop?QR(E,T+1):E.slice(T+1)}setTimeout(()=>Xj(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:N!=null}):o})})});Qj.displayName=Yj;var GR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function YR(t,e,n){const r=JR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GR[r]}function Xj(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function QR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var XR=Jj,ZR=Qj,mf="Tabs",[eP]=Sa(mf,[Gj]),Zj=Gj(),[tP,qx]=eP(mf),ek=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=pf(c),[m,g]=po({prop:r,onChange:i,defaultProp:a??"",caller:mf});return s.jsx(tP,{scope:n,baseId:ha(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(ht.div,{dir:f,"data-orientation":o,...h,ref:e})})});ek.displayName=mf;var tk="TabsList",nk=v.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,a=qx(tk,n),o=Zj(n);return s.jsx(XR,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:s.jsx(ht.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:e})})});nk.displayName=tk;var rk="TabsTrigger",sk=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=t,o=qx(rk,n),c=Zj(n),u=ok(o.baseId,r),h=lk(o.baseId,r),f=r===o.value;return s.jsx(ZR,{asChild:!0,...c,focusable:!i,active:f,children:s.jsx(ht.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...a,ref:e,onMouseDown:ot(t.onMouseDown,m=>{!i&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:ot(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:ot(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!i&&m&&o.onValueChange(r)})})})});sk.displayName=rk;var ik="TabsContent",ak=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=t,c=qx(ik,n),u=ok(c.baseId,r),h=lk(c.baseId,r),f=r===c.value,m=v.useRef(f);return v.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(hd,{present:i||f,children:({present:g})=>s.jsx(ht.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&a})})});ak.displayName=ik;function ok(t,e){return`${t}-trigger-${e}`}function lk(t,e){return`${t}-content-${e}`}var nP=ek,ck=nk,dk=sk,uk=ak;const pd=nP,Ol=v.forwardRef(({className:t,...e},n)=>s.jsx(ck,{ref:n,className:Mt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Ol.displayName=ck.displayName;const an=v.forwardRef(({className:t,...e},n)=>s.jsx(dk,{ref:n,className:Mt("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",t),...e}));an.displayName=dk.displayName;const on=v.forwardRef(({className:t,...e},n)=>s.jsx(uk,{ref:n,className:Mt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));on.displayName=uk.displayName;function Gx(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function Jx(t){const[e,n]=v.useState(void 0);return tr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let o,c;if("borderBoxSize"in a){const u=a.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var gf="Switch",[rP]=Sa(gf),[sP,iP]=rP(gf),hk=v.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=v.useState(null),w=Tt(e,E=>y(E)),N=v.useRef(!1),b=g?f||!!g.closest("form"):!0,[k,C]=po({prop:i,defaultProp:a??!1,onChange:h,caller:gf});return s.jsxs(sP,{scope:n,checked:k,disabled:c,children:[s.jsx(ht.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":gk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:w,onClick:ot(t.onClick,E=>{C(T=>!T),b&&(N.current=E.isPropagationStopped(),N.current||E.stopPropagation())})}),b&&s.jsx(mk,{control:g,bubbles:!N.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});hk.displayName=gf;var fk="SwitchThumb",pk=v.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=iP(fk,n);return s.jsx(ht.span,{"data-state":gk(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});pk.displayName=fk;var aP="SwitchBubbleInput",mk=v.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...i},a)=>{const o=v.useRef(null),c=Tt(o,a),u=Gx(n),h=Jx(e);return v.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const w=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(w)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:c,style:{...i.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});mk.displayName=aP;function gk(t){return t?"checked":"unchecked"}var xk=hk,oP=pk;const At=v.forwardRef(({className:t,...e},n)=>s.jsx(xk,{className:Mt("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]",t),...e,ref:n,children:s.jsx(oP,{className:Mt("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")})}));At.displayName=xk.displayName;function Yx({open:t,onClose:e,userId:n,onUserUpdated:r}){var lr;const[i,a]=v.useState(null),[o,c]=v.useState([]),[u,h]=v.useState([]),[f,m]=v.useState(!1),[g,y]=v.useState(!1),[w,N]=v.useState(!1),[b,k]=v.useState("info"),[C,E]=v.useState(""),[T,I]=v.useState(""),[O,D]=v.useState([]),[P,L]=v.useState(""),[_,J]=v.useState(""),[ee,Y]=v.useState(""),[U,R]=v.useState(!1),[F,re]=v.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[z,ie]=v.useState([]),[G,$]=v.useState(!1),[V,ce]=v.useState(!1),[W,fe]=v.useState(null),[X,de]=v.useState(null),[he,be]=v.useState(""),[Te,Ve]=v.useState(""),[He,vt]=v.useState(""),[Dt,vn]=v.useState(!1),[pt,Rt]=v.useState(null),[ne,Pe]=v.useState("");v.useEffect(()=>{t&&n&&(k("info"),fe(null),de(null),Rt(null),Pe(""),J(""),Y(""),Ze(),Le("/api/db/vip-roles").then(me=>{me!=null&&me.success&&me.data&&ie(me.data)}).catch(()=>{}))},[t,n]);async function Ze(){if(n){m(!0);try{const me=await Le(`/api/db/users?id=${encodeURIComponent(n)}`);if(me!=null&&me.success&&me.user){const ye=me.user;a(ye),E(ye.phone||""),I(ye.nickname||""),be(ye.phone||""),Ve(ye.wechatId||""),vt(ye.openId||"");try{D(typeof ye.tags=="string"?JSON.parse(ye.tags||"[]"):[])}catch{D([])}re({isVip:!!(ye.isVip??!1),vipExpireDate:ye.vipExpireDate?String(ye.vipExpireDate).slice(0,10):"",vipRole:String(ye.vipRole??""),vipName:String(ye.vipName??""),vipProject:String(ye.vipProject??""),vipContact:String(ye.vipContact??""),vipBio:String(ye.vipBio??"")})}try{const ye=await Le(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);ye!=null&&ye.success&&ye.tracks&&c(ye.tracks)}catch{c([])}try{const ye=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ye!=null&&ye.success&&ye.referrals&&h(ye.referrals)}catch{h([])}}catch(me){console.error("Load user detail error:",me)}finally{m(!1)}}}async function bt(){if(!(i!=null&&i.phone)){ae.info("用户未绑定手机号,无法同步");return}y(!0);try{const me=await yt("/api/ckb/sync",{action:"full_sync",phone:i.phone,userId:i.id});me!=null&&me.success?(ae.success("同步成功"),Ze()):ae.error("同步失败: "+(me==null?void 0:me.error))}catch(me){console.error("Sync CKB error:",me),ae.error("同步失败")}finally{y(!1)}}async function mt(){if(i){N(!0);try{const me={id:i.id,phone:C||void 0,nickname:T||void 0,tags:JSON.stringify(O)},ye=await It("/api/db/users",me);ye!=null&&ye.success?(ae.success("保存成功"),Ze(),r==null||r()):ae.error("保存失败: "+(ye==null?void 0:ye.error))}catch(me){console.error("Save user error:",me),ae.error("保存失败")}finally{N(!1)}}}const gt=()=>{P&&!O.includes(P)&&(D([...O,P]),L(""))},St=me=>D(O.filter(ye=>ye!==me));async function nn(){if(i){if(!_){ae.error("请输入新密码");return}if(_!==ee){ae.error("两次密码不一致");return}if(_.length<6){ae.error("密码至少 6 位");return}R(!0);try{const me=await It("/api/db/users",{id:i.id,password:_});me!=null&&me.success?(ae.success("修改成功"),J(""),Y("")):ae.error("修改失败: "+((me==null?void 0:me.error)||""))}catch{ae.error("修改失败")}finally{R(!1)}}}async function Lt(){if(i){if(F.isVip&&!F.vipExpireDate.trim()){ae.error("开启 VIP 请填写有效到期日");return}$(!0);try{const me={id:i.id,isVip:F.isVip,vipExpireDate:F.isVip?F.vipExpireDate:void 0,vipRole:F.vipRole||void 0,vipName:F.vipName||void 0,vipProject:F.vipProject||void 0,vipContact:F.vipContact||void 0,vipBio:F.vipBio||void 0},ye=await It("/api/db/users",me);ye!=null&&ye.success?(ae.success("VIP 设置已保存"),Ze(),r==null||r()):ae.error("保存失败: "+((ye==null?void 0:ye.error)||""))}catch{ae.error("保存失败")}finally{$(!1)}}}async function An(){if(!he&&!He&&!Te){de("请至少输入手机号、微信号或 OpenID 中的一项");return}ce(!0),de(null),fe(null);try{const me=new URLSearchParams;he&&me.set("phone",he),He&&me.set("openId",He),Te&&me.set("wechatId",Te);const ye=await Le(`/api/admin/shensheshou/query?${me}`);ye!=null&&ye.success&&ye.data?(fe(ye.data),i&&await _t(ye.data)):de((ye==null?void 0:ye.error)||"未查询到数据,该用户可能未在神射手收录")}catch(me){console.error("SSS query error:",me),de("请求失败,请检查神射手接口配置")}finally{ce(!1)}}async function _t(me){if(i)try{await yt("/api/admin/shensheshou/enrich",{userId:i.id,phone:he||i.phone||"",openId:He||i.openId||"",wechatId:Te||i.wechatId||""}),Ze()}catch(ye){console.error("SSS enrich error:",ye)}}async function Gn(){if(i){vn(!0),Rt(null);try{const me={users:[{phone:i.phone||"",name:i.nickname||"",openId:i.openId||"",tags:O}]},ye=await yt("/api/admin/shensheshou/ingest",me);ye!=null&&ye.success&&ye.data?Rt(ye.data):Rt({error:(ye==null?void 0:ye.error)||"推送失败"})}catch(me){console.error("SSS ingest error:",me),Rt({error:"请求失败"})}finally{vn(!1)}}}const ts=me=>{const cr={view_chapter:Xr,purchase:Eg,match:qn,login:gl,register:gl,share:ys,bind_phone:dA,bind_wechat:ZM,fill_profile:Gu,visit_page:hl}[me]||jg;return s.jsx(cr,{className:"w-4 h-4"})};return t?s.jsx(Yt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(gl,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(i==null?void 0:i.phone)&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(i==null?void 0:i.isVip)&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i?s.jsxs("div",{className:"flex flex-col h-[75vh]",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:i.avatar?s.jsx("img",{src:i.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((lr=i.nickname)==null?void 0:lr.charAt(0))||"?"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h3",{className:"text-lg font-bold text-white",children:i.nickname}),i.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),i.hasFullBook&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),i.vipRole&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:i.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[i.phone?`📱 ${i.phone}`:"未绑定手机",i.wechatId&&` · 💬 ${i.wechatId}`,i.mbti&&` · ${i.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",i.id.slice(0,16),"…"]}),i.referralCode&&s.jsxs("p",{className:"text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"推广码:"}),s.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:i.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(i.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(pd,{value:b,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs(Ol,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[s.jsx(an,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),s.jsx(an,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),s.jsxs(an,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(hl,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),s.jsx(an,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),s.jsxs(an,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(aa,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),s.jsxs(on,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:C,onChange:me=>E(me.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:T,onChange:me=>I(me.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[i.openId&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),s.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:i.openId})]}),i.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(JN,{className:"w-4 h-4 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),s.jsx("p",{className:"text-white",children:i.region})]})]}),i.industry&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),s.jsx("p",{className:"text-white",children:i.industry})]}),i.position&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),s.jsx("p",{className:"text-white",children:i.position})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:i.referralCount??0})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),s.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(i.pendingEarnings??0).toFixed(2)]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),s.jsx("p",{className:"text-sm text-white",children:i.createdAt?new Date(i.createdAt).toLocaleDateString():"-"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(LM,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(oe,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:_,onChange:me=>J(me.target.value)}),s.jsx(oe,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:ee,onChange:me=>Y(me.target.value)}),s.jsx(te,{size:"sm",onClick:nn,disabled:U||!_||!ee,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:U?"保存中...":"确认修改"})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ml,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-400 text-sm",children:"VIP 会员"}),s.jsx(At,{checked:F.isVip,onCheckedChange:me=>re(ye=>({...ye,isVip:me}))})]}),F.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(oe,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:F.vipExpireDate,onChange:me=>re(ye=>({...ye,vipExpireDate:me.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:F.vipRole,onChange:me=>re(ye=>({...ye,vipRole:me.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),z.map(me=>s.jsx("option",{value:me.name,children:me.name},me.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:F.vipName,onChange:me=>re(ye=>({...ye,vipName:me.target.value}))})]}),s.jsx(te,{size:"sm",onClick:Lt,disabled:G,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:G?"保存中...":"保存 VIP"})]})]})]}),i.isVip&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ml,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:i.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[i.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:i.vipName})]}),i.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:i.vipProject})]}),i.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:i.vipContact})]}),i.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(i.vipExpireDate).toLocaleDateString()})]})]}),i.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:i.vipBio})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ho,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"微信归属"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:ne,onChange:me=>Pe(me.target.value)}),s.jsxs(te,{size:"sm",onClick:async()=>{if(!(!ne||!i))try{await It("/api/db/users",{id:i.id,wechatId:ne}),ae.success("已保存微信归属"),Ze()}catch{ae.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[s.jsx(xn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),i.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:i.wechatId})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ys,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(te,{size:"sm",onClick:bt,disabled:g||!i.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"同步状态:"}),i.ckbSyncedAt?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"最后同步:"}),s.jsx("span",{className:"text-gray-300 ml-1",children:i.ckbSyncedAt?new Date(i.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),s.jsxs(on,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Gu,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),s.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[s.jsx(Ng,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),s.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(me=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:me.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:me.tags.map(ye=>s.jsxs("button",{type:"button",onClick:()=>{O.includes(ye)?St(ye):D([...O,ye])},className:`px-2 py-0.5 rounded text-xs border transition-all ${O.includes(ye)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[O.includes(ye)?"✓ ":"",ye]},ye))})]},me.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[O.map((me,ye)=>s.jsxs(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[me,s.jsx("button",{type:"button",onClick:()=>St(me),className:"ml-1 hover:text-red-400",children:s.jsx(er,{className:"w-3 h-3"})})]},ye)),O.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:P,onChange:me=>L(me.target.value),onKeyDown:me=>me.key==="Enter"&>()}),s.jsx(te,{onClick:gt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),i.ckbTags&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Gu,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof i.ckbTags=="string"?i.ckbTags.split(","):[]).map((me,ye)=>s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:me.trim()},ye))})]})]}),s.jsxs(on,{value:"journey",className:"flex-1 overflow-auto",children:[s.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(hl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),s.jsx("div",{className:"space-y-2",children:o.length>0?o.map((me,ye)=>s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:ts(me.action)}),ye0?u.map((me,ye)=>{var Vs;const cr=me;return s.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((Vs=cr.nickname)==null?void 0:Vs.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:cr.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[cr.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-xs",children:cr.createdAt?new Date(cr.createdAt).toLocaleDateString():""})]})]},cr.id||ye)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),s.jsxs(on,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(aa,{className:"w-5 h-5 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:he,onChange:me=>be(me.target.value)})]}),s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:Te,onChange:me=>Ve(me.target.value)})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),s.jsx(oe,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:He,onChange:me=>vt(me.target.value)})]})]}),s.jsx(te,{onClick:An,disabled:V,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:V?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ua,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),X&&s.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:X}),W&&s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),s.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:W.rfm_score??"-"})]}),s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:W.user_level??"-"})]})]}),W.tags&&W.tags.length>0&&s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:W.tags.map((me,ye)=>s.jsx(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:me},ye))})]}),W.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",W.last_active]})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx(aa,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),s.jsx(te,{onClick:Gn,disabled:Dt||!i.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Dt?s.jsxs(s.Fragment,{children:[s.jsx(Je,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(aa,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!i.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),pt&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:pt.error?s.jsx("p",{className:"text-red-400",children:String(pt.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(Ng,{className:"w-4 h-4"})," 推送成功"]}),pt.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(pt.new_tags_added??0)]})]})})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[s.jsxs(te,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(te,{onClick:mt,disabled:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),w?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function lP(){const t=ka(),[e,n]=v.useState(!0),[r,i]=v.useState(!0),[a,o]=v.useState(!0),[c,u]=v.useState([]),[h,f]=v.useState([]),[m,g]=v.useState(0),[y,w]=v.useState(0),[N,b]=v.useState(0),[k,C]=v.useState(0),[E,T]=v.useState(null),[I,O]=v.useState(null),[D,P]=v.useState(!1),L=U=>{const R=U;if((R==null?void 0:R.status)===401)T("登录已过期,请重新登录");else{if((R==null?void 0:R.name)==="AbortError")return;T("加载失败,请检查网络或联系管理员")}};async function _(U){const R=U?{signal:U}:void 0;n(!0),T(null);try{const z=await Le("/api/admin/dashboard/stats",R);z!=null&&z.success&&(g(z.totalUsers??0),w(z.paidOrderCount??0),b(z.totalRevenue??0),C(z.conversionRate??0))}catch(z){if((z==null?void 0:z.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",z);try{const ie=await Le("/api/admin/dashboard/overview",R);ie!=null&&ie.success&&(g(ie.totalUsers??0),w(ie.paidOrderCount??0),b(ie.totalRevenue??0),C(ie.conversionRate??0))}catch(ie){L(ie)}}}finally{n(!1)}i(!0),o(!0);const F=async()=>{try{const z=await Le("/api/admin/dashboard/recent-orders",R);if(z!=null&&z.success&&z.recentOrders)f(z.recentOrders);else throw new Error("no data")}catch(z){if((z==null?void 0:z.name)!=="AbortError")try{const ie=await Le("/api/admin/orders?page=1&pageSize=20&status=paid",R),$=((ie==null?void 0:ie.orders)??[]).filter(V=>["paid","completed","success"].includes(V.status||""));f($.slice(0,5))}catch{f([])}}finally{i(!1)}},re=async()=>{try{const z=await Le("/api/admin/dashboard/new-users",R);if(z!=null&&z.success&&z.newUsers)u(z.newUsers);else throw new Error("no data")}catch(z){if((z==null?void 0:z.name)!=="AbortError")try{const ie=await Le("/api/db/users?page=1&pageSize=10",R);u((ie==null?void 0:ie.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([F(),re()])}v.useEffect(()=>{const U=new AbortController;_(U.signal);const R=setInterval(()=>_(),3e4);return()=>{U.abort(),clearInterval(R)}},[]);const J=m,ee=U=>{const R=U.productType||"",F=U.description||"";if(F){if(R==="section"&&F.includes("章节")){if(F.includes("-")){const re=F.split("-");if(re.length>=3)return{title:`第${re[1]}章 第${re[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:F,subtitle:"章节购买"}}return R==="fullbook"||F.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:R==="match"||F.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:F,subtitle:R==="section"?"单章":R==="fullbook"?"全书":"其他"}}return R==="section"?{title:`章节 ${U.productId||""}`,subtitle:"单章购买"}:R==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:R==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:R||"其他"}},Y=[{title:"总用户数",value:e?null:J,icon:qn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(N??0).toFixed(2)}`,icon:Dc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,icon:Eg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,icon:Xr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),E&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:E}),s.jsx("button",{type:"button",onClick:()=>_(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:Y.map((U,R)=>s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>U.link&&t(U.link),children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(st,{className:"text-sm font-medium text-gray-400",children:U.title}),s.jsx("div",{className:`p-2 rounded-lg ${U.bg}`,children:s.jsx(U.icon,{className:`w-4 h-4 ${U.color}`})})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-[2rem] flex items-center",children:U.value!=null?U.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Je,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),s.jsx(ul,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},R))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsx(st,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>_(),disabled:r||a,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||a?s.jsx(Je,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Je,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Je,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,5).map(U=>{var ie;const R=U.referrerId?c.find(G=>G.id===U.referrerId):void 0,F=U.referralCode||(R==null?void 0:R.referralCode)||(R==null?void 0:R.nickname)||(U.referrerId?String(U.referrerId).slice(0,8):""),re=ee(U),z=U.userNickname||((ie=c.find(G=>G.id===U.userId))==null?void 0:ie.nickname)||"匿名用户";return s.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:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[U.userAvatar?s.jsx("img",{src:U.userAvatar,alt:z,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:G=>{G.currentTarget.style.display="none";const $=G.currentTarget.nextElementSibling;$&&$.classList.remove("hidden")}}):null,s.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 ${U.userAvatar?"hidden":""}`,children:z.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{U.userId&&(O(U.userId),P(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:z}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",children:re.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[re.subtitle&&re.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:re.subtitle}),s.jsx("span",{children:new Date(U.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),F&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",F]})]})]}),s.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(U.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:U.paymentMethod||"微信"})]})]},U.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Eg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{children:s.jsx(st,{className:"text-white",children:"新注册用户"})}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-3",children:a&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Je,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(U=>{var R;return s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((R=U.nickname)==null?void 0:R.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{O(U.id),P(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:U.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:U.phone||"-"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:U.createdAt?new Date(U.createdAt).toLocaleDateString():"-"})]},U.id)}),c.length===0&&!a&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsx(Yx,{open:D,onClose:()=>{P(!1),O(null)},userId:I,onUserUpdated:()=>_()})]})}const nr=v.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Mt("w-full caption-bottom text-sm",t),...e})}));nr.displayName="Table";const rr=v.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Mt("[&_tr]:border-b",t),...e}));rr.displayName="TableHeader";const sr=v.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Mt("[&_tr:last-child]:border-0",t),...e}));sr.displayName="TableBody";const it=v.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Mt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));it.displayName="TableRow";const je=v.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Mt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableHead";const xe=v.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Mt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));xe.displayName="TableCell";function Qx(t,e){const[n,r]=v.useState(t);return v.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}function vs({page:t,totalPages:e,total:n,pageSize:r,onPageChange:i,onPageSizeChange:a,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!a?null:s.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[s.jsxs("span",{children:["共 ",n," 条"]}),a&&s.jsx("select",{value:r,onChange:c=>a(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>s.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>i(1),disabled:t<=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:"首页"}),s.jsx("button",{type:"button",onClick:()=>i(t-1),disabled:t<=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:"上一页"}),s.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),s.jsx("button",{type:"button",onClick:()=>i(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),s.jsx("button",{type:"button",onClick:()=>i(e),disabled:t>=e,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 cP(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[i,a]=v.useState(0),[o,c]=v.useState(0),[u,h]=v.useState(0),[f,m]=v.useState(1),[g,y]=v.useState(10),[w,N]=v.useState(""),b=Qx(w,300),[k,C]=v.useState("all"),[E,T]=v.useState(!0),[I,O]=v.useState(null),[D,P]=v.useState(null),[L,_]=v.useState(""),[J,ee]=v.useState(!1);async function Y(){T(!0),O(null);try{const G=k==="all"?"":k==="completed"?"completed":k,$=new URLSearchParams({page:String(f),pageSize:String(g),...G&&{status:G},...b&&{search:b}}),[V,ce]=await Promise.all([Le(`/api/admin/orders?${$}`),Le("/api/db/users?page=1&pageSize=500")]);V!=null&&V.success&&(e(V.orders||[]),a(V.total??0),c(V.totalRevenue??0),h(V.todayRevenue??0)),ce!=null&&ce.success&&ce.users&&r(ce.users)}catch(G){console.error("加载订单失败",G),O("加载订单失败,请检查网络后重试")}finally{T(!1)}}v.useEffect(()=>{m(1)},[b,k]),v.useEffect(()=>{Y()},[f,g,b,k]);const U=G=>{var $;return G.userNickname||(($=n.find(V=>V.id===G.userId))==null?void 0:$.nickname)||"匿名用户"},R=G=>{var $;return(($=n.find(V=>V.id===G))==null?void 0:$.phone)||"-"},F=G=>{const $=G.productType||G.type||"",V=G.description||"";if(V){if($==="section"&&V.includes("章节")){if(V.includes("-")){const ce=V.split("-");if(ce.length>=3)return{name:`第${ce[1]}章 第${ce[2]}节`,type:"《一场Soul的创业实验》"}}return{name:V,type:"章节购买"}}return $==="fullbook"||V.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:$==="vip"||V.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:$==="match"||V.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:V,type:"其他"}}return $==="section"?{name:`章节 ${G.productId||G.sectionId||""}`,type:"单章"}:$==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:$==="vip"?{name:"VIP年度会员",type:"VIP"}:$==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:$||"其他"}},re=Math.ceil(i/g)||1;async function z(){var G;if(!(!(D!=null&&D.orderSn)&&!(D!=null&&D.id))){ee(!0),O(null);try{const $=await It("/api/admin/orders/refund",{orderSn:D.orderSn||D.id,reason:L||void 0});$!=null&&$.success?(P(null),_(""),Y()):O(($==null?void 0:$.error)||"退款失败")}catch($){const V=$;O(((G=V==null?void 0:V.data)==null?void 0:G.error)||"退款失败,请检查网络后重试")}finally{ee(!1)}}}function ie(){if(t.length===0){ae.info("暂无数据可导出");return}const G=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],$=t.map(X=>{const de=F(X);return[X.orderSn||X.id||"",U(X),R(X.userId),de.name,Number(X.amount||0).toFixed(2),X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付",X.status==="refunded"?"已退款":X.status==="paid"||X.status==="completed"?"已完成":X.status==="pending"||X.status==="created"?"待支付":"已失败",X.status==="refunded"&&X.refundReason?X.refundReason:"-",X.referrerEarnings?Number(X.referrerEarnings).toFixed(2):"-",X.createdAt?new Date(X.createdAt).toLocaleString("zh-CN"):""].join(",")}),V="\uFEFF"+[G.join(","),...$].join(`
+`),ce=new Blob([V],{type:"text/csv;charset=utf-8"}),W=URL.createObjectURL(ce),fe=document.createElement("a");fe.href=W,fe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,fe.click(),URL.revokeObjectURL(W)}return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>O(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(te,{variant:"outline",onClick:Y,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(oe,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:w,onChange:G=>N(G.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qN,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:G=>C(G.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(te,{variant:"outline",onClick:ie,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(aM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:E?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"订单号"}),s.jsx(je,{className:"text-gray-400",children:"用户"}),s.jsx(je,{className:"text-gray-400",children:"商品"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"支付方式"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"退款原因"}),s.jsx(je,{className:"text-gray-400",children:"分销佣金"}),s.jsx(je,{className:"text-gray-400",children:"下单时间"}),s.jsx(je,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(sr,{children:[t.map(G=>{const $=F(G);return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(xe,{className:"font-mono text-xs text-gray-400",children:[(G.orderSn||G.id||"").slice(0,12),"..."]}),s.jsx(xe,{children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:U(G)}),s.jsx("p",{className:"text-gray-500 text-xs",children:R(G.userId)})]})}),s.jsx(xe,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[$.name,(G.productType||G.type)==="vip"&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:$.type})]})}),s.jsxs(xe,{className:"text-[#38bdac] font-bold",children:["¥",Number(G.amount||0).toFixed(2)]}),s.jsx(xe,{className:"text-gray-300",children:G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付"}),s.jsx(xe,{children:G.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):G.status==="paid"||G.status==="completed"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):G.status==="pending"||G.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),s.jsx(xe,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:G.refundReason,children:G.status==="refunded"&&G.refundReason?G.refundReason:"-"}),s.jsx(xe,{className:"text-[#FFD700]",children:G.referrerEarnings?`¥${Number(G.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(xe,{className:"text-gray-400 text-sm",children:new Date(G.createdAt).toLocaleString("zh-CN")}),s.jsx(xe,{children:(G.status==="paid"||G.status==="completed")&&s.jsxs(te,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{P(G),_("")},children:[s.jsx(QN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},G.id)}),t.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(vs,{page:f,totalPages:re,total:i,pageSize:g,onPageChange:m,onPageSizeChange:G=>{y(G),m(1)}})]})})}),s.jsx(Yt,{open:!!D,onOpenChange:G=>!G&&P(null),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"订单退款"})}),D&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",D.orderSn||D.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(D.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:L,onChange:G=>_(G.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>P(null),disabled:J,children:"取消"}),s.jsx(te,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:z,disabled:J,children:J?"退款中...":"确认退款"})]})]})})]})}const Dl=v.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Mt("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",t),ref:n,...e}));Dl.displayName="Textarea";const Au=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function dP(){var Ti,Mi,ks,La,Ai;const[t,e]=FN(),n=t.get("pool"),[r,i]=v.useState([]),[a,o]=v.useState(0),[c,u]=v.useState(1),[h,f]=v.useState(10),[m,g]=v.useState(""),y=Qx(m,300),w=n==="vip"?"vip":n==="complete"?"complete":"all",[N,b]=v.useState(w),[k,C]=v.useState(!0),[E,T]=v.useState(!1),[I,O]=v.useState(null),[D,P]=v.useState(!1),[L,_]=v.useState("desc");v.useEffect(()=>{n==="vip"?b("vip"):n==="complete"?b("complete"):n==="all"&&b("all")},[n]);const[J,ee]=v.useState(!1),[Y,U]=v.useState(null),[R,F]=v.useState(!1),[re,z]=v.useState(!1),[ie,G]=v.useState({referrals:[],stats:{}}),[$,V]=v.useState(!1),[ce,W]=v.useState(null),[fe,X]=v.useState(!1),[de,he]=v.useState(null),[be,Te]=v.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Ve,He]=v.useState([]),[vt,Dt]=v.useState(!1),[vn,pt]=v.useState(!1),[Rt,ne]=v.useState(null),[Pe,Ze]=v.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[bt,mt]=v.useState([]),[gt,St]=v.useState(!1),[nn,Lt]=v.useState(null),[An,_t]=v.useState(null),[Gn,ts]=v.useState({}),[lr,me]=v.useState(!1);async function ye(H=!1){var Re;C(!0),H&&T(!0),O(null);try{if(D){const Ye=new URLSearchParams({search:y,limit:String(h*5)}),tt=await Le(`/api/db/users/rfm?${Ye}`);if(tt!=null&&tt.success){let In=tt.users||[];L==="asc"&&(In=[...In].reverse());const ur=(c-1)*h;i(In.slice(ur,ur+h)),o(((Re=tt.users)==null?void 0:Re.length)??0),In.length===0&&(P(!1),O("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else P(!1),O((tt==null?void 0:tt.error)||"RFM 加载失败,已切回普通模式")}else{const Ye=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...N==="vip"&&{vip:"true"},...N==="complete"&&{pool:"complete"}}),tt=await Le(`/api/db/users?${Ye}`);tt!=null&&tt.success?(i(tt.users||[]),o(tt.total??0)):O((tt==null?void 0:tt.error)||"加载失败")}}catch(Ye){console.error("Load users error:",Ye),O("网络错误")}finally{C(!1),H&&T(!1)}}v.useEffect(()=>{u(1)},[y,N,D]),v.useEffect(()=>{ye()},[c,h,y,N,D,L]);const cr=Math.ceil(a/h)||1,Vs=()=>{D?L==="desc"?_("asc"):(P(!1),_("desc")):(P(!0),_("desc"))},Ni=H=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[H||""]||"bg-gray-500/20 text-gray-400";async function ji(H){if(confirm("确定要删除这个用户吗?"))try{const Re=await Rs(`/api/db/users?id=${encodeURIComponent(H)}`);Re!=null&&Re.success?ye():ae.error("删除失败: "+((Re==null?void 0:Re.error)||""))}catch{ae.error("删除失败")}}const Cr=H=>{U(H),Te({phone:H.phone||"",nickname:H.nickname||"",password:"",isAdmin:!!(H.isAdmin??!1),hasFullBook:!!(H.hasFullBook??!1)}),ee(!0)},Ia=()=>{U(null),Te({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),ee(!0)};async function zr(){if(!be.phone||!be.nickname){ae.error("请填写手机号和昵称");return}F(!0);try{if(Y){const H=await It("/api/db/users",{id:Y.id,phone:be.phone||void 0,nickname:be.nickname,isAdmin:be.isAdmin,hasFullBook:be.hasFullBook,...be.password&&{password:be.password}});if(!(H!=null&&H.success)){ae.error("更新失败: "+((H==null?void 0:H.error)||""));return}}else{const H=await yt("/api/db/users",{phone:be.phone,nickname:be.nickname,password:be.password,isAdmin:be.isAdmin});if(!(H!=null&&H.success)){ae.error("创建失败: "+((H==null?void 0:H.error)||""));return}}ee(!1),ye()}catch{ae.error("保存失败")}finally{F(!1)}}async function ns(H){W(H),z(!0),V(!0);try{const Re=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(H.id)}`);Re!=null&&Re.success?G({referrals:Re.referrals||[],stats:Re.stats||{}}):G({referrals:[],stats:{}})}catch{G({referrals:[],stats:{}})}finally{V(!1)}}const dr=v.useCallback(async()=>{Dt(!0);try{const H=await Le("/api/db/user-rules");H!=null&&H.success&&He(H.rules||[])}catch{}finally{Dt(!1)}},[]);async function ki(){if(!Pe.title){ae.error("请填写规则标题");return}F(!0);try{if(Rt){const H=await It("/api/db/user-rules",{id:Rt.id,...Pe});if(!(H!=null&&H.success)){ae.error("更新失败: "+((H==null?void 0:H.error)||""));return}}else{const H=await yt("/api/db/user-rules",Pe);if(!(H!=null&&H.success)){ae.error("创建失败: "+((H==null?void 0:H.error)||""));return}}pt(!1),dr()}catch{ae.error("保存失败")}finally{F(!1)}}async function Ra(H){if(confirm("确定删除?"))try{const Re=await Rs(`/api/db/user-rules?id=${H}`);Re!=null&&Re.success&&dr()}catch{}}async function Hs(H){try{await It("/api/db/user-rules",{id:H.id,enabled:!H.enabled}),dr()}catch{}}const lt=v.useCallback(async()=>{St(!0);try{const H=await Le("/api/db/vip-members?limit=500");if(H!=null&&H.success&&H.data){const Re=[...H.data].map((Ye,tt)=>({...Ye,vipSort:typeof Ye.vipSort=="number"?Ye.vipSort:tt+1}));Re.sort((Ye,tt)=>(Ye.vipSort??999999)-(tt.vipSort??999999)),mt(Re)}else H&&H.error&&ae.error(H.error)}catch{ae.error("加载超级个体列表失败")}finally{St(!1)}},[]),[zn,rs]=v.useState(!1),[Er,ss]=v.useState(null),[ln,$r]=v.useState(""),[Ws,Fr]=v.useState(!1),Us=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],Sn=H=>{ss(H),$r(H.vipRole||""),rs(!0)},is=async H=>{const Re=H.trim();if(Er){if(!Re){ae.error("请选择或输入标签");return}Fr(!0);try{const Ye=await It("/api/db/users",{id:Er.id,vipRole:Re});if(!(Ye!=null&&Ye.success)){ae.error((Ye==null?void 0:Ye.error)||"更新超级个体标签失败");return}ae.success("已更新超级个体标签"),rs(!1),ss(null),await lt()}catch{ae.error("更新超级个体标签失败")}finally{Fr(!1)}}},[Bl,Si]=v.useState(!1),[Ks,xr]=v.useState(null),[Pa,Ci]=v.useState(""),[as,Br]=v.useState(!1),Oa=H=>{xr(H),Ci(H.vipSort!=null?String(H.vipSort):""),Si(!0)},Ei=async()=>{if(!Ks)return;const H=Number(Pa);if(!Number.isFinite(H)){ae.error("请输入有效的数字序号");return}Br(!0);try{const Re=await It("/api/db/users",{id:Ks.id,vipSort:H});if(!(Re!=null&&Re.success)){ae.error((Re==null?void 0:Re.error)||"更新排序序号失败");return}ae.success("已更新排序序号"),Si(!1),xr(null),await lt()}catch{ae.error("更新排序序号失败")}finally{Br(!1)}},Mo=(H,Re)=>{H.dataTransfer.effectAllowed="move",H.dataTransfer.setData("text/plain",Re),Lt(Re)},qs=(H,Re)=>{H.preventDefault(),An!==Re&&_t(Re)},Da=()=>{Lt(null),_t(null)},zt=async(H,Re)=>{H.preventDefault();const Ye=H.dataTransfer.getData("text/plain")||nn;if(Lt(null),_t(null),!Ye||Ye===Re)return;const tt=bt.find(Zt=>Zt.id===Ye),In=bt.find(Zt=>Zt.id===Re);if(!tt||!In)return;const ur=tt.vipSort??bt.findIndex(Zt=>Zt.id===Ye)+1,Ao=In.vipSort??bt.findIndex(Zt=>Zt.id===Re)+1;mt(Zt=>{const $n=[...Zt],ls=$n.findIndex(Ii=>Ii.id===Ye),Ss=$n.findIndex(Ii=>Ii.id===Re);if(ls===-1||Ss===-1)return Zt;const Js=[...$n],[Vl,_a]=[Js[ls],Js[Ss]];return Js[ls]={..._a,vipSort:ur},Js[Ss]={...Vl,vipSort:Ao},Js});try{const[Zt,$n]=await Promise.all([It("/api/db/users",{id:Ye,vipSort:Ao}),It("/api/db/users",{id:Re,vipSort:ur})]);if(!(Zt!=null&&Zt.success)||!($n!=null&&$n.success)){ae.error((Zt==null?void 0:Zt.error)||($n==null?void 0:$n.error)||"更新排序失败"),await lt();return}ae.success("已更新排序"),await lt()}catch{ae.error("更新排序失败"),await lt()}},Gs=v.useCallback(async()=>{me(!0);try{const H=await Le("/api/db/users/journey-stats");H!=null&&H.success&&H.stats&&ts(H.stats)}catch{}finally{me(!1)}},[]);return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>O(null),children:"×"})]}),s.jsx("div",{className:"flex justify-between items-center mb-6",children:s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",a," 位注册用户",D&&" · RFM 排序中"]})]})}),s.jsxs(pd,{defaultValue:"users",className:"w-full",children:[s.jsxs(Ol,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(an,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(qn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(an,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Gs,children:[s.jsx(hl,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(an,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:dr,children:[s.jsx(io,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(an,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:lt,children:[s.jsx(ml,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(on,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(te,{variant:"outline",onClick:()=>ye(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:N,onChange:H=>{const Re=H.target.value;b(Re),u(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:D,children:[s.jsx("option",{value:"all",children:"全部用户"}),s.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),s.jsx("option",{value:"complete",children:"完善资料用户"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(oe,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:H=>g(H.target.value)})]}),s.jsxs(te,{onClick:Ia,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"用户信息"}),s.jsx(je,{className:"text-gray-400",children:"绑定信息"}),s.jsx(je,{className:"text-gray-400",children:"购买状态"}),s.jsx(je,{className:"text-gray-400",children:"分销收益"}),s.jsxs(je,{className:"text-gray-400 cursor-pointer select-none",onClick:Vs,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Dc,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),D?L==="desc"?s.jsx(Jc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(VN,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Nm,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),D&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(je,{className:"text-gray-400",children:"注册时间"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(sr,{children:[r.map(H=>{var Re,Ye,tt;return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:H.avatar?s.jsx("img",{src:H.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Re=H.nickname)==null?void 0:Re.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{he(H.id),X(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:H.nickname}),H.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),H.openId&&!((Ye=H.id)!=null&&Ye.startsWith("user_"))&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsx("p",{className:"text-xs text-gray-500 font-mono",children:H.openId?H.openId.slice(0,12)+"...":(tt=H.id)==null?void 0:tt.slice(0,12)})]})]})}),s.jsx(xe,{children:s.jsxs("div",{className:"space-y-1",children:[H.phone&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"📱"}),s.jsx("span",{className:"text-gray-300",children:H.phone})]}),H.wechatId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"💬"}),s.jsx("span",{className:"text-gray-300",children:H.wechatId})]}),H.openId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"🔗"}),s.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:H.openId,children:[H.openId.slice(0,12),"..."]})]}),!H.phone&&!H.wechatId&&!H.openId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(xe,{children:H.hasFullBook?s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),s.jsx(xe,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(H.earnings||0)).toFixed(2)]}),parseFloat(String(H.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(H.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>ns(H),role:"button",tabIndex:0,onKeyDown:In=>In.key==="Enter"&&ns(H),children:[s.jsx(qn,{className:"w-3 h-3"})," 绑定",H.referralCount||0,"人"]})]})}),s.jsx(xe,{children:H.rfmScore!==void 0?s.jsx("div",{className:"flex flex-col gap-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:H.rfmScore}),s.jsx(Ue,{className:`border-0 text-xs ${Ni(H.rfmLevel)}`,children:H.rfmLevel})]})}):s.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",s.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),s.jsx(xe,{className:"text-gray-400",children:H.createdAt?new Date(H.createdAt).toLocaleDateString():"-"}),s.jsx(xe,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{he(H.id),X(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(kg,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Cr(H),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>ji(H.id),title:"删除",children:s.jsx(Hn,{className:"w-4 h-4"})})]})})]},H.id)}),r.length===0&&s.jsx(it,{children:s.jsx(xe,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(vs,{page:c,totalPages:cr,total:a,pageSize:h,onPageChange:u,onPageSizeChange:H=>{f(H),u(1)}})]})})})]}),s.jsxs(on,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(te,{variant:"outline",onClick:Gs,disabled:lr,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${lr?"animate-spin":""}`})," 刷新数据"]})]}),s.jsxs("div",{className:"relative mb-8",children:[s.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),s.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:Au.map((H,Re)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${H.color} text-center cursor-default`,children:[s.jsx("div",{className:"text-2xl mb-1",children:H.icon}),s.jsx("div",{className:`text-xs font-medium ${H.color.split(" ").find(Ye=>Ye.startsWith("text-"))}`,children:H.label}),Gn[H.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Gn[H.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:Re+1})]}),Res.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:H.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:H.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",H.next]})]})]},H.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Xr,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),lr?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Je,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Gn).length>0?s.jsx("div",{className:"space-y-2",children:Au.map(H=>{const Re=Gn[H.id]||0,Ye=Math.max(...Au.map(In=>Gn[In.id]||0),1),tt=Math.round(Re/Ye*100);return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[H.icon," ",H.label]}),s.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${tt}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Re})]},H.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),s.jsxs(on,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(te,{variant:"outline",onClick:dr,disabled:vt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${vt?"animate-spin":""}`})," 刷新"]}),s.jsxs(te,{onClick:()=>{ne(null),Ze({title:"",description:"",trigger:"",sort:0,enabled:!0}),pt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(un,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),vt?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Ve.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Xr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(te,{onClick:dr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Je,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Ve.map(H=>s.jsx("div",{className:`p-4 rounded-lg border transition-all ${H.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.jsx(Ft,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium",children:H.title}),H.trigger&&s.jsxs(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",H.trigger]}),s.jsx(Ue,{className:`text-xs border-0 ${H.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:H.enabled?"启用":"禁用"})]}),H.description&&s.jsx("p",{className:"text-gray-400 text-sm ml-6",children:H.description})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[s.jsx(At,{checked:H.enabled,onCheckedChange:()=>Hs(H)}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{ne(H),Ze({title:H.title,description:H.description,trigger:H.trigger,sort:H.sort,enabled:H.enabled}),pt(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(te,{variant:"ghost",size:"sm",onClick:()=>Ra(H.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Hn,{className:"w-4 h-4"})})]})]})},H.id))})]}),s.jsxs(on,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(te,{variant:"outline",onClick:lt,disabled:gt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${gt?"animate-spin":""}`})," ","刷新"]})})]}),gt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):bt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(ml,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:s.jsxs(nr,{children:[s.jsx(rr,{children:s.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-16",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),s.jsx(je,{className:"text-gray-400 w-24",children:"排序值"}),s.jsx(je,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),s.jsx(sr,{children:bt.map((H,Re)=>{var In;const Ye=nn===H.id,tt=An===H.id;return s.jsxs(it,{draggable:!0,onDragStart:ur=>Mo(ur,H.id),onDragOver:ur=>qs(ur,H.id),onDrop:ur=>zt(ur,H.id),onDragEnd:Da,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Ye?"opacity-60":""} ${tt?"bg-[#38bdac]/10":""}`,children:[s.jsx(xe,{className:"text-gray-300",children:Re+1}),s.jsx(xe,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[H.avatar?s.jsx("img",{src:H.avatar,className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((In=H.name)==null?void 0:In[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:H.name})})]})}),s.jsx(xe,{className:"text-gray-300 whitespace-nowrap",children:H.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(xe,{className:"text-gray-300",children:H.vipSort??Re+1}),s.jsx(xe,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>Sn(H),title:"设置超级个体标签",children:s.jsx(Gu,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{he(H.id),X(!0)},title:"编辑资料",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Oa(H),title:"设置排序序号",children:s.jsx(Nm,{className:"w-3.5 h-3.5"})})]})})]},H.id)})})]})})})]})]}),s.jsx(Yt,{open:Bl,onOpenChange:H=>{Si(H),H||xr(null)},children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(Nm,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",Ks==null?void 0:Ks.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(oe,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:Pa,onChange:H=>Ci(H.target.value)})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>Si(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:Ei,disabled:as,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),as?"保存中...":"保存"]})]})]})}),s.jsx(Yt,{open:zn,onOpenChange:H=>{rs(H),H||ss(null)},children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(ml,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Er==null?void 0:Er.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Us.map(H=>s.jsx(te,{variant:ln===H?"default":"outline",size:"sm",className:ln===H?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>$r(H),children:H},H))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:ln,onChange:H=>$r(H.target.value)})]})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>rs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:()=>is(ln),disabled:Ws,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),Ws?"保存中...":"保存"]})]})]})}),s.jsx(Yt,{open:J,onOpenChange:ee,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[Y?s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Tg,{className:"w-5 h-5 text-[#38bdac]"}),Y?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:be.phone,onChange:H=>Te({...be,phone:H.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:be.nickname,onChange:H=>Te({...be,nickname:H.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:Y?"新密码 (留空则不修改)":"密码"}),s.jsx(oe,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:Y?"留空则不修改":"请输入密码",value:be.password,onChange:H=>Te({...be,password:H.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"管理员权限"}),s.jsx(At,{checked:be.isAdmin,onCheckedChange:H=>Te({...be,isAdmin:H})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"已购全书"}),s.jsx(At,{checked:be.hasFullBook,onCheckedChange:H=>Te({...be,hasFullBook:H})})]})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>ee(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:zr,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Yt,{open:vn,onOpenChange:pt,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),Rt?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Pe.title,onChange:H=>Ze({...Pe,title:H.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则描述"}),s.jsx(Dl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Pe.description,onChange:H=>Ze({...Pe,description:H.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"触发条件"}),s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Pe.trigger,onChange:H=>Ze({...Pe,trigger:H.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(Z,{className:"text-gray-300",children:"启用状态"})}),s.jsx(At,{checked:Pe.enabled,onCheckedChange:H=>Ze({...Pe,enabled:H})})]})]}),s.jsxs(fn,{children:[s.jsxs(te,{variant:"outline",onClick:()=>pt(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(te,{onClick:ki,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Yt,{open:re,onOpenChange:z,children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Qt,{children:s.jsxs(Xt,{className:"text-white flex items-center gap-2",children:[s.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",ce==null?void 0:ce.nickname]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((Ti=ie.stats)==null?void 0:Ti.total)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Mi=ie.stats)==null?void 0:Mi.purchased)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((ks=ie.stats)==null?void 0:ks.earnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((La=ie.stats)==null?void 0:La.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),$?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Je,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Ai=ie.referrals)==null?void 0:Ai.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(ie.referrals??[]).map((H,Re)=>{var tt;const Ye=H;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((tt=Ye.nickname)==null?void 0:tt.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Ye.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Ye.phone||(Ye.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Ye.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ye.status==="paid"&&s.jsxs(Ue,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ye.purchasedSections,"章"]}),Ye.status==="free"&&s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Ye.createdAt?new Date(Ye.createdAt).toLocaleDateString():""})]})]},Ye.id||Re)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(fn,{children:s.jsx(te,{variant:"outline",onClick:()=>z(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(Yx,{open:fe,onClose:()=>X(!1),userId:de,onUserUpdated:ye})]})}function hh(t,[e,n]){return Math.min(n,Math.max(e,t))}var yk=["PageUp","PageDown"],vk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],bk={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ll="Slider",[Pg,uP,hP]=Kx(Ll),[wk]=Sa(Ll,[hP]),[fP,xf]=wk(Ll),Nk=v.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:a=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:w,...N}=t,b=v.useRef(new Set),k=v.useRef(0),E=o==="horizontal"?pP:mP,[T=[],I]=po({prop:f,defaultProp:h,onChange:J=>{var Y;(Y=[...b.current][k.current])==null||Y.focus(),m(J)}}),O=v.useRef(T);function D(J){const ee=bP(T,J);_(J,ee)}function P(J){_(J,k.current)}function L(){const J=O.current[k.current];T[k.current]!==J&&g(T)}function _(J,ee,{commit:Y}={commit:!1}){const U=kP(a),R=SP(Math.round((J-r)/a)*a+r,U),F=hh(R,[r,i]);I((re=[])=>{const z=yP(re,F,ee);if(jP(z,u*a)){k.current=z.indexOf(F);const ie=String(z)!==String(re);return ie&&Y&&g(z),ie?z:re}else return re})}return s.jsx(fP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:k,thumbs:b.current,values:T,orientation:o,form:w,children:s.jsx(Pg.Provider,{scope:t.__scopeSlider,children:s.jsx(Pg.Slot,{scope:t.__scopeSlider,children:s.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...N,ref:e,onPointerDown:ot(N.onPointerDown,()=>{c||(O.current=T)}),min:r,max:i,inverted:y,onSlideStart:c?void 0:D,onSlideMove:c?void 0:P,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&_(r,0,{commit:!0}),onEndKeyDown:()=>!c&&_(i,T.length-1,{commit:!0}),onStepKeyDown:({event:J,direction:ee})=>{if(!c){const R=yk.includes(J.key)||J.shiftKey&&vk.includes(J.key)?10:1,F=k.current,re=T[F],z=a*R*ee;_(re+z,F,{commit:!0})}}})})})})});Nk.displayName=Ll;var[jk,kk]=wk(Ll,{startEdge:"left",endEdge:"right",size:"width",direction:1}),pP=v.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=v.useState(null),y=Tt(e,E=>g(E)),w=v.useRef(void 0),N=pf(i),b=N==="ltr",k=b&&!a||!b&&a;function C(E){const T=w.current||m.getBoundingClientRect(),I=[0,T.width],D=Xx(I,k?[n,r]:[r,n]);return w.current=T,D(E-T.left)}return s.jsx(jk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(Sk,{dir:N,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const T=C(E.clientX);o==null||o(T)},onSlideMove:E=>{const T=C(E.clientX);c==null||c(T)},onSlideEnd:()=>{w.current=void 0,u==null||u()},onStepKeyDown:E=>{const I=bk[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:I?-1:1})}})})}),mP=v.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=v.useRef(null),m=Tt(e,f),g=v.useRef(void 0),y=!i;function w(N){const b=g.current||f.current.getBoundingClientRect(),k=[0,b.height],E=Xx(k,y?[r,n]:[n,r]);return g.current=b,E(N-b.top)}return s.jsx(jk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(Sk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const b=w(N.clientY);a==null||a(b)},onSlideMove:N=>{const b=w(N.clientY);o==null||o(b)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:N=>{const k=bk[y?"from-bottom":"from-top"].includes(N.key);u==null||u({event:N,direction:k?-1:1})}})})}),Sk=v.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=xf(Ll,n);return s.jsx(ht.span,{...h,ref:e,onKeyDown:ot(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):yk.concat(vk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:ot(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:ot(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&i(m)}),onPointerUp:ot(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),a(m))})})}),Ck="SliderTrack",Ek=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=xf(Ck,n);return s.jsx(ht.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});Ek.displayName=Ck;var Og="SliderRange",Tk=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=xf(Og,n),a=kk(Og,n),o=v.useRef(null),c=Tt(e,o),u=i.values.length,h=i.values.map(g=>Ik(g,i.min,i.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(ht.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[a.startEdge]:f+"%",[a.endEdge]:m+"%"}})});Tk.displayName=Og;var Dg="SliderThumb",Mk=v.forwardRef((t,e)=>{const n=uP(t.__scopeSlider),[r,i]=v.useState(null),a=Tt(e,c=>i(c)),o=v.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(gP,{...t,ref:a,index:o})}),gP=v.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...a}=t,o=xf(Dg,n),c=kk(Dg,n),[u,h]=v.useState(null),f=Tt(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=Jx(u),y=o.values[r],w=y===void 0?0:Ik(y,o.min,o.max),N=vP(r,o.values.length),b=g==null?void 0:g[c.size],k=b?wP(b,w,c.direction):0;return v.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${w}% + ${k}px)`},children:[s.jsx(Pg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(ht.span,{role:"slider","aria-label":t["aria-label"]||N,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...a,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:ot(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(Ak,{name:i??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Mk.displayName=Dg;var xP="RadioBubbleInput",Ak=v.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const i=v.useRef(null),a=Tt(i,r),o=Gx(e);return v.useEffect(()=>{const c=i.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(ht.input,{style:{display:"none"},...n,ref:a,defaultValue:e})});Ak.displayName=xP;function yP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,a)=>i-a)}function Ik(t,e,n){const a=100/(n-e)*(t-e);return hh(a,[0,100])}function vP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function bP(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function wP(t,e,n){const r=t/2,a=Xx([0,50],[0,r]);return(r-a(e)*n)*n}function NP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function jP(t,e){if(e>0){const n=NP(t);return Math.min(...n)>=e}return!0}function Xx(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function kP(t){return(String(t).split(".")[1]||"").length}function SP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var CP=Nk,EP=Ek,TP=Tk,MP=Mk;function AP({className:t,defaultValue:e,value:n,min:r=0,max:i=100,...a}){const o=v.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,i],[n,e,r,i]);return s.jsxs(CP,{defaultValue:e,value:n,min:r,max:i,className:Mt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...a,children:[s.jsx(EP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(TP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(MP,{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"},u))]})}const IP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function Rk(t){const[e,n]=v.useState(IP),[r,i]=v.useState(!0),[a,o]=v.useState(!1);v.useEffect(()=>{Le("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await yt("/api/admin/referral-settings",h);if(!f||f.success===!1){ae.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}ae.success(`✅ 分销配置已保存成功!
• 小程序与网站的推广规则会一起生效
• 绑定关系会使用新的天数配置
• 佣金比例会立即应用到新订单
-如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),ae.error("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return r?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(jl,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),s.jsxs(te,{onClick:c,disabled:a||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(gn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(lA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx($t,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(bu,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Un,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(AP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(oe,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(bu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(bu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Un,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(oe,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(jl,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx($t,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(oe,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ue,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(Et,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(bu,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ae,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[s.jsxs("p",{children:["1. 以上配置会写入"," ",s.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),s.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),s.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function RP(){var At;const[t,e]=v.useState("overview"),[n,r]=v.useState([]),[i,a]=v.useState(null),[o,c]=v.useState([]),[u,h]=v.useState([]),[f,m]=v.useState([]),[g,y]=v.useState(!0),[w,N]=v.useState(null),[b,k]=v.useState(""),[C,E]=v.useState("all"),[T,I]=v.useState(1),[O,D]=v.useState(10),[P,L]=v.useState(0),[_,J]=v.useState(new Set),[ee,Y]=v.useState(null),[U,R]=v.useState(""),[F,re]=v.useState(!1),[z,ie]=v.useState(null),[G,$]=v.useState(""),[H,ce]=v.useState(!1);v.useEffect(()=>{W()},[]),v.useEffect(()=>{I(1)},[t,C]),v.useEffect(()=>{fe(t)},[t]),v.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&fe(t,!0)},[T,O,C,b]);async function W(){N(null);try{const ne=await Le("/api/admin/distribution/overview");ne!=null&&ne.success&&ne.overview&&a(ne.overview)}catch(ne){console.error("[Admin] 概览接口异常:",ne),N("加载概览失败")}try{const ne=await Le("/api/db/users");m((ne==null?void 0:ne.users)||[])}catch(ne){console.error("[Admin] 用户数据加载失败:",ne)}}async function fe(ne,Pe=!1){var Qe;if(!(!Pe&&_.has(ne))){y(!0);try{const xt=f;switch(ne){case"overview":break;case"orders":{try{const ft=new URLSearchParams({page:String(T),pageSize:String(O),...C!=="all"&&{status:C},...b&&{search:b}}),pt=await Le(`/api/admin/orders?${ft}`);if(pt!=null&&pt.success&&pt.orders){const Nt=pt.orders.map(Xt=>{const Ot=xt.find(Dt=>Dt.id===Xt.userId),Tn=Xt.referrerId?xt.find(Dt=>Dt.id===Xt.referrerId):null;return{...Xt,amount:parseFloat(String(Xt.amount))||0,userNickname:(Ot==null?void 0:Ot.nickname)||Xt.userNickname||"未知用户",userPhone:(Ot==null?void 0:Ot.phone)||Xt.userPhone||"-",referrerNickname:(Tn==null?void 0:Tn.nickname)||null,referrerCode:(Tn==null?void 0:Tn.referralCode)??null,type:Xt.productType||Xt.type}});r(Nt),L(pt.total??Nt.length)}else r([]),L(0)}catch(ft){console.error(ft),N("加载订单失败"),r([])}break}case"bindings":{try{const ft=new URLSearchParams({page:String(T),pageSize:String(O),...C!=="all"&&{status:C}}),pt=await Le(`/api/db/distribution?${ft}`);c((pt==null?void 0:pt.bindings)||[]),L((pt==null?void 0:pt.total)??((Qe=pt==null?void 0:pt.bindings)==null?void 0:Qe.length)??0)}catch(ft){console.error(ft),N("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const ft=C==="completed"?"success":C==="rejected"?"failed":C,pt=new URLSearchParams({...ft&&ft!=="all"&&{status:ft},page:String(T),pageSize:String(O)}),Nt=await Le(`/api/admin/withdrawals?${pt}`);if(Nt!=null&&Nt.success&&Nt.withdrawals){const Xt=Nt.withdrawals.map(Ot=>({...Ot,account:Ot.account??"未绑定微信号",status:Ot.status==="success"?"completed":Ot.status==="failed"?"rejected":Ot.status}));h(Xt),L((Nt==null?void 0:Nt.total)??Xt.length)}else Nt!=null&&Nt.success||N(`获取提现记录失败: ${(Nt==null?void 0:Nt.error)||"未知错误"}`),h([])}catch(ft){console.error(ft),N("加载提现数据失败"),h([])}break}}J(ft=>new Set(ft).add(ne))}catch(xt){console.error(xt)}finally{y(!1)}}}async function X(){N(null),J(ne=>{const Pe=new Set(ne);return Pe.delete(t),Pe}),t==="overview"&&W(),await fe(t,!0)}async function de(ne){if(confirm("确认审核通过并打款?"))try{const Pe=await Mt("/api/admin/withdrawals",{id:ne,action:"approve"});if(!(Pe!=null&&Pe.success)){const Qe=(Pe==null?void 0:Pe.message)||(Pe==null?void 0:Pe.error)||"操作失败";ae.error(Qe);return}await X()}catch(Pe){console.error(Pe),ae.error("操作失败")}}function he(ne){ie(ne),$("")}async function we(){const ne=z;if(!ne)return;const Pe=G.trim();if(!Pe){ae.error("请填写拒绝原因");return}ce(!0);try{const Qe=await Mt("/api/admin/withdrawals",{id:ne,action:"reject",errorMessage:Pe});if(!(Qe!=null&&Qe.success)){ae.error((Qe==null?void 0:Qe.error)||"操作失败");return}ae.success("已拒绝该提现申请"),ie(null),$(""),await X()}catch(Qe){console.error(Qe),ae.error("操作失败")}finally{ce(!1)}}function Te(){z&&ae.info("已取消操作"),ie(null),$("")}async function Ve(){var ne;if(!(!(ee!=null&&ee.orderSn)&&!(ee!=null&&ee.id))){re(!0),N(null);try{const Pe=await Mt("/api/admin/orders/refund",{orderSn:ee.orderSn||ee.id,reason:U||void 0});Pe!=null&&Pe.success?(Y(null),R(""),await fe("orders",!0)):N((Pe==null?void 0:Pe.error)||"退款失败")}catch(Pe){const Qe=Pe;N(((ne=Qe==null?void 0:Qe.data)==null?void 0:ne.error)||"退款失败,请检查网络后重试")}finally{re(!1)}}}function He(ne){const Pe={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"},Qe={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ue,{className:`${Pe[ne]||"bg-gray-500/20 text-gray-400"} border-0`,children:Qe[ne]||ne})}const gt=Math.ceil(P/O)||1,Pt=n,yn=o.filter(ne=>{var Qe,xt,ft,pt;if(!b)return!0;const Pe=b.toLowerCase();return((Qe=ne.refereeNickname)==null?void 0:Qe.toLowerCase().includes(Pe))||((xt=ne.refereePhone)==null?void 0:xt.includes(Pe))||((ft=ne.referrerName)==null?void 0:ft.toLowerCase().includes(Pe))||((pt=ne.referrerCode)==null?void 0:pt.toLowerCase().includes(Pe))}),ht=u.filter(ne=>{var Qe;if(!b)return!0;const Pe=b.toLowerCase();return((Qe=ne.userName)==null?void 0:Qe.toLowerCase().includes(Pe))||ne.account&&ne.account.toLowerCase().includes(Pe)});return s.jsxs("div",{className:"p-8 w-full",children:[w&&s.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:[s.jsx("span",{children:w}),s.jsx("button",{type:"button",onClick:()=>N(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),s.jsxs(te,{onClick:X,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),s.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:Oc},{key:"orders",label:"订单管理",icon:ah},{key:"bindings",label:"绑定管理",icon:gs},{key:"withdrawals",label:"提现审核",icon:jl},{key:"settings",label:"推广设置",icon:so}].map(ne=>s.jsxs("button",{type:"button",onClick:()=>{e(ne.key),E("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===ne.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[s.jsx(ne.icon,{className:"w-4 h-4"}),ne.label]},ne.key))}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ge,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[t==="overview"&&i&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayClicks}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(jg,{className:"w-6 h-6 text-blue-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayUniqueVisitors??0}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:s.jsx(Un,{className:"w-6 h-6 text-cyan-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(i.todayClickRate??0).toFixed(2)}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:s.jsx(Oc,{className:"w-6 h-6 text-amber-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayBindings})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:s.jsx(gs,{className:"w-6 h-6 text-green-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayConversions})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:s.jsx(Pb,{className:"w-6 h-6 text-purple-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),s.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",i.todayEarnings.toFixed(2)]})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:s.jsx(ah,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((At=i.todayClicksByPage)==null?void 0:At.length)??0)>0&&s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(jg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),s.jsx(Ae,{children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),s.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),s.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),s.jsx("tbody",{children:[...i.todayClicksByPage??[]].sort((ne,Pe)=>Pe.clicks-ne.clicks).map((ne,Pe)=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:ne.page||"(未区分)"}),s.jsx("td",{className:"py-2 pr-4 text-right text-white",children:ne.clicks}),s.jsxs("td",{className:"py-2 text-right text-gray-400",children:[i.todayClicks>0?(ne.clicks/i.todayClicks*100).toFixed(1):0,"%"]})]},Pe))})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Me,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:s.jsx(Ng,{className:"w-6 h-6 text-orange-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[i.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),s.jsx(Me,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(jl,{className:"w-6 h-6 text-blue-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[i.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",i.pendingWithdrawAmount.toFixed(2)]})]}),s.jsx(te,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ih,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthClicks})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthBindings})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",i.monthEarnings.toFixed(2)]})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Oc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),s.jsxs(Ae,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalClicks.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalBindings.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",i.totalEarnings.toFixed(2)]})]})]}),s.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[s.jsx("span",{className:"text-gray-300",children:"点击转化率"}),s.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[i.conversionRate,"%"]})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-white",children:i.totalDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-green-400",children:i.activeDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[n.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Pt.map(ne=>{var Pe,Qe;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Pe=ne.id)==null?void 0:Pe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:ne.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const xt=ne.productType||ne.type;return xt==="fullbook"?`${ne.bookName||"《底层逻辑》"} - 全本`:xt==="match"?"匹配次数购买":`${ne.bookName||"《底层逻辑》"} - ${ne.sectionTitle||ne.chapterTitle||`章节${ne.productId||ne.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const xt=ne.productType||ne.type;return xt==="fullbook"?"全书解锁":xt==="match"?"功能权益":ne.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof ne.amount=="number"?ne.amount.toFixed(2):parseFloat(String(ne.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:ne.paymentMethod==="wechat"?"微信支付":ne.paymentMethod==="alipay"?"支付宝":ne.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:ne.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):ne.status==="completed"||ne.status==="paid"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):ne.status==="pending"||ne.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:ne.refundReason,children:ne.status==="refunded"&&ne.refundReason?ne.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:ne.referrerId||ne.referralCode?s.jsxs("span",{title:ne.referralCode||ne.referrerCode||ne.referrerId||"",children:[ne.referrerNickname||ne.referralCode||ne.referrerCode||((Qe=ne.referrerId)==null?void 0:Qe.slice(0,8)),(ne.referralCode||ne.referrerCode)&&` (${ne.referralCode||ne.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:ne.referrerEarnings?`¥${(typeof ne.referrerEarnings=="number"?ne.referrerEarnings:parseFloat(String(ne.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:ne.createdAt?new Date(ne.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(ne.status==="paid"||ne.status==="completed")&&s.jsxs(te,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(ne),R("")},children:[s.jsx(YN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},ne.id)})})]})}),t==="orders"&&s.jsx(xs,{page:T,totalPages:gt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]}),t==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"active",children:"有效"}),s.jsx("option",{value:"converted",children:"已转化"}),s.jsx("option",{value:"expired",children:"已过期"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[yn.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:yn.map(ne=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:ne.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:ne.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:ne.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.boundAt?new Date(ne.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.expiresAt?new Date(ne.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(ne.status)}),s.jsx("td",{className:"p-4",children:ne.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",ne.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},ne.id))})]})}),t==="bindings"&&s.jsx(xs,{page:T,totalPages:gt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]}),t==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(da,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待审核"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[ht.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ht.map(ne=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[ne.userAvatar?s.jsx("img",{src:ne.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(ne.userName||ne.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:ne.userName||ne.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",ne.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ue,{className:ne.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:ne.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:ne.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.createdAt?new Date(ne.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(ne.status)}),s.jsx("td",{className:"p-4 text-right",children:ne.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(te,{size:"sm",onClick:()=>de(ne.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Pb,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(te,{size:"sm",variant:"outline",onClick:()=>he(ne.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(WN,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},ne.id))})]})}),t==="withdrawals"&&s.jsx(xs,{page:T,totalPages:gt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]})]}),s.jsx(Kt,{open:!!ee,onOpenChange:ne=>!ne&&Y(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"订单退款"})}),ee&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ee.orderSn||ee.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ee.amount=="number"?ee.amount.toFixed(2):parseFloat(String(ee.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:U,onChange:ne=>R(ne.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:F,children:"取消"}),s.jsx(te,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Ve,disabled:F,children:F?"退款中...":"确认退款"})]})]})}),s.jsx(Kt,{open:!!z,onOpenChange:ne=>!ne&&Te(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:G,onChange:ne=>$(ne.target.value)})})]})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Te,disabled:H,children:"取消"}),s.jsx(te,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:we,disabled:H||!G.trim(),children:H?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(Ik,{embedded:!0})})]})}function PP(){const[t,e]=v.useState([]),[n,r]=v.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[i,a]=v.useState(!0),[o,c]=v.useState(null),[u,h]=v.useState("all"),[f,m]=v.useState(1),[g,y]=v.useState(10),[w,N]=v.useState(0),[b,k]=v.useState(null),[C,E]=v.useState(null),[T,I]=v.useState(""),[O,D]=v.useState(!1);async function P(){var R,F,re,z,ie,G,$;a(!0),c(null);try{const H=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),ce=await Le(`/api/admin/withdrawals?${H}`);if(ce!=null&&ce.success){const W=ce.withdrawals||[];e(W),N(ce.total??((R=ce.stats)==null?void 0:R.total)??W.length),r({total:((F=ce.stats)==null?void 0:F.total)??ce.total??W.length,pendingCount:((re=ce.stats)==null?void 0:re.pendingCount)??0,pendingAmount:((z=ce.stats)==null?void 0:z.pendingAmount)??0,successCount:((ie=ce.stats)==null?void 0:ie.successCount)??0,successAmount:((G=ce.stats)==null?void 0:G.successAmount)??0,failedCount:(($=ce.stats)==null?void 0:$.failedCount)??0})}else c("加载提现记录失败")}catch(H){console.error("Load withdrawals error:",H),c("加载失败,请检查网络后重试")}finally{a(!1)}}v.useEffect(()=>{m(1)},[u]),v.useEffect(()=>{P()},[u,f,g]);const L=Math.ceil(w/g)||1;async function _(R){const F=t.find(re=>re.id===R);if(F!=null&&F.userCommissionInfo&&F.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${F.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。
+如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),ae.error("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return r?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(wl,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),s.jsxs(te,{onClick:c,disabled:a||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(lA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Vt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(wu,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(qn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(AP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(oe,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(wu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(wu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(oe,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(qn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(oe,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"flex items-center gap-2 text-white",children:[s.jsx(wl,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Vt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(oe,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ue,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(At,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(wu,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ae,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[s.jsxs("p",{children:["1. 以上配置会写入"," ",s.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),s.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),s.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function RP(){var Rt;const[t,e]=v.useState("overview"),[n,r]=v.useState([]),[i,a]=v.useState(null),[o,c]=v.useState([]),[u,h]=v.useState([]),[f,m]=v.useState([]),[g,y]=v.useState(!0),[w,N]=v.useState(null),[b,k]=v.useState(""),[C,E]=v.useState("all"),[T,I]=v.useState(1),[O,D]=v.useState(10),[P,L]=v.useState(0),[_,J]=v.useState(new Set),[ee,Y]=v.useState(null),[U,R]=v.useState(""),[F,re]=v.useState(!1),[z,ie]=v.useState(null),[G,$]=v.useState(""),[V,ce]=v.useState(!1);v.useEffect(()=>{W()},[]),v.useEffect(()=>{I(1)},[t,C]),v.useEffect(()=>{fe(t)},[t]),v.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&fe(t,!0)},[T,O,C,b]);async function W(){N(null);try{const ne=await Le("/api/admin/distribution/overview");ne!=null&&ne.success&&ne.overview&&a(ne.overview)}catch(ne){console.error("[Admin] 概览接口异常:",ne),N("加载概览失败")}try{const ne=await Le("/api/db/users");m((ne==null?void 0:ne.users)||[])}catch(ne){console.error("[Admin] 用户数据加载失败:",ne)}}async function fe(ne,Pe=!1){var Ze;if(!(!Pe&&_.has(ne))){y(!0);try{const bt=f;switch(ne){case"overview":break;case"orders":{try{const mt=new URLSearchParams({page:String(T),pageSize:String(O),...C!=="all"&&{status:C},...b&&{search:b}}),gt=await Le(`/api/admin/orders?${mt}`);if(gt!=null&>.success&>.orders){const St=gt.orders.map(nn=>{const Lt=bt.find(_t=>_t.id===nn.userId),An=nn.referrerId?bt.find(_t=>_t.id===nn.referrerId):null;return{...nn,amount:parseFloat(String(nn.amount))||0,userNickname:(Lt==null?void 0:Lt.nickname)||nn.userNickname||"未知用户",userPhone:(Lt==null?void 0:Lt.phone)||nn.userPhone||"-",referrerNickname:(An==null?void 0:An.nickname)||null,referrerCode:(An==null?void 0:An.referralCode)??null,type:nn.productType||nn.type}});r(St),L(gt.total??St.length)}else r([]),L(0)}catch(mt){console.error(mt),N("加载订单失败"),r([])}break}case"bindings":{try{const mt=new URLSearchParams({page:String(T),pageSize:String(O),...C!=="all"&&{status:C}}),gt=await Le(`/api/db/distribution?${mt}`);c((gt==null?void 0:gt.bindings)||[]),L((gt==null?void 0:gt.total)??((Ze=gt==null?void 0:gt.bindings)==null?void 0:Ze.length)??0)}catch(mt){console.error(mt),N("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const mt=C==="completed"?"success":C==="rejected"?"failed":C,gt=new URLSearchParams({...mt&&mt!=="all"&&{status:mt},page:String(T),pageSize:String(O)}),St=await Le(`/api/admin/withdrawals?${gt}`);if(St!=null&&St.success&&St.withdrawals){const nn=St.withdrawals.map(Lt=>({...Lt,account:Lt.account??"未绑定微信号",status:Lt.status==="success"?"completed":Lt.status==="failed"?"rejected":Lt.status}));h(nn),L((St==null?void 0:St.total)??nn.length)}else St!=null&&St.success||N(`获取提现记录失败: ${(St==null?void 0:St.error)||"未知错误"}`),h([])}catch(mt){console.error(mt),N("加载提现数据失败"),h([])}break}}J(mt=>new Set(mt).add(ne))}catch(bt){console.error(bt)}finally{y(!1)}}}async function X(){N(null),J(ne=>{const Pe=new Set(ne);return Pe.delete(t),Pe}),t==="overview"&&W(),await fe(t,!0)}async function de(ne){if(confirm("确认审核通过并打款?"))try{const Pe=await It("/api/admin/withdrawals",{id:ne,action:"approve"});if(!(Pe!=null&&Pe.success)){const Ze=(Pe==null?void 0:Pe.message)||(Pe==null?void 0:Pe.error)||"操作失败";ae.error(Ze);return}await X()}catch(Pe){console.error(Pe),ae.error("操作失败")}}function he(ne){ie(ne),$("")}async function be(){const ne=z;if(!ne)return;const Pe=G.trim();if(!Pe){ae.error("请填写拒绝原因");return}ce(!0);try{const Ze=await It("/api/admin/withdrawals",{id:ne,action:"reject",errorMessage:Pe});if(!(Ze!=null&&Ze.success)){ae.error((Ze==null?void 0:Ze.error)||"操作失败");return}ae.success("已拒绝该提现申请"),ie(null),$(""),await X()}catch(Ze){console.error(Ze),ae.error("操作失败")}finally{ce(!1)}}function Te(){z&&ae.info("已取消操作"),ie(null),$("")}async function Ve(){var ne;if(!(!(ee!=null&&ee.orderSn)&&!(ee!=null&&ee.id))){re(!0),N(null);try{const Pe=await It("/api/admin/orders/refund",{orderSn:ee.orderSn||ee.id,reason:U||void 0});Pe!=null&&Pe.success?(Y(null),R(""),await fe("orders",!0)):N((Pe==null?void 0:Pe.error)||"退款失败")}catch(Pe){const Ze=Pe;N(((ne=Ze==null?void 0:Ze.data)==null?void 0:ne.error)||"退款失败,请检查网络后重试")}finally{re(!1)}}}function He(ne){const Pe={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"},Ze={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ue,{className:`${Pe[ne]||"bg-gray-500/20 text-gray-400"} border-0`,children:Ze[ne]||ne})}const vt=Math.ceil(P/O)||1,Dt=n,vn=o.filter(ne=>{var Ze,bt,mt,gt;if(!b)return!0;const Pe=b.toLowerCase();return((Ze=ne.refereeNickname)==null?void 0:Ze.toLowerCase().includes(Pe))||((bt=ne.refereePhone)==null?void 0:bt.includes(Pe))||((mt=ne.referrerName)==null?void 0:mt.toLowerCase().includes(Pe))||((gt=ne.referrerCode)==null?void 0:gt.toLowerCase().includes(Pe))}),pt=u.filter(ne=>{var Ze;if(!b)return!0;const Pe=b.toLowerCase();return((Ze=ne.userName)==null?void 0:Ze.toLowerCase().includes(Pe))||ne.account&&ne.account.toLowerCase().includes(Pe)});return s.jsxs("div",{className:"p-8 w-full",children:[w&&s.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:[s.jsx("span",{children:w}),s.jsx("button",{type:"button",onClick:()=>N(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),s.jsxs(te,{onClick:X,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),s.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:Dc},{key:"orders",label:"订单管理",icon:oh},{key:"bindings",label:"绑定管理",icon:ys},{key:"withdrawals",label:"提现审核",icon:wl},{key:"settings",label:"推广设置",icon:io}].map(ne=>s.jsxs("button",{type:"button",onClick:()=>{e(ne.key),E("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===ne.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[s.jsx(ne.icon,{className:"w-4 h-4"}),ne.label]},ne.key))}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Je,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[t==="overview"&&i&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayClicks}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(kg,{className:"w-6 h-6 text-blue-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayUniqueVisitors??0}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:s.jsx(qn,{className:"w-6 h-6 text-cyan-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(i.todayClickRate??0).toFixed(2)}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:s.jsx(Dc,{className:"w-6 h-6 text-amber-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayBindings})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:s.jsx(ys,{className:"w-6 h-6 text-green-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:i.todayConversions})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:s.jsx(Ob,{className:"w-6 h-6 text-purple-400"})})]})})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),s.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",i.todayEarnings.toFixed(2)]})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:s.jsx(oh,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Rt=i.todayClicksByPage)==null?void 0:Rt.length)??0)>0&&s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(rt,{children:[s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(kg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),s.jsx(Ae,{children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),s.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),s.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),s.jsx("tbody",{children:[...i.todayClicksByPage??[]].sort((ne,Pe)=>Pe.clicks-ne.clicks).map((ne,Pe)=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:ne.page||"(未区分)"}),s.jsx("td",{className:"py-2 pr-4 text-right text-white",children:ne.clicks}),s.jsxs("td",{className:"py-2 text-right text-gray-400",children:[i.todayClicks>0?(ne.clicks/i.todayClicks*100).toFixed(1):0,"%"]})]},Pe))})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Me,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:s.jsx(jg,{className:"w-6 h-6 text-orange-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[i.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),s.jsx(Me,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(wl,{className:"w-6 h-6 text-blue-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[i.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",i.pendingWithdrawAmount.toFixed(2)]})]}),s.jsx(te,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(ah,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthClicks})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthBindings})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.monthConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",i.monthEarnings.toFixed(2)]})]})]})})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(Dc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),s.jsxs(Ae,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalClicks.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalBindings.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),s.jsx("p",{className:"text-xl font-bold text-white",children:i.totalConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",i.totalEarnings.toFixed(2)]})]})]}),s.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[s.jsx("span",{className:"text-gray-300",children:"点击转化率"}),s.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[i.conversionRate,"%"]})]})]})]})]}),s.jsxs(Me,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(st,{className:"text-white flex items-center gap-2",children:[s.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-white",children:i.totalDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-green-400",children:i.activeDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[n.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Dt.map(ne=>{var Pe,Ze;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Pe=ne.id)==null?void 0:Pe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:ne.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const bt=ne.productType||ne.type;return bt==="fullbook"?`${ne.bookName||"《底层逻辑》"} - 全本`:bt==="match"?"匹配次数购买":`${ne.bookName||"《底层逻辑》"} - ${ne.sectionTitle||ne.chapterTitle||`章节${ne.productId||ne.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const bt=ne.productType||ne.type;return bt==="fullbook"?"全书解锁":bt==="match"?"功能权益":ne.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof ne.amount=="number"?ne.amount.toFixed(2):parseFloat(String(ne.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:ne.paymentMethod==="wechat"?"微信支付":ne.paymentMethod==="alipay"?"支付宝":ne.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:ne.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):ne.status==="completed"||ne.status==="paid"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):ne.status==="pending"||ne.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:ne.refundReason,children:ne.status==="refunded"&&ne.refundReason?ne.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:ne.referrerId||ne.referralCode?s.jsxs("span",{title:ne.referralCode||ne.referrerCode||ne.referrerId||"",children:[ne.referrerNickname||ne.referralCode||ne.referrerCode||((Ze=ne.referrerId)==null?void 0:Ze.slice(0,8)),(ne.referralCode||ne.referrerCode)&&` (${ne.referralCode||ne.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:ne.referrerEarnings?`¥${(typeof ne.referrerEarnings=="number"?ne.referrerEarnings:parseFloat(String(ne.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:ne.createdAt?new Date(ne.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(ne.status==="paid"||ne.status==="completed")&&s.jsxs(te,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(ne),R("")},children:[s.jsx(QN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},ne.id)})})]})}),t==="orders"&&s.jsx(vs,{page:T,totalPages:vt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]}),t==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"active",children:"有效"}),s.jsx("option",{value:"converted",children:"已转化"}),s.jsx("option",{value:"expired",children:"已过期"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[vn.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:vn.map(ne=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:ne.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:ne.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:ne.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.boundAt?new Date(ne.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.expiresAt?new Date(ne.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(ne.status)}),s.jsx("td",{className:"p-4",children:ne.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",ne.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},ne.id))})]})}),t==="bindings"&&s.jsx(vs,{page:T,totalPages:vt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]}),t==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(ua,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(oe,{value:b,onChange:ne=>k(ne.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:ne=>E(ne.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待审核"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-0",children:[pt.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:pt.map(ne=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[ne.userAvatar?s.jsx("img",{src:ne.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(ne.userName||ne.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:ne.userName||ne.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",ne.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ue,{className:ne.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:ne.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:ne.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:ne.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:ne.createdAt?new Date(ne.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(ne.status)}),s.jsx("td",{className:"p-4 text-right",children:ne.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(te,{size:"sm",onClick:()=>de(ne.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ob,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(te,{size:"sm",variant:"outline",onClick:()=>he(ne.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(UN,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},ne.id))})]})}),t==="withdrawals"&&s.jsx(vs,{page:T,totalPages:vt,total:P,pageSize:O,onPageChange:I,onPageSizeChange:ne=>{D(ne),I(1)}})]})})]})]}),s.jsx(Yt,{open:!!ee,onOpenChange:ne=>!ne&&Y(null),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"订单退款"})}),ee&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ee.orderSn||ee.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ee.amount=="number"?ee.amount.toFixed(2):parseFloat(String(ee.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:U,onChange:ne=>R(ne.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:F,children:"取消"}),s.jsx(te,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Ve,disabled:F,children:F?"退款中...":"确认退款"})]})]})}),s.jsx(Yt,{open:!!z,onOpenChange:ne=>!ne&&Te(),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:G,onChange:ne=>$(ne.target.value)})})]})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Te,disabled:V,children:"取消"}),s.jsx(te,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:be,disabled:V||!G.trim(),children:V?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(Rk,{embedded:!0})})]})}function PP(){const[t,e]=v.useState([]),[n,r]=v.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[i,a]=v.useState(!0),[o,c]=v.useState(null),[u,h]=v.useState("all"),[f,m]=v.useState(1),[g,y]=v.useState(10),[w,N]=v.useState(0),[b,k]=v.useState(null),[C,E]=v.useState(null),[T,I]=v.useState(""),[O,D]=v.useState(!1);async function P(){var R,F,re,z,ie,G,$;a(!0),c(null);try{const V=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),ce=await Le(`/api/admin/withdrawals?${V}`);if(ce!=null&&ce.success){const W=ce.withdrawals||[];e(W),N(ce.total??((R=ce.stats)==null?void 0:R.total)??W.length),r({total:((F=ce.stats)==null?void 0:F.total)??ce.total??W.length,pendingCount:((re=ce.stats)==null?void 0:re.pendingCount)??0,pendingAmount:((z=ce.stats)==null?void 0:z.pendingAmount)??0,successCount:((ie=ce.stats)==null?void 0:ie.successCount)??0,successAmount:((G=ce.stats)==null?void 0:G.successAmount)??0,failedCount:(($=ce.stats)==null?void 0:$.failedCount)??0})}else c("加载提现记录失败")}catch(V){console.error("Load withdrawals error:",V),c("加载失败,请检查网络后重试")}finally{a(!1)}}v.useEffect(()=>{m(1)},[u]),v.useEffect(()=>{P()},[u,f,g]);const L=Math.ceil(w/g)||1;async function _(R){const F=t.find(re=>re.id===R);if(F!=null&&F.userCommissionInfo&&F.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${F.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。
-确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const re=await Mt("/api/admin/withdrawals",{id:R,action:"approve"});re!=null&&re.success?P():ae.error("操作失败: "+((re==null?void 0:re.error)??""))}catch{ae.error("操作失败")}finally{k(null)}}function J(R){E(R),I("")}async function ee(){const R=C;if(!R)return;const F=T.trim();if(!F){ae.error("请填写拒绝原因");return}D(!0);try{const re=await Mt("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:F});re!=null&&re.success?(ae.success("已拒绝该提现申请"),E(null),I(""),P()):ae.error("操作失败: "+((re==null?void 0:re.error)??""))}catch{ae.error("操作失败")}finally{D(!1)}}function Y(){C&&ae.info("已取消操作"),E(null),I("")}function U(R){switch(R){case"pending":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ue,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.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:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(te,{variant:"outline",onClick:P,disabled:i,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ge,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Me,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(ah,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>s.jsx(te,{variant:u===R?"default":"outline",size:"sm",onClick:()=>h(R),className:u===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))}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:i?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ge,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(jl,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?s.jsx("img",{src:R.userAvatar,alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.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)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:R.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[U(R.status),R.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(te,{size:"sm",onClick:()=>_(R.id),disabled:b===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(cf,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(te,{size:"sm",variant:"outline",onClick:()=>J(R.id),disabled:b===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),s.jsx(xs,{page:f,totalPages:L,total:w,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})}),s.jsx(Kt,{open:!!C,onOpenChange:R=>!R&&Y(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(qt,{children:s.jsx(Gt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:T,onChange:R=>I(R.target.value)})})]})]}),s.jsxs(hn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Y,disabled:O,children:"取消"}),s.jsx(te,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ee,disabled:O||!T.trim(),children:O?"提交中...":"确认拒绝"})]})]})})]})}var Om={exports:{}},Dm={};/**
+确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const re=await It("/api/admin/withdrawals",{id:R,action:"approve"});re!=null&&re.success?P():ae.error("操作失败: "+((re==null?void 0:re.error)??""))}catch{ae.error("操作失败")}finally{k(null)}}function J(R){E(R),I("")}async function ee(){const R=C;if(!R)return;const F=T.trim();if(!F){ae.error("请填写拒绝原因");return}D(!0);try{const re=await It("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:F});re!=null&&re.success?(ae.success("已拒绝该提现申请"),E(null),I(""),P()):ae.error("操作失败: "+((re==null?void 0:re.error)??""))}catch{ae.error("操作失败")}finally{D(!1)}}function Y(){C&&ae.info("已取消操作"),E(null),I("")}function U(R){switch(R){case"pending":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ue,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.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:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(te,{variant:"outline",onClick:P,disabled:i,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Je,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Me,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(oh,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>s.jsx(te,{variant:u===R?"default":"outline",size:"sm",onClick:()=>h(R),className:u===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))}),s.jsx(Me,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ae,{className:"p-0",children:i?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Je,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(wl,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?s.jsx("img",{src:R.userAvatar,alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.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)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:R.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[U(R.status),R.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(te,{size:"sm",onClick:()=>_(R.id),disabled:b===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(df,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(te,{size:"sm",variant:"outline",onClick:()=>J(R.id),disabled:b===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(er,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),s.jsx(vs,{page:f,totalPages:L,total:w,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})}),s.jsx(Yt,{open:!!C,onOpenChange:R=>!R&&Y(),children:s.jsxs(Bt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Qt,{children:s.jsx(Xt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(oe,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:T,onChange:R=>I(R.target.value)})})]})]}),s.jsxs(fn,{children:[s.jsx(te,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Y,disabled:O,children:"取消"}),s.jsx(te,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ee,disabled:O||!T.trim(),children:O?"提交中...":"确认拒绝"})]})]})})]})}var Dm={exports:{}},Lm={};/**
* @license React
* use-sync-external-store-shim.production.js
*
@@ -595,19 +595,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var i1;function OP(){if(i1)return Dm;i1=1;var t=cd();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),w=r({inst:{value:y,getSnapshot:g}}),N=w[0].inst,b=w[1];return a(function(){N.value=y,N.getSnapshot=g,u(N)&&b({inst:N})},[m,y,g]),i(function(){return u(N)&&b({inst:N}),m(function(){u(N)&&b({inst:N})})},[m]),o(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Dm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Dm}var a1;function Rk(){return a1||(a1=1,Om.exports=OP()),Om.exports}var Pk=Rk();function Fn(t){this.content=t}Fn.prototype={constructor:Fn,find:function(t){for(var e=0;e>1}};Fn.from=function(t){if(t instanceof Fn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Fn(e)};function Ok(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)n++;return n}if(i.content.size||a.content.size){let o=Ok(i.content,a.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Dk(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=t.child(--i),c=e.child(--a),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,i+c,a||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,i+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:a+=r),a+=h},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);ae)for(let a=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),i+=c.nodeSize),o=u}return new ge(r,i)}cutByIndex(e,n){return e==n?ge.empty:e==0&&n==this.content.length?this:new ge(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new ge(i,a)}addToStart(e){return new ge([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ge(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Au(n+1,a):Au(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ge.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ge(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ge.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}};Rt.none=[];class fh extends Error{}class Ie{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=_k(this.content,e+this.openStart,n);return r&&new Ie(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ie(Lk(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Ie.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ie(ge.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new Ie(e,r,i)}}Ie.empty=new Ie(ge.empty,0,0);function Lk(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(i==e||a.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(Lk(a.content,e-i-1,n-i-1)))}function _k(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),o=t.maybeChild(i);if(a==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=_k(o.content,e-a-1,n,o);return c&&t.replaceChild(i,o.copy(c))}function DP(t,e,n){if(n.openStart>t.depth)throw new fh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new fh("Inconsistent open depths");return zk(t,e,n,0)}function zk(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Dc(t,e,n,r){let i=(e||t).node(n),a=0,o=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(io(t.nodeAfter,r),a++));for(let c=a;ci&&Lg(t,e,i+1),o=r.depth>i&&Lg(n,r,i+1),c=[];return Dc(null,t,i,c),a&&o&&e.index(i)==n.index(i)?($k(a,o),io(ao(a,Fk(t,e,n,r,i+1)),c)):(a&&io(ao(a,ph(t,e,i+1)),c),Dc(e,n,i,c),o&&io(ao(o,ph(n,r,i+1)),c)),Dc(r,null,i,c),new ge(c)}function ph(t,e,n){let r=[];if(Dc(null,t,n,r),t.depth>n){let i=Lg(t,e,n+1);io(ao(i,ph(t,e,n+1)),r)}return Dc(e,null,n,r),new ge(r)}function LP(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(ge.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Yc{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new mh(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(a),h=a-u;if(r.push(o,c,i+u),!h||(o=o.child(c),o.isText))break;a=h-1,i+=u+1}return new Yc(n,r,a)}static resolveCached(e,n){let r=o1.get(e);if(r)for(let a=0;ae&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Bk(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=ge.empty,i=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,a),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=i;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=ge.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};xi.prototype.text=void 0;class gh extends xi{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Bk(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new gh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new gh(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Bk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class mo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new FP(e,n);if(r.next==null)return mo.empty;let i=Vk(r);r.next&&r.err("Unexpected trailing text");let a=qP(KP(i));return GP(a,r),a}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let a=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return a}).join(`
-`)}}mo.empty=new mo(!0);class FP{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Vk(t){let e=[];do e.push(BP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function BP(t){let e=[];do e.push(VP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function VP(t){let e=UP(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=HP(t,e);else break;return e}function l1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function HP(t,e){let n=l1(t),r=n;return t.eat(",")&&(t.next!="}"?r=l1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function WP(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let o=n[a];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function UP(t){if(t.eat("(")){let e=Vk(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=WP(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function KP(t){let e=[[]];return i(a(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function i(o,c){o.forEach(u=>u.to=c)}function a(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(a(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=a(o.exprs[u],c);if(u==o.exprs.length-1)return h;i(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),i(a(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(a(o.expr,c),u),i(a(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(a(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||i.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let a=e[r.join(",")]=new mo(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Uk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new xi(this,this.computeAttrs(e),ge.from(n),Rt.setFrom(r))}createChecked(e=null,n,r){return n=ge.from(n),this.checkContent(n),new xi(this,this.computeAttrs(e),n,Rt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ge.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(ge.empty,!0);return a?new xi(this,e,n.append(a),Rt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[a]=new Gk(a,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function JP(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class YP{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?JP(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class xf{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=qk(e,i.attrs),this.excluded=null;let a=Wk(this.attrs);this.instance=a?new Rt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Rt(this,Uk(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,o)=>r[a]=new xf(a,i++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class Jk{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Fn.from(e.nodes),n.marks=Fn.from(e.marks||{}),this.nodes=d1.compile(this.spec.nodes,this),this.marks=xf.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],o=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=mo.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=c=="_"?null:c?u1(this,c.split(" ")):c==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:u1(this,o.split(" "))}this.nodeFromJSON=i=>xi.fromJSON(this,i),this.markFromJSON=i=>Rt.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof d1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new gh(r,r.defaultAttrs,e,Rt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function u1(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function QP(t){return t.tag!=null}function XP(t){return t.style!=null}class ha{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(QP(i))this.tags.push(i);else if(XP(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new f1(this,n,!1);return r.addAll(e,Rt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new f1(this,n,!0);return r.addAll(e,Rt.none,n.from,n.to),Ie.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let a=i.priority==null?50:i.priority,o=0;for(;o{r(o=p1(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{r(o=p1(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ha(e,ha.schemaRules(e)))}}const Yk={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ZP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Qk={ol:!0,ul:!0},Qc=1,zg=2,Lc=4;function h1(t,e,n){return e!=null?(e?Qc:0)|(e==="full"?zg:0):t&&t.whitespace=="pre"?Qc|zg:n&~Lc}class Iu{constructor(e,n,r,i,a,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Rt.none,this.match=a||(o&Lc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ge.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qc)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=ge.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ge.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Yk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class f1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,o=h1(null,n.preserveWhitespace,0)|(r?Lc:0);i?a=new Iu(i.type,i.attrs,Rt.none,!0,n.topMatch||i.type.contentMatch,o):r?a=new Iu(null,null,Rt.none,!0,null,o):a=new Iu(e.schema.topNodeType,null,Rt.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,a=i.options&zg?"full":this.localPreserveWS||(i.options&Qc)>0,{schema:o}=this.parser;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,`
-`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,i){let a,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(a=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}a&&this.sync(c)&&this.open--}addAll(e,n,r,i){let a=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];o!=c;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,n);this.findAtPoint(e,a)}findPlace(e,n,r){let i,a;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!i||i.length>h.length+c)&&(i=h,a=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!i)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):m1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Iu(e,n,u,i,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Qc)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=a;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&i?this.nodes[u].type:r&&u>=a?r.node(u-a).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function eO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Qk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function tO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function p1(t){let e={};for(let n in t)e[n]=t[n];return e}function m1(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let a=[],o=c=>{a.push(c);for(let u=0;u{if(a.length||o.marks.length){let c=0,u=0;for(;c=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Yu(_m(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Yu(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new So(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=g1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return g1(e.marks)}}function g1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function _m(t){return t.document||window.document}const x1=new WeakMap;function nO(t){let e=x1.get(t);return e===void 0&&x1.set(t,e=rO(t)),e}function rO(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let c,u=n?t.createElementNS(n,i):t.createElement(i),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:w}=Yu(t,g,n,r);if(u.appendChild(y),w){if(c)throw new RangeError("Multiple content holes");c=w}}}return{dom:u,contentDOM:c}}const Xk=65535,Zk=Math.pow(2,16);function sO(t,e){return t+e*Zk}function y1(t){return t&Xk}function iO(t){return(t-(t&Xk))/Zk}const eS=1,tS=2,Qu=4,nS=8;class $g{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&nS)>0}get deletedBefore(){return(this.delInfo&(eS|Qu))>0}get deletedAfter(){return(this.delInfo&(tS|Qu))>0}get deletedAcross(){return(this.delInfo&Qu)>0}}class Pr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Pr.empty)return Pr.empty}recover(e){let n=0,r=y1(e);if(!this.inverted)for(let i=0;ie)break;let h=this.ranges[c+a],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+i+(g<0?0:f);if(r)return y;let w=e==(n<0?u:m)?null:sO(c/3,e-u),N=e==u?tS:e==m?eS:Qu;return(n<0?e!=u:e!=m)&&(N|=nS),new $g(y,N,w)}i+=f-h}return r?e+i:new $g(e+i,0,null)}touches(e,n){let r=0,i=y1(n),a=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+a],f=u+h;if(e<=f&&c==i*3)return!0;r+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Xc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ra&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return bn.fromReplace(e,this.from,this.to,a)}invert(){return new ms(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new aa(n.pos,r.pos,this.mark)}merge(e){return e instanceof aa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new aa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new aa(n.from,n.to,e.markFromJSON(n.mark))}}ir.jsonID("addMark",aa);class ms extends ir{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Ie(Xx(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return bn.fromReplace(e,this.from,this.to,r)}invert(){return new aa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ms(n.pos,r.pos,this.mark)}merge(e){return e instanceof ms&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ms(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ms(n.from,n.to,e.markFromJSON(n.mark))}}ir.jsonID("removeMark",ms);class oa extends ir{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return bn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return bn.fromReplace(e,this.pos,this.pos+1,new Ie(ge.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new On(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new On(n.from,n.to,n.gapFrom,n.gapTo,Ie.fromJSON(e,n.slice),n.insert,!!n.structure)}}ir.jsonID("replaceAround",On);function Fg(t,e,n){let r=t.resolve(e),i=n-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function aO(t,e,n,r){let i=[],a=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),y=Math.min(h+u.nodeSize,n),w=r.addToSet(m);for(let N=0;Nt.step(u)),a.forEach(u=>t.step(u))}function oO(t,e,n,r){let i=[],a=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;a++;let u=null;if(r instanceof xf){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new ms(o.from,o.to,o.style)))}function Zx(t,e,n,r=n.contentMatch,i=!0){let a=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function lO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $l(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,a=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+i,u=t.$to.indexAfter(r)-a;if(rn;w--)N||r.index(w)>0?(N=!0,f=ge.from(r.node(w).copy(f)),m++):u--;let g=ge.empty,y=0;for(let w=a,N=!1;w>n;w--)N||i.after(w+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ge.from(n[o].type.create(n[o].attrs,r))}let i=e.start,a=e.end;t.step(new On(i,a,i,a,new Ie(r,0,0),n.length,!0))}function fO(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&pO(t.doc,t.mapping.slice(a).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",w=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!w?h=!1:!y&&w&&(h=!0)}h===!1&&sS(t,o,c,a),Zx(t,t.mapping.slice(a).map(c,1),r,void 0,h===null);let f=t.mapping.slice(a),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new On(m,g,m+1,g-1,new Ie(ge.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&rS(t,o,c,a),!1}})}function rS(t,e,n,r){e.forEach((i,a)=>{if(i.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(i.text);){let u=t.mapping.slice(r).map(n+1+a+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function sS(t,e,n,r){e.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+a);t.replaceWith(o,o+1,e.type.schema.text(`
-`))}})}function pO(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function mO(t,e,n,r,i){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let o=n.create(r,null,i||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,o);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new On(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new Ie(ge.from(o),0,0),1,!0))}function yi(t,e,n=1,r){let i=t.resolve(e),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,f=n-2;h>a;h--,f--){let m=i.node(h),g=i.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),w=r&&r[f+1];w&&(y=y.replaceChild(0,w.type.create(w.attrs)));let N=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!N.type.validContent(y))return!1}let c=i.indexAfter(a),u=r&&r[0];return i.node(a).canReplaceWith(c,c,u?u.type:i.node(a+1).type)}function gO(t,e,n=1,r){let i=t.doc.resolve(e),a=ge.empty,o=ge.empty;for(let c=i.depth,u=i.depth-n,h=n-1;c>u;c--,h--){a=ge.from(i.node(c).copy(a));let f=r&&r[h];o=ge.from(f?f.type.create(f.attrs,o):i.node(c).copy(o))}t.step(new Pn(e,e,new Ie(a.append(o),n,n),!0))}function Sa(t,e){let n=t.resolve(e),r=n.index();return iS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function xO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i0?(a=r.node(i+1),c++,o=r.node(i).maybeChild(c)):(a=r.node(i).maybeChild(c-1),o=r.node(i+1)),a&&!a.isTextblock&&iS(a,o)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function yO(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,a=t.doc.resolve(e-n),o=a.node().type;if(i&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(i);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);sS(t,f.node(),f.before(),c)}o.inlineContent&&Zx(t,e+n-1,o,a.node().contentMatchAt(a.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new Pn(h,u.map(e+n,-1),Ie.empty,!0)),r===!0){let f=t.doc.resolve(h);rS(t,f.node(),f.before(),t.steps.length)}return t}function vO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let a=r.index(i);if(r.node(i).canReplaceWith(a,a,n))return r.before(i+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let a=r.indexAfter(i);if(r.node(i).canReplaceWith(a,a,n))return r.after(i+1);if(a=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>0?1:0),h=r.node(o),f=!1;if(a==1)f=h.canReplace(u,u,i);else{let m=h.contentMatchAt(u).findWrapping(i.firstChild.type);f=m&&h.canReplaceWith(u,u,m[0])}if(f)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function vf(t,e,n=e,r=Ie.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),a=t.resolve(n);return oS(i,a,r)?new Pn(e,n,r):new bO(i,a,r).fit()}function oS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class bO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ge.empty;for(let i=0;i<=e.depth;i++){let a=e.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=ge.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let a=this.placed,o=r.depth,c=i.depth;for(;o&&c&&a.childCount==1;)a=a.firstChild.content,o--,c--;let u=new Ie(a,o,c);return e>-1?new On(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Pn(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),a.type.spec.isolating&&i<=r){e=r;break}n=a.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,a=null;r?(a=$m(this.unplaced.content,r-1).firstChild,i=a.content):i=this.unplaced.content;let o=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(ge.from(o),!1)):a&&u.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:c,parent:a,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:a,wrap:f};if(a&&h.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=$m(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Ie(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=$m(e,n);if(i.childCount<=1&&n>0){let a=e.size-n<=n+i.size;this.unplaced=new Ie(Ec(e,n-1,1),n-1,a?n-1:r)}else this.unplaced=new Ie(Ec(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let N=0;N1||u==0||N.content.size)&&(m=b,f.push(lS(N.mark(g.allowedMarks(N.marks)),h==1?u:0,h==c.childCount?y:-1)))}let w=h==c.childCount;w||(y=-1),this.placed=Tc(this.placed,n,ge.from(f)),this.frontier[n].match=m,w&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,b=c;N1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],a=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Fm(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Tc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),a=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,a)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Tc(this.placed,this.depth,ge.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ge.empty,!0);n.childCount&&(this.placed=Tc(this.placed,this.frontier.length,n))}}function Ec(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ec(t.firstChild.content,e-1,n)))}function Tc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Tc(t.lastChild.content,e-1,n)))}function $m(t,e){for(let n=0;n1&&(r=r.replaceChild(0,lS(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(ge.empty,!0)))),t.copy(r)}function Fm(t,e,n,r,i){let a=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let c=r.fillBefore(a.content,!0,o);return c&&!wO(n,a.content,o)?c:null}function wO(t,e,n){for(let r=n;r0;g--,y--){let w=i.node(g).type.spec;if(w.defining||w.definingAsContext||w.isolating)break;o.indexOf(g)>-1?c=g:i.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,y=0;;y++){let w=g.firstChild;if(h.push(w),y==r.openStart)break;g=w.content}for(let g=f-1;g>=0;g--){let y=h[g],w=NO(y.type);if(w&&!y.sameMarkup(i.node(Math.abs(c)-1)))f=g;else if(w||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),w=h[y];if(w)for(let N=0;N=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=i.before(y),n=a.after(y))}}function cS(t,e,n,r,i){if(er){let a=i.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(ge.empty,!0))}return t}function kO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=vO(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Ie(ge.from(r),0,0))}function SO(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),a=dS(r,i);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function dS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let a=t.start(i);if(ae.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(a==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==a-1)&&n.push(i)}return n}class bl extends ir{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return bn.fail("No node at attribute step's position");let r=Object.create(null);for(let a in n.attrs)r[a]=n.attrs[a];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return bn.fromReplace(e,this.pos,this.pos+1,new Ie(ge.from(i),0,n.isLeaf?0:1))}getMap(){return Pr.empty}invert(e){return new bl(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new bl(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new bl(n.pos,n.attr,n.value)}}ir.jsonID("attr",bl);class Zc extends ir{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return bn.ok(r)}getMap(){return Pr.empty}invert(e){return new Zc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Zc(n.attr,n.value)}}ir.jsonID("docAttr",Zc);let kl=class extends Error{};kl=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};kl.prototype=Object.create(Error.prototype);kl.prototype.constructor=kl;kl.prototype.name="TransformError";class t0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Xc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new kl(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Ie.empty){let i=vf(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Ie(ge.from(r),0,0))}delete(e,n){return this.replace(e,n,Ie.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return jO(this,e,n,r),this}replaceRangeWith(e,n,r){return kO(this,e,n,r),this}deleteRange(e,n){return SO(this,e,n),this}lift(e,n){return cO(this,e,n),this}join(e,n=1){return yO(this,e,n),this}wrap(e,n){return hO(this,e,n),this}setBlockType(e,n=e,r,i=null){return fO(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return mO(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new bl(e,n,r)),this}setDocAttribute(e,n){return this.step(new Zc(e,n)),this}addNodeMark(e,n){return this.step(new oa(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Rt)n.isInSet(r.marks)&&this.step(new go(e,n));else{let i=r.marks,a,o=[];for(;a=n.isInSet(i);)o.push(new go(e,a)),i=a.removeFromSet(i);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return gO(this,e,n,r),this}addMark(e,n,r){return aO(this,e,n,r),this}removeMark(e,n,r){return oO(this,e,n,r),this}clearIncompatible(e,n,r){return Zx(this,e,n,r),this}}const Bm=Object.create(null);class Ze{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new uS(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;a--){let o=n<0?ll(e.node(0),e.node(a),e.before(a+1),e.index(a),n,r):ll(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Dr(e.node(0))}static atStart(e){return ll(e,e,0,0,1)||new Dr(e)}static atEnd(e){return ll(e,e,e.content.size,e.childCount,-1)||new Dr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Bm[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Bm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Bm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return qe.between(this.$anchor,this.$head).getBookmark()}}Ze.prototype.visible=!0;class uS{constructor(e,n){this.$from=e,this.$to=n}}let b1=!1;function w1(t){!b1&&!t.parent.inlineContent&&(b1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class qe extends Ze{constructor(e,n=e){w1(e),w1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ze.near(r);let i=e.resolve(n.map(this.anchor));return new qe(i.parent.inlineContent?i:r,r)}replace(e,n=Ie.empty){if(super.replace(e,n),n==Ie.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof qe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new qe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let a=Ze.findFrom(n,r,!0)||Ze.findFrom(n,-r,!0);if(a)n=a.$head;else return Ze.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ze.findFrom(e,-r,!0)||Ze.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let c=e.child(o);if(c.isAtom){if(!a&&Ke.isSelectable(c))return Ke.create(t,n-(i<0?c.nodeSize:0))}else{let u=ll(t,c,n+i,i<0?c.childCount:0,i,a);if(u)return u}n+=c.nodeSize*i}return null}function N1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(Ze.near(t.doc.resolve(o),n))}const j1=1,Ru=2,k1=4;class EO extends t0{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ru,this}ensureMarks(e){return Rt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ru)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ru,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Rt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let a=this.storedMarks;if(!a){let o=this.doc.resolve(n);a=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ze.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=k1,this}get scrolledIntoView(){return(this.updated&k1)>0}}function S1(t,e){return!e||!t?t:t.bind(e)}class Mc{constructor(e,n,r){this.name=e,this.init=S1(n.init,r),this.apply=S1(n.apply,r)}}const TO=[new Mc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Mc("selection",{init(t,e){return t.selection||Ze.atStart(e.doc)},apply(t){return t.selection}}),new Mc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Mc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Vm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=TO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Mc(r.key,r.spec.state,r))})}}class gl{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],a=i.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Vm(e.schema,e.plugins),a=new gl(i);return i.fields.forEach(o=>{if(o.name=="doc")a.doc=xi.fromJSON(e.schema,n.doc);else if(o.name=="selection")a.selection=Ze.fromJSON(a.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){a[o.name]=h.fromJSON.call(u,e,n[c],a);return}}a[o.name]=o.init(e,a)}}),a}}function hS(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=hS(i,e,{})),n[r]=i}return n}class Bt{constructor(e){this.spec=e,this.props={},e.props&&hS(e.props,this,this.props),this.key=e.key?e.key.key:fS("plugin")}getState(e){return e[this.key]}}const Hm=Object.create(null);function fS(t){return t in Hm?t+"$"+ ++Hm[t]:(Hm[t]=0,t+"$")}class Qt{constructor(e="key"){this.key=fS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const r0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function pS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const mS=(t,e,n)=>{let r=pS(t,n);if(!r)return!1;let i=s0(r);if(!i){let o=r.blockRange(),c=o&&$l(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let a=i.nodeBefore;if(kS(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Sl(a,"end")||Ke.isSelectable(a)))for(let o=r.depth;;o--){let c=vf(t.doc,r.before(o),r.after(o),Ie.empty);if(c&&c.slice.size1)break}return a.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},MO=(t,e,n)=>{let r=pS(t,n);if(!r)return!1;let i=s0(r);return i?gS(t,i,e):!1},AO=(t,e,n)=>{let r=yS(t,n);if(!r)return!1;let i=i0(r);return i?gS(t,i,e):!1};function gS(t,e,n){let r=e.nodeBefore,i=r,a=e.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let o=e.nodeAfter,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let f=c.firstChild;if(!f)return!1;c=f}let h=vf(t.doc,a,u,Ie.empty);if(!h||h.from!=a||h instanceof Pn&&h.slice.size>=u-a)return!1;if(n){let f=t.tr.step(h);f.setSelection(qe.create(f.doc,a)),n(f.scrollIntoView())}return!0}function Sl(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const xS=(t,e,n)=>{let{$head:r,empty:i}=t.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=s0(r)}let o=a&&a.nodeBefore;return!o||!Ke.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ke.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function s0(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function yS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=yS(t,n);if(!r)return!1;let i=i0(r);if(!i)return!1;let a=i.nodeAfter;if(kS(t,i,e,1))return!0;if(r.parent.content.size==0&&(Sl(a,"start")||Ke.isSelectable(a))){let o=vf(t.doc,r.before(),r.after(),Ie.empty);if(o&&o.slice.size{let{$head:r,empty:i}=t.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Ke,i;if(r){if(n.node.isTextblock||!Sa(t.doc,n.from))return!1;i=n.from}else if(i=yf(t.doc,n.from,-1),i==null)return!1;if(e){let a=t.tr.join(i);r&&a.setSelection(Ke.create(a.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},RO=(t,e)=>{let n=t.selection,r;if(n instanceof Ke){if(n.node.isTextblock||!Sa(t.doc,n.to))return!1;r=n.to}else if(r=yf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},PO=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),a=i&&$l(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)},wS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
-`).scrollIntoView()),!0)};function a0(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=a0(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(Ze.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},NS=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Dr||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=a0(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(yi(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),i=r&&$l(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function DO(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Ke&&e.selection.node.isBlock)return!r.parentOffset||!yi(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=a0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),a.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;a.unshift(null)}let f=e.tr;(e.selection instanceof qe||e.selection instanceof Dr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=yi(f.doc,m,a.length,a);if(g||(a[0]=c?{type:c}:null,g=yi(f.doc,m,a.length,a)),!g)return!1;if(f.split(m,a.length,a),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),w=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(w.index(),w.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const LO=DO(),_O=(t,e)=>{let{$from:n,to:r}=t.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),e&&e(t.tr.setSelection(Ke.create(t.doc,i))),!0)};function zO(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,a=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(a-1,a)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(i.isTextblock||Sa(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function kS(t,e,n,r){let i=e.nodeBefore,a=e.nodeAfter,o,c,u=i.type.spec.isolating||a.type.spec.isolating;if(!u&&zO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&c.matchType(o[0]||a.type).validEnd){if(n){let y=e.pos+a.nodeSize,w=ge.empty;for(let k=o.length-1;k>=0;k--)w=ge.from(o[k].create(null,w));w=ge.from(i.copy(w));let N=t.tr.step(new On(e.pos-1,y,e.pos,y,new Ie(w,1,0),o.length,!0)),b=N.doc.resolve(y+2*o.length);b.nodeAfter&&b.nodeAfter.type==i.type&&Sa(N.doc,b.pos)&&N.join(b.pos),n(N.scrollIntoView())}return!0}let f=a.type.spec.isolating||r>0&&u?null:Ze.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&$l(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Sl(a,"start",!0)&&Sl(i,"end")){let y=i,w=[];for(;w.push(y),!y.isTextblock;)y=y.lastChild;let N=a,b=1;for(;!N.isTextblock;N=N.firstChild)b++;if(y.canReplace(y.childCount,y.childCount,N.content)){if(n){let k=ge.empty;for(let E=w.length-1;E>=0;E--)k=ge.from(w[E].copy(k));let C=t.tr.step(new On(e.pos-w.length,e.pos+a.nodeSize,e.pos+b,e.pos+a.nodeSize-b,new Ie(k,w.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function SS(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(e.tr.setSelection(qe.create(e.doc,t<0?i.start(a):i.end(a)))),!0):!1}}const $O=SS(-1),FO=SS(1);function BO(t,e=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),c=o&&e0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function C1(t,e=null){return function(n,r){let i=!1;for(let a=0;a{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let f=n.doc.resolve(h),m=f.index();i=f.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let a=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);a=new mh(u,u,e.depth),e.endIndex=0;f--)a=ge.from(n[f].type.create(n[f].attrs,a));t.step(new On(e.start-(r?2:0),e.end,e.start,e.end,new Ie(a,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return a?n?r.node(a.depth-1).type==t?KO(e,n,t,a):qO(e,n,a):!0:!1}}function KO(t,e,n,r){let i=t.tr,a=r.end,o=r.$to.end(r.depth);aN;w--)y-=i.child(w).nodeSize,r.delete(y-1,y+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==i.childCount,h=a.node(-1),f=a.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?ge.empty:ge.from(i))))return!1;let m=a.pos,g=m+o.nodeSize;return r.step(new On(m-(c?1:0),g+(u?1:0),m+1,g-1,new Ie((c?ge.empty:ge.from(i.copy(ge.empty))).append(u?ge.empty:ge.from(i.copy(ge.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function GO(t){return function(e,n){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==t);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let c=a.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=ge.from(h?t.create():null),m=new Ie(ge.from(t.create(null,ge.from(c.type.create(null,f)))),h?3:1,0),g=a.start,y=a.end;n(e.tr.step(new On(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Vn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Cl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Bg=null;const pi=function(t,e,n){let r=Bg||(Bg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},JO=function(){Bg=null},xo=function(t,e,n,r){return n&&(E1(t,e,n,r,-1)||E1(t,e,n,r,1))},YO=/^(img|br|input|textarea|hr)$/i;function E1(t,e,n,r,i){for(var a;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Jr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||pd(t)||YO.test(t.nodeName)||t.contentEditable=="false")return!1;e=Vn(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Jr(t):0}else return!1}}function Jr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function QO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Jr(t)}else if(t.parentNode&&!pd(t))e=Vn(t),t=t.parentNode;else return null}}function XO(t,e){for(;;){if(t.nodeType==3&&e2),Gr=El||(zs?/Mac/.test(zs.platform):!1),TS=zs?/Win/.test(zs.platform):!1,gi=/Android \d/.test(Ca),md=!!T1&&"webkitFontSmoothing"in T1.documentElement.style,nD=md?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function rD(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ci(t,e){return typeof t=="number"?t:t[e]}function sD(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function M1(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Cl(o);continue}let c=o,u=c==a.body,h=u?rD(a):sD(c),f=0,m=0;if(e.toph.bottom-ci(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+ci(i,"top")-h.top:e.bottom-h.bottom+ci(i,"bottom")),e.lefth.right-ci(r,"right")&&(f=e.right-h.right+ci(i,"right")),f||m)if(u)a.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,w=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let N=c.scrollLeft-y,b=c.scrollTop-w;e={left:e.left-N,top:e.top-b,right:e.right-N,bottom:e.bottom-b}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:Cl(o)}}function iD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let a=(e.left+e.right)/2,o=n+1;o=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack:MS(t.dom)}}function MS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Cl(r));return e}function aD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;AS(n,r==0?0:r-e)}function AS(t,e){for(let n=0;n=c){o=Math.max(w.bottom,o),c=Math.min(w.top,c);let N=w.left>e.left?w.left-e.left:w.right=(w.left+w.right)/2?1:0));continue}}else w.top>e.top&&!u&&w.left<=e.left&&w.right>=e.left&&(u=f,h={left:Math.max(w.left,Math.min(w.right,e.left)),top:w.top});!n&&(e.left>=w.right&&e.top>=w.top||e.left>=w.left&&e.top>=w.bottom)&&(a=m+1)}}return!n&&u&&(n=u,i=h,r=0),n&&n.nodeType==3?lD(n,i):!n||r&&n.nodeType==1?{node:t,offset:a}:IS(n,i)}function lD(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function l0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function cD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,a)}function uD(t,e,n,r){let i=-1;for(let a=e,o=!1;a!=t.dom;){let c=t.docView.nearestDesc(a,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?i=c.posBefore:(!o&&u.right-1?i:t.docView.posFromDOM(e,n,-1)}function RS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let h;md&&i&&r.nodeType==1&&(h=r.childNodes[i-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=uD(t,r,i,e))}c==null&&(c=dD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function A1(t){return t.top=0&&i==r.nodeValue.length?(u--,f=1):n<0?u--:h++,jc(Qi(pi(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Jr(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Wm(u.getBoundingClientRect(),!1)}if(a==null&&i=0)}if(a==null&&i&&(n<0||i==Jr(r))){let u=r.childNodes[i-1],h=u.nodeType==3?pi(u,Jr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return jc(Qi(h,1),!1)}if(a==null&&i=0)}function jc(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Wm(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function OS(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function pD(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return OS(t,e,()=>{let{node:a}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(a,!0);if(!c)break;if(c.node.isBlock){a=c.contentDOM||c.dom;break}a=c.dom.parentNode}let o=PS(t,i.pos,1);for(let c=a.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=pi(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const mD=/[\u0590-\u08ac]/;function gD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,c=t.domSelection();return c?!mD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?a:o:OS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:w,focusOffset:N}=t.domSelectionRange(),b=w&&!y.contains(w.nodeType==1?w:w.parentNode)||u==w&&h==N;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),b}):r.pos==r.start()||r.pos==r.end()}let I1=null,R1=null,P1=!1;function xD(t,e,n){return I1==e&&R1==n?P1:(I1=e,R1=n,P1=n=="up"||n=="down"?pD(t,e,n):gD(t,e,n))}const Xr=0,O1=1,eo=2,$s=3;class gd{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Xr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nVn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let a=this.getDesc(i),o;if(a&&(!n||a.node))if(r&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return a}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof LS){i=e-a;break}a=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof DS&&a.side>=0;r--);if(n<=0){let a,o=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,o=!1);return a&&n&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?Vn(a.dom)+1:0}}else{let a,o=!0;for(;a=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Vn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fw&&on){let w=c;c=u,u=w}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let c=r+a.border,u=o-a.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?eo:O1,e==c&&n==u&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=$s:a.markDirty(e-c,n-c);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?eo:$s}r=o}this.dirty=eo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?eo:O1;n.dirty{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,a=this}matchesWidget(e){return this.dirty==Xr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class yD extends gd{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class yo extends gd{constructor(e,n,r,i,a){super(e,[],r,i),this.mark=n,this.spec=a}static create(e,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=So.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new yo(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&$s||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$s&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Xr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=Kg(a,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,i),f=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:m}=So.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=$S(f,r,n),h?u=new vD(e,n,r,i,f,m||null,g,h,a,o+1):n.isText?new Nf(e,n,r,i,f,g,a):new pa(e,n,r,i,f,m||null,g,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ge.empty)}return e}matchesNode(e,n,r){return this.dirty==Xr&&e.eq(this.node)&&xh(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,a=e.composing?this.localCompositionInfo(e,n):null,o=a&&a.pos>-1?a:null,c=a&&a.pos<0,u=new wD(this,o&&o.node,e);kD(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?Rt.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,i)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>i&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,i)||u.addNode(h,f,m,e,i),i+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==eo)&&(o&&this.protectLocalComposition(e,o),_S(this.contentDOM,this.children,e),El&&SD(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof qe)||rn+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,c=CD(this.node.content,o,r-n,i-n);return c<0?null:{node:a,pos:c,text:o}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new yD(this,a,n,i);e.input.compositionNodes.push(o),this.children=Kg(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==$s||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Xr}updateOuterDeco(e){if(xh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=zS(this.dom,this.nodeDOM,Ug(this.outerDeco,this.node,n),Ug(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function D1(t,e,n,r,i){$S(r,e,t);let a=new pa(void 0,t,e,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}class Nf extends pa{constructor(e,n,r,i,a,o,c){super(e,n,r,i,a,null,o,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==$s||this.dirty!=Xr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Xr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Xr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),a=document.createTextNode(i.text);return new Nf(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=$s)}get domAtom(){return!1}isText(e){return this.node.text==e}}class LS extends gd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class vD extends pa{constructor(e,n,r,i,a,o,c,u,h,f){super(e,n,r,i,a,o,c,h,f),this.spec=u}update(e,n,r,i){if(this.dirty==$s)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,n,r);return a&&this.updateInner(e,n,r,i),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function _S(t,e,n){let r=t.firstChild,i=!1;for(let a=0;a>1,c=Math.min(o,e.length);for(;a-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=yo.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let a=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))a=this.top.children.indexOf(o,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof yo)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(i-1))break;--i,a.set(c,i),o.push(c)}}return{index:i,matched:a,matches:o.reverse()}}function jD(t,e){return t.type.side-e.type.side}function kD(t,e,n,r){let i=e.locals(t),a=0;if(i.length==0){for(let h=0;ha;)c.push(i[o++]);let w=a+g.nodeSize;if(g.isText){let b=w;o!b.inline):c.slice();r(g,N,e.forChild(a,g),y),a=w}}function SD(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function CD(t,e,n,r){for(let i=0,a=0;i=n){if(a>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function Kg(t,e,n,r,i){let a=[];for(let o=0,c=0;o=n||f<=e?a.push(u):(hn&&a.push(u.slice(n-h,u.size,r)))}return a}function c0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(wf(n)){for(u=o;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Ke.isSelectable(m)&&i.parent&&!(m.isInline&&ZO(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;h=new Ke(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!FS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function TD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Vn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&kr&&fa<=11&&(n.disabled=!0,n.disabled=!1)}function BS(t,e){if(e instanceof Ke){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(F1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else F1(t)}function F1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function d0(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||qe.between(e,n,r)}function B1(t){return t.editable&&!t.hasFocus()?!1:VS(t)}function VS(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function MD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return xo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qg(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&Ze.findFrom(a,e)}function Xi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function V1(t,e,n){let r=t.state.selection;if(r instanceof qe)if(n.indexOf("s")>-1){let{$head:i}=r,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+a.nodeSize*(e<0?-1:1));return Xi(t,new qe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=qg(t.state,e);return i&&i instanceof Ke?Xi(t,i):!1}else if(!(Gr&&n.indexOf("m")>-1)){let i=r.$head,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!a||a.isText)return!1;let c=e<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ke.isSelectable(a)?Xi(t,new Ke(e<0?t.state.doc.resolve(i.pos-a.nodeSize):i)):md?Xi(t,new qe(t.state.doc.resolve(e<0?c:c+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ke&&r.node.isInline)return Xi(t,new qe(e>0?r.$to:r.$from));{let i=qg(t.state,e);return i?Xi(t,i):!1}}}function yh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ol(t,e){return e<0?AD(t):ID(t)}function AD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,a,o=!1;for(Qr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(zc(c,-1))i=n,a=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(HS(n))break;{let c=n.previousSibling;for(;c&&zc(c,-1);)i=n.parentNode,a=Vn(c),c=c.previousSibling;if(c)n=c,r=yh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Gg(t,n,r):i&&Gg(t,i,a)}function ID(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=yh(n),a,o;for(;;)if(r{t.state==i&&vi(t)},50)}function H1(t,e){let n=t.state.doc.resolve(e);if(!(Wn||TS)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>i.top&&o1)return a.lefti.top&&o1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function W1(t,e,n){let r=t.state.selection;if(r instanceof qe&&!r.empty||n.indexOf("s")>-1||Gr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=qg(t.state,e);if(o&&o instanceof Ke)return Xi(t,o)}if(!i.parent.inlineContent){let o=e<0?i:a,c=r instanceof Dr?Ze.near(o,e):Ze.findFrom(o,e);return c?Xi(t,c):!1}return!1}function U1(t,e){if(!(t.state.selection instanceof qe))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let o=t.state.tr;return e<0?o.delete(n.pos-a.nodeSize,n.pos):o.delete(n.pos,n.pos+a.nodeSize),t.dispatch(o),!0}return!1}function K1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function OD(t){if(!rr||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;K1(t,r,"true"),setTimeout(()=>K1(t,r,"false"),20)}return!1}function DD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function LD(t,e){let n=e.keyCode,r=DD(e);if(n==8||Gr&&n==72&&r=="c")return U1(t,-1)||ol(t,-1);if(n==46&&!e.shiftKey||Gr&&n==68&&r=="c")return U1(t,1)||ol(t,1);if(n==13||n==27)return!0;if(n==37||Gr&&n==66&&r=="c"){let i=n==37?H1(t,t.state.selection.from)=="ltr"?-1:1:-1;return V1(t,i,r)||ol(t,i)}else if(n==39||Gr&&n==70&&r=="c"){let i=n==39?H1(t,t.state.selection.from)=="ltr"?1:-1:1;return V1(t,i,r)||ol(t,i)}else{if(n==38||Gr&&n==80&&r=="c")return W1(t,-1,r)||ol(t,-1);if(n==40||Gr&&n==78&&r=="c")return OD(t)||W1(t,1,r)||ol(t,1);if(r==(Gr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function u0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:i,openEnd:a}=e;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||So.fromSchema(t.state.schema),c=JS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=GS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let w=c.createElement(f[y]);for(;u.firstChild;)w.appendChild(u.firstChild);u.appendChild(w),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${a}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,`
+ */var a1;function OP(){if(a1)return Lm;a1=1;var t=dd();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),w=r({inst:{value:y,getSnapshot:g}}),N=w[0].inst,b=w[1];return a(function(){N.value=y,N.getSnapshot=g,u(N)&&b({inst:N})},[m,y,g]),i(function(){return u(N)&&b({inst:N}),m(function(){u(N)&&b({inst:N})})},[m]),o(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Lm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Lm}var o1;function Pk(){return o1||(o1=1,Dm.exports=OP()),Dm.exports}var Ok=Pk();function Vn(t){this.content=t}Vn.prototype={constructor:Vn,find:function(t){for(var e=0;e>1}};Vn.from=function(t){if(t instanceof Vn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Vn(e)};function Dk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),a=e.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let o=0;i.text[o]==a.text[o];o++)n++;return n}if(i.content.size||a.content.size){let o=Dk(i.content,a.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Lk(t,e,n,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=t.child(--i),c=e.child(--a),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,i+c,a||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,i+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let a="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:a+=r),a+=h},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);ae)for(let a=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),i+=c.nodeSize),o=u}return new ge(r,i)}cutByIndex(e,n){return e==n?ge.empty:e==0&&n==this.content.length?this:new ge(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new ge(i,a)}addToStart(e){return new ge([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ge(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=e)return a==e?Iu(n+1,a):Iu(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ge.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ge(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ge.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}};Ot.none=[];class ph extends Error{}class Ie{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=zk(this.content,e+this.openStart,n);return r&&new Ie(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ie(_k(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Ie.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ie(ge.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new Ie(e,r,i)}}Ie.empty=new Ie(ge.empty,0,0);function _k(t,e,n){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(i==e||a.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(_k(a.content,e-i-1,n-i-1)))}function zk(t,e,n,r){let{index:i,offset:a}=t.findIndex(e),o=t.maybeChild(i);if(a==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=zk(o.content,e-a-1,n,o);return c&&t.replaceChild(i,o.copy(c))}function DP(t,e,n){if(n.openStart>t.depth)throw new ph("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ph("Inconsistent open depths");return $k(t,e,n,0)}function $k(t,e,n,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Lc(t,e,n,r){let i=(e||t).node(n),a=0,o=e?e.index(n):i.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(ao(t.nodeAfter,r),a++));for(let c=a;ci&&_g(t,e,i+1),o=r.depth>i&&_g(n,r,i+1),c=[];return Lc(null,t,i,c),a&&o&&e.index(i)==n.index(i)?(Fk(a,o),ao(oo(a,Bk(t,e,n,r,i+1)),c)):(a&&ao(oo(a,mh(t,e,i+1)),c),Lc(e,n,i,c),o&&ao(oo(o,mh(n,r,i+1)),c)),Lc(r,null,i,c),new ge(c)}function mh(t,e,n){let r=[];if(Lc(null,t,n,r),t.depth>n){let i=_g(t,e,n+1);ao(oo(i,mh(t,e,n+1)),r)}return Lc(e,null,n,r),new ge(r)}function LP(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)i=e.node(a).copy(ge.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Qc{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new gh(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(a),h=a-u;if(r.push(o,c,i+u),!h||(o=o.child(c),o.isText))break;a=h-1,i+=u+1}return new Qc(n,r,a)}static resolveCached(e,n){let r=l1.get(e);if(r)for(let a=0;ae&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Vk(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=ge.empty,i=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,a),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=i;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=ge.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};mi.prototype.text=void 0;class xh extends mi{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Vk(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new xh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xh(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Vk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class go{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new FP(e,n);if(r.next==null)return go.empty;let i=Hk(r);r.next&&r.err("Unexpected trailing text");let a=qP(KP(i));return GP(a,r),a}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let a=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return a}).join(`
+`)}}go.empty=new go(!0);class FP{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Hk(t){let e=[];do e.push(BP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function BP(t){let e=[];do e.push(VP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function VP(t){let e=UP(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=HP(t,e);else break;return e}function c1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function HP(t,e){let n=c1(t),r=n;return t.eat(",")&&(t.next!="}"?r=c1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function WP(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let a in n){let o=n[a];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function UP(t){if(t.eat("(")){let e=Hk(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=WP(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function KP(t){let e=[[]];return i(a(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function i(o,c){o.forEach(u=>u.to=c)}function a(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(a(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=a(o.exprs[u],c);if(u==o.exprs.length-1)return h;i(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),i(a(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(a(o.expr,c),u),i(a(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(a(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||i.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let a=e[r.join(",")]=new go(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Kk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new mi(this,this.computeAttrs(e),ge.from(n),Ot.setFrom(r))}createChecked(e=null,n,r){return n=ge.from(n),this.checkContent(n),new mi(this,this.computeAttrs(e),n,Ot.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ge.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(ge.empty,!0);return a?new mi(this,e,n.append(a),Ot.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[a]=new Jk(a,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function JP(t,e,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class YP{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?JP(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class yf{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Gk(e,i.attrs),this.excluded=null;let a=Uk(this.attrs);this.instance=a?new Ot(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Ot(this,Kk(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((a,o)=>r[a]=new yf(a,i++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class Yk{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Vn.from(e.nodes),n.marks=Vn.from(e.marks||{}),this.nodes=u1.compile(this.spec.nodes,this),this.marks=yf.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],o=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=go.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=c=="_"?null:c?h1(this,c.split(" ")):c==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:h1(this,o.split(" "))}this.nodeFromJSON=i=>mi.fromJSON(this,i),this.markFromJSON=i=>Ot.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof u1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new xh(r,r.defaultAttrs,e,Ot.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function h1(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function QP(t){return t.tag!=null}function XP(t){return t.style!=null}class fa{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(QP(i))this.tags.push(i);else if(XP(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new p1(this,n,!1);return r.addAll(e,Ot.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new p1(this,n,!0);return r.addAll(e,Ot.none,n.from,n.to),Ie.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let a=i.priority==null?50:i.priority,o=0;for(;o{r(o=m1(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(o=>{r(o=m1(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new fa(e,fa.schemaRules(e)))}}const Qk={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ZP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Xk={ol:!0,ul:!0},Xc=1,$g=2,_c=4;function f1(t,e,n){return e!=null?(e?Xc:0)|(e==="full"?$g:0):t&&t.whitespace=="pre"?Xc|$g:n&~_c}class Ru{constructor(e,n,r,i,a,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Ot.none,this.match=a||(o&_c?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ge.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Xc)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=ge.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ge.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Qk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class p1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,o=f1(null,n.preserveWhitespace,0)|(r?_c:0);i?a=new Ru(i.type,i.attrs,Ot.none,!0,n.topMatch||i.type.contentMatch,o):r?a=new Ru(null,null,Ot.none,!0,null,o):a=new Ru(e.schema.topNodeType,null,Ot.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,a=i.options&$g?"full":this.localPreserveWS||(i.options&Xc)>0,{schema:o}=this.parser;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,`
+`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,i){let a,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(a=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}a&&this.sync(c)&&this.open--}addAll(e,n,r,i){let a=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];o!=c;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,n);this.findAtPoint(e,a)}findPlace(e,n,r){let i,a;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!i||i.length>h.length+c)&&(i=h,a=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!i)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):g1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Ru(e,n,u,i,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Xc)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=a;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&i?this.nodes[u].type:r&&u>=a?r.node(u-a).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function eO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Xk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function tO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function m1(t){let e={};for(let n in t)e[n]=t[n];return e}function g1(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let a=[],o=c=>{a.push(c);for(let u=0;u{if(a.length||o.marks.length){let c=0,u=0;for(;c=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Qu(zm(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Qu(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Co(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=x1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return x1(e.marks)}}function x1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function zm(t){return t.document||window.document}const y1=new WeakMap;function nO(t){let e=y1.get(t);return e===void 0&&y1.set(t,e=rO(t)),e}function rO(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let c,u=n?t.createElementNS(n,i):t.createElement(i),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:w}=Qu(t,g,n,r);if(u.appendChild(y),w){if(c)throw new RangeError("Multiple content holes");c=w}}}return{dom:u,contentDOM:c}}const Zk=65535,eS=Math.pow(2,16);function sO(t,e){return t+e*eS}function v1(t){return t&Zk}function iO(t){return(t-(t&Zk))/eS}const tS=1,nS=2,Xu=4,rS=8;class Fg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&rS)>0}get deletedBefore(){return(this.delInfo&(tS|Xu))>0}get deletedAfter(){return(this.delInfo&(nS|Xu))>0}get deletedAcross(){return(this.delInfo&Xu)>0}}class Or{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Or.empty)return Or.empty}recover(e){let n=0,r=v1(e);if(!this.inverted)for(let i=0;i