From b625fd5aa14b5d4c4bcd5dd04267fe54b97bf43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Tue, 17 Mar 2026 16:12:04 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=90=8C=E6=AD=A5=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=AB=AF=E6=9E=84=E5=BB=BA=E4=B8=8E=E4=BD=99=E9=A2=9D=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新 soul-admin dist 构建产物 - 调整 soul-api balance 路由与模型文件 Made-with: Cursor --- soul-admin/dist/assets/index--Y8yZ41S.js | 937 ------------------ soul-admin/dist/assets/index-BJTFaSuJ.js | 927 +++++++++++++++++ soul-admin/dist/assets/index-BcWuvM_a.css | 1 - soul-admin/dist/assets/index-CKdDSrMs.css | 1 - soul-admin/dist/assets/index-D5RkA1Qc.js | 914 ----------------- soul-admin/dist/assets/index-dmhT0dvT.css | 1 + soul-admin/dist/index.html | 4 +- .../pages/distribution/DistributionPage.tsx | 2 +- soul-api/internal/handler/balance.go | 34 +- soul-api/internal/model/user_balance.go | 24 - soul-api/internal/router/router.go | 1 + 11 files changed, 946 insertions(+), 1900 deletions(-) delete mode 100644 soul-admin/dist/assets/index--Y8yZ41S.js create mode 100644 soul-admin/dist/assets/index-BJTFaSuJ.js delete mode 100644 soul-admin/dist/assets/index-BcWuvM_a.css delete mode 100644 soul-admin/dist/assets/index-CKdDSrMs.css delete mode 100644 soul-admin/dist/assets/index-D5RkA1Qc.js create mode 100644 soul-admin/dist/assets/index-dmhT0dvT.css delete mode 100644 soul-api/internal/model/user_balance.go diff --git a/soul-admin/dist/assets/index--Y8yZ41S.js b/soul-admin/dist/assets/index--Y8yZ41S.js deleted file mode 100644 index 6f3eeab1..00000000 --- a/soul-admin/dist/assets/index--Y8yZ41S.js +++ /dev/null @@ -1,937 +0,0 @@ -function bE(t,e){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Dw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Sm={exports:{}},Rc={},Cm={exports:{}},ft={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var jv;function vE(){if(jv)return ft;jv=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(O){return O===null||typeof O!="object"?null:(O=m&&O[m]||O["@@iterator"],typeof O=="function"?O:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,w={};function N(O,W,ie){this.props=O,this.context=W,this.refs=w,this.updater=ie||y}N.prototype.isReactComponent={},N.prototype.setState=function(O,W){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,W,"setState")},N.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function k(){}k.prototype=N.prototype;function C(O,W,ie){this.props=O,this.context=W,this.refs=w,this.updater=ie||y}var E=C.prototype=new k;E.constructor=C,v(E,N.prototype),E.isPureReactComponent=!0;var I=Array.isArray,P=Object.prototype.hasOwnProperty,B={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function R(O,W,ie){var J,X={},G=null,se=null;if(W!=null)for(J in W.ref!==void 0&&(se=W.ref),W.key!==void 0&&(G=""+W.key),W)P.call(W,J)&&!L.hasOwnProperty(J)&&(X[J]=W[J]);var de=arguments.length-2;if(de===1)X.children=ie;else if(1>>1,W=M[O];if(0>>1;Oa(X,F))Ga(se,X)?(M[O]=se,M[G]=F,O=G):(M[O]=X,M[J]=F,O=J);else if(Ga(se,F))M[O]=se,M[G]=F,O=G;else break e}}return q}function a(M,q){var F=M.sortIndex-q.sortIndex;return F!==0?F:M.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,y=!1,v=!1,w=!1,N=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(M){for(var q=n(h);q!==null;){if(q.callback===null)r(h);else if(q.startTime<=M)r(h),q.sortIndex=q.expirationTime,e(u,q);else break;q=n(h)}}function I(M){if(w=!1,E(M),!v)if(n(u)!==null)v=!0,V(P);else{var q=n(h);q!==null&&U(I,q.startTime-M)}}function P(M,q){v=!1,w&&(w=!1,k(R),R=-1),y=!0;var F=g;try{for(E(q),m=n(u);m!==null&&(!(m.expirationTime>q)||M&&!te());){var O=m.callback;if(typeof O=="function"){m.callback=null,g=m.priorityLevel;var W=O(m.expirationTime<=q);q=t.unstable_now(),typeof W=="function"?m.callback=W:m===n(u)&&r(u),E(q)}else r(u);m=n(u)}if(m!==null)var ie=!0;else{var J=n(h);J!==null&&U(I,J.startTime-q),ie=!1}return ie}finally{m=null,g=F,y=!1}}var B=!1,L=null,R=-1,D=5,_=-1;function te(){return!(t.unstable_now()-_M||125O?(M.sortIndex=F,e(h,M),n(u)===null&&M===n(h)&&(w?(k(R),R=-1):w=!0,U(I,F-O))):(M.sortIndex=W,e(u,M),v||y||(v=!0,V(P))),M},t.unstable_shouldYield=te,t.unstable_wrapCallback=function(M){var q=g;return function(){var F=g;g=q;try{return M.apply(this,arguments)}finally{g=F}}}})(Mm)),Mm}var Tv;function kE(){return Tv||(Tv=1,Tm.exports=jE()),Tm.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Mv;function SE(){if(Mv)return Er;Mv=1;var t=jd(),e=kE();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function y(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,d,p,x){if(d===null||typeof d>"u"||y(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function w(l,d,p,x,j,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=j,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){N[l]=new w(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];N[d]=new w(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){N[l]=new w(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){N[l]=new w(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){N[l]=new w(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){N[l]=new w(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){N[l]=new w(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){N[l]=new w(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){N[l]=new w(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function C(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,C);N[d]=new w(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,C);N[d]=new w(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,C);N[d]=new w(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){N[l]=new w(l,1,!1,l.toLowerCase(),null,!1,!1)}),N.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){N[l]=new w(l,1,!1,l.toLowerCase(),null,!0,!0)});function E(l,d,p,x){var j=N.hasOwnProperty(d)?N[d]:null;(j!==null?j.type!==0:x||!(2H||j[A]!==S[H]){var Q=` -`+j[A].replace(" at new "," at ");return l.displayName&&Q.includes("")&&(Q=Q.replace("",l.displayName)),Q}while(1<=A&&0<=H);break}}}finally{ie=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?W(l):""}function X(l){switch(l.tag){case 5:return W(l.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return l=J(l.type,!1),l;case 11:return l=J(l.type.render,!1),l;case 1:return l=J(l.type,!0),l;default:return""}}function G(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 L:return"Fragment";case B:return"Portal";case D:return"Profiler";case R:return"StrictMode";case he:return"Suspense";case ge:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case te:return(l.displayName||"Context")+".Consumer";case _:return(l._context.displayName||"Context")+".Provider";case K:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case z:return d=l.displayName||null,d!==null?d:G(l.type)||"Memo";case V:d=l._payload,l=l._init;try{return G(l(d))}catch{}}return null}function se(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 G(d);case 8:return d===R?"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 de(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ce(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function ye(l){var d=ce(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 ze(l){l._valueTracker||(l._valueTracker=ye(l))}function Oe(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=ce(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function ct(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 Lt(l,d){var p=d.checked;return F({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function jn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=de(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 it(l,d){d=d.checked,d!=null&&E(l,"checked",d,!1)}function Mt(l,d){it(l,d);var p=de(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,de(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"||ct(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var et=Array.isArray;function xt(l,d,p,x){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=At.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function ns(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var or={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},xe=["Webkit","ms","Moz","O"];Object.keys(or).forEach(function(l){xe.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),or[d]=or[l]})});function we(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||or.hasOwnProperty(l)&&or[l]?(""+d).trim():d+"px"}function qn(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=we(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,j):l[p]=j}}var Es=F({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 Ts(l,d){if(d){if(Es[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 Pa(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 br=null;function Vi(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var vr=null,lr=null,Ms=null;function Oa(l){if(l=xc(l)){if(typeof vr!="function")throw Error(n(280));var d=l.stateNode;d&&(d=qd(d),vr(l.stateNode,l.type,d))}}function Hi(l){lr?Ms?Ms.push(l):Ms=[l]:lr=l}function Qs(){if(lr){var l=lr,d=Ms;if(Ms=lr=null,Oa(l),d)for(l=0;l>>=0,l===0?32:31-(Wo(l)/Fa|0)|0}var Rs=64,Ps=4194304;function Os(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 Ds(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 H=A&~j;H!==0?x=Os(H):(S&=A,S!==0&&(x=Os(S)))}else A=p&~j,A!==0?x=Os(A):S!==0&&(x=Os(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 kn(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-$n(d),l[d]=p}function Uo(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=lc),gy=" ",xy=!1;function yy(l,d){switch(l){case"keyup":return p3.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function by(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Yo=!1;function g3(l,d){switch(l){case"compositionend":return by(d);case"keypress":return d.which!==32?null:(xy=!0,gy);case"textInput":return l=d.data,l===gy&&xy?null:l;default:return null}}function x3(l,d){if(Yo)return l==="compositionend"||!ap&&yy(l,d)?(l=dy(),Ld=Zf=Wa=null,Yo=!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=Cy(p)}}function Ty(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Ty(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function My(){for(var l=window,d=ct();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=ct(l.document)}return d}function lp(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 C3(l){var d=My(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&Ty(p.ownerDocument.documentElement,p)){if(x!==null&&lp(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=Ey(p,S);var A=Ey(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,Qo=null,cp=null,hc=null,dp=!1;function Ay(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;dp||Qo==null||Qo!==ct(x)||(x=Qo,"selectionStart"in x&&lp(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}),hc&&uc(hc,x)||(hc=x,x=Wd(cp,"onSelect"),0nl||(l.current=wp[nl],wp[nl]=null,nl--)}function zt(l,d){nl++,wp[nl]=l.current,l.current=d}var Ga={},Yn=qa(Ga),wr=qa(!1),Xi=Ga;function rl(l,d){var p=l.type.contextTypes;if(!p)return Ga;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 jr(l){return l=l.childContextTypes,l!=null}function Gd(){qt(wr),qt(Yn)}function Uy(l,d,p){if(Yn.current!==Ga)throw Error(n(168));zt(Yn,d),zt(wr,p)}function Ky(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,se(l)||"Unknown",j));return F({},p,x)}function Jd(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Ga,Xi=Yn.current,zt(Yn,l),zt(wr,wr.current),!0}function qy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Ky(l,d,Xi),x.__reactInternalMemoizedMergedChildContext=l,qt(wr),qt(Yn),zt(Yn,l)):qt(wr),zt(wr,p)}var aa=null,Yd=!1,jp=!1;function Gy(l){aa===null?aa=[l]:aa.push(l)}function z3(l){Yd=!0,Gy(l)}function Ja(){if(!jp&&aa!==null){jp=!0;var l=0,d=st;try{var p=aa;for(st=1;l>=A,j-=A,ia=1<<32-$n(d)+j|p<rt?(Pn=Qe,Qe=null):Pn=Qe.sibling;var bt=Ne(ae,Qe,ue[rt],Me);if(bt===null){Qe===null&&(Qe=Pn);break}l&&Qe&&bt.alternate===null&&d(ae,Qe),Z=S(bt,Z,rt),Ye===null?He=bt:Ye.sibling=bt,Ye=bt,Qe=Pn}if(rt===ue.length)return p(ae,Qe),Jt&&eo(ae,rt),He;if(Qe===null){for(;rtrt?(Pn=Qe,Qe=null):Pn=Qe.sibling;var si=Ne(ae,Qe,bt.value,Me);if(si===null){Qe===null&&(Qe=Pn);break}l&&Qe&&si.alternate===null&&d(ae,Qe),Z=S(si,Z,rt),Ye===null?He=si:Ye.sibling=si,Ye=si,Qe=Pn}if(bt.done)return p(ae,Qe),Jt&&eo(ae,rt),He;if(Qe===null){for(;!bt.done;rt++,bt=ue.next())bt=ke(ae,bt.value,Me),bt!==null&&(Z=S(bt,Z,rt),Ye===null?He=bt:Ye.sibling=bt,Ye=bt);return Jt&&eo(ae,rt),He}for(Qe=x(ae,Qe);!bt.done;rt++,bt=ue.next())bt=De(Qe,ae,rt,bt.value,Me),bt!==null&&(l&&bt.alternate!==null&&Qe.delete(bt.key===null?rt:bt.key),Z=S(bt,Z,rt),Ye===null?He=bt:Ye.sibling=bt,Ye=bt);return l&&Qe.forEach(function(yE){return d(ae,yE)}),Jt&&eo(ae,rt),He}function fn(ae,Z,ue,Me){if(typeof ue=="object"&&ue!==null&&ue.type===L&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case P:e:{for(var He=ue.key,Ye=Z;Ye!==null;){if(Ye.key===He){if(He=ue.type,He===L){if(Ye.tag===7){p(ae,Ye.sibling),Z=j(Ye,ue.props.children),Z.return=ae,ae=Z;break e}}else if(Ye.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===V&&eb(He)===Ye.type){p(ae,Ye.sibling),Z=j(Ye,ue.props),Z.ref=yc(ae,Ye,ue),Z.return=ae,ae=Z;break e}p(ae,Ye);break}else d(ae,Ye);Ye=Ye.sibling}ue.type===L?(Z=lo(ue.props.children,ae.mode,Me,ue.key),Z.return=ae,ae=Z):(Me=ku(ue.type,ue.key,ue.props,null,ae.mode,Me),Me.ref=yc(ae,Z,ue),Me.return=ae,ae=Me)}return A(ae);case B:e:{for(Ye=ue.key;Z!==null;){if(Z.key===Ye)if(Z.tag===4&&Z.stateNode.containerInfo===ue.containerInfo&&Z.stateNode.implementation===ue.implementation){p(ae,Z.sibling),Z=j(Z,ue.children||[]),Z.return=ae,ae=Z;break e}else{p(ae,Z);break}else d(ae,Z);Z=Z.sibling}Z=vm(ue,ae.mode,Me),Z.return=ae,ae=Z}return A(ae);case V:return Ye=ue._init,fn(ae,Z,Ye(ue._payload),Me)}if(et(ue))return $e(ae,Z,ue,Me);if(q(ue))return Ve(ae,Z,ue,Me);eu(ae,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,Z!==null&&Z.tag===6?(p(ae,Z.sibling),Z=j(Z,ue),Z.return=ae,ae=Z):(p(ae,Z),Z=bm(ue,ae.mode,Me),Z.return=ae,ae=Z),A(ae)):p(ae,Z)}return fn}var ol=tb(!0),nb=tb(!1),tu=qa(null),nu=null,ll=null,Mp=null;function Ap(){Mp=ll=nu=null}function Ip(l){var d=tu.current;qt(tu),l._currentValue=d}function Rp(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 cl(l,d){nu=l,Mp=ll=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(kr=!0),l.firstContext=null)}function Ur(l){var d=l._currentValue;if(Mp!==l)if(l={context:l,memoizedValue:d,next:null},ll===null){if(nu===null)throw Error(n(308));ll=l,nu.dependencies={lanes:0,firstContext:l}}else ll=ll.next=l;return d}var to=null;function Pp(l){to===null?to=[l]:to.push(l)}function rb(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,Pp(d)):(p.next=j.next,j.next=p),d.interleaved=p,la(l,x)}function la(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 Ya=!1;function Op(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function sb(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 ca(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Qa(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(gt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,la(l,p)}return j=x.interleaved,j===null?(d.next=d,Pp(x)):(d.next=j.next,j.next=d),x.interleaved=d,la(l,p)}function ru(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,Xt(l,p)}}function ab(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 su(l,d,p,x){var j=l.updateQueue;Ya=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,H=j.shared.pending;if(H!==null){j.shared.pending=null;var Q=H,me=Q.next;Q.next=null,A===null?S=me:A.next=me,A=Q;var je=l.alternate;je!==null&&(je=je.updateQueue,H=je.lastBaseUpdate,H!==A&&(H===null?je.firstBaseUpdate=me:H.next=me,je.lastBaseUpdate=Q))}if(S!==null){var ke=j.baseState;A=0,je=me=Q=null,H=S;do{var Ne=H.lane,De=H.eventTime;if((x&Ne)===Ne){je!==null&&(je=je.next={eventTime:De,lane:0,tag:H.tag,payload:H.payload,callback:H.callback,next:null});e:{var $e=l,Ve=H;switch(Ne=d,De=p,Ve.tag){case 1:if($e=Ve.payload,typeof $e=="function"){ke=$e.call(De,ke,Ne);break e}ke=$e;break e;case 3:$e.flags=$e.flags&-65537|128;case 0:if($e=Ve.payload,Ne=typeof $e=="function"?$e.call(De,ke,Ne):$e,Ne==null)break e;ke=F({},ke,Ne);break e;case 2:Ya=!0}}H.callback!==null&&H.lane!==0&&(l.flags|=64,Ne=j.effects,Ne===null?j.effects=[H]:Ne.push(H))}else De={eventTime:De,lane:Ne,tag:H.tag,payload:H.payload,callback:H.callback,next:null},je===null?(me=je=De,Q=ke):je=je.next=De,A|=Ne;if(H=H.next,H===null){if(H=j.shared.pending,H===null)break;Ne=H,H=Ne.next,Ne.next=null,j.lastBaseUpdate=Ne,j.shared.pending=null}}while(!0);if(je===null&&(Q=ke),j.baseState=Q,j.firstBaseUpdate=me,j.lastBaseUpdate=je,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);so|=A,l.lanes=A,l.memoizedState=ke}}function ib(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=$p.transition;$p.transition={};try{l(!1),d()}finally{st=p,$p.transition=x}}function Sb(){return Kr().memoizedState}function V3(l,d,p){var x=ti(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},Cb(l))Eb(d,p);else if(p=rb(l,d,p,x),p!==null){var j=hr();xs(p,l,x,j),Tb(p,d,x)}}function H3(l,d,p){var x=ti(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(Cb(l))Eb(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,H=S(A,p);if(j.hasEagerState=!0,j.eagerState=H,hs(H,A)){var Q=d.interleaved;Q===null?(j.next=j,Pp(d)):(j.next=Q.next,Q.next=j),d.interleaved=j;return}}catch{}finally{}p=rb(l,d,j,x),p!==null&&(j=hr(),xs(p,l,x,j),Tb(p,d,x))}}function Cb(l){var d=l.alternate;return l===en||d!==null&&d===en}function Eb(l,d){wc=ou=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function Tb(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Xt(l,p)}}var du={readContext:Ur,useCallback:Qn,useContext:Qn,useEffect:Qn,useImperativeHandle:Qn,useInsertionEffect:Qn,useLayoutEffect:Qn,useMemo:Qn,useReducer:Qn,useRef:Qn,useState:Qn,useDebugValue:Qn,useDeferredValue:Qn,useTransition:Qn,useMutableSource:Qn,useSyncExternalStore:Qn,useId:Qn,unstable_isNewReconciler:!1},W3={readContext:Ur,useCallback:function(l,d){return $s().memoizedState=[l,d===void 0?null:d],l},useContext:Ur,useEffect:xb,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,lu(4194308,4,vb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return lu(4194308,4,l,d)},useInsertionEffect:function(l,d){return lu(4,2,l,d)},useMemo:function(l,d){var p=$s();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=$s();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=V3.bind(null,en,l),[x.memoizedState,l]},useRef:function(l){var d=$s();return l={current:l},d.memoizedState=l},useState:mb,useDebugValue:Kp,useDeferredValue:function(l){return $s().memoizedState=l},useTransition:function(){var l=mb(!1),d=l[0];return l=B3.bind(null,l[1]),$s().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=en,j=$s();if(Jt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Rn===null)throw Error(n(349));(ro&30)!==0||db(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,xb(hb.bind(null,x,S,l),[l]),x.flags|=2048,Sc(9,ub.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=$s(),d=Rn.identifierPrefix;if(Jt){var p=oa,x=ia;p=(x&~(1<<32-$n(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=jc++,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[_s]=d,l[gc]=x,Gb(l,d,!1,!1),d.stateNode=l;e:{switch(A=Pa(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;jpl&&(d.flags|=128,x=!0,Cc(S,!1),d.lanes=4194304)}else{if(!x)if(l=au(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Cc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Jt)return Xn(d),null}else 2*It()-S.renderingStartTime>pl&&p!==1073741824&&(d.flags|=128,x=!0,Cc(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=It(),d.sibling=null,p=Zt.current,zt(Zt,x?p&1|2:p&1),d):(Xn(d),null);case 22:case 23:return gm(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Or&1073741824)!==0&&(Xn(d),d.subtreeFlags&6&&(d.flags|=8192)):Xn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function X3(l,d){switch(Sp(d),d.tag){case 1:return jr(d.type)&&Gd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return dl(),qt(wr),qt(Yn),zp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Lp(d),null;case 13:if(qt(Zt),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));il()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return qt(Zt),null;case 4:return dl(),null;case 10:return Ip(d.type._context),null;case 22:case 23:return gm(),null;case 24:return null;default:return null}}var pu=!1,Zn=!1,Z3=typeof WeakSet=="function"?WeakSet:Set,_e=null;function hl(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){sn(l,d,x)}else p.current=null}function sm(l,d,p){try{p()}catch(x){sn(l,d,x)}}var Qb=!1;function eE(l,d){if(gp=Od,l=My(),lp(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,H=-1,Q=-1,me=0,je=0,ke=l,Ne=null;t:for(;;){for(var De;ke!==p||j!==0&&ke.nodeType!==3||(H=A+j),ke!==S||x!==0&&ke.nodeType!==3||(Q=A+x),ke.nodeType===3&&(A+=ke.nodeValue.length),(De=ke.firstChild)!==null;)Ne=ke,ke=De;for(;;){if(ke===l)break t;if(Ne===p&&++me===j&&(H=A),Ne===S&&++je===x&&(Q=A),(De=ke.nextSibling)!==null)break;ke=Ne,Ne=ke.parentNode}ke=De}p=H===-1||Q===-1?null:{start:H,end:Q}}else p=null}p=p||{start:0,end:0}}else p=null;for(xp={focusedElem:l,selectionRange:p},Od=!1,_e=d;_e!==null;)if(d=_e,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,_e=l;else for(;_e!==null;){d=_e;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 Ve=$e.memoizedProps,fn=$e.memoizedState,ae=d.stateNode,Z=ae.getSnapshotBeforeUpdate(d.elementType===d.type?Ve:ps(d.type,Ve),fn);ae.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:var ue=d.stateNode.containerInfo;ue.nodeType===1?ue.textContent="":ue.nodeType===9&&ue.documentElement&&ue.removeChild(ue.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Me){sn(d,d.return,Me)}if(l=d.sibling,l!==null){l.return=d.return,_e=l;break}_e=d.return}return $e=Qb,Qb=!1,$e}function Ec(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&&sm(d,p,S)}j=j.next}while(j!==x)}}function mu(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 am(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 Xb(l){var d=l.alternate;d!==null&&(l.alternate=null,Xb(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[_s],delete d[gc],delete d[Np],delete d[L3],delete d[_3])),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 Zb(l){return l.tag===5||l.tag===3||l.tag===4}function ev(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Zb(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 im(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=Kd));else if(x!==4&&(l=l.child,l!==null))for(im(l,d,p),l=l.sibling;l!==null;)im(l,d,p),l=l.sibling}function om(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(om(l,d,p),l=l.sibling;l!==null;)om(l,d,p),l=l.sibling}var Fn=null,ms=!1;function Xa(l,d,p){for(p=p.child;p!==null;)tv(l,d,p),p=p.sibling}function tv(l,d,p){if(dr&&typeof dr.onCommitFiberUnmount=="function")try{dr.onCommitFiberUnmount($a,p)}catch{}switch(p.tag){case 5:Zn||hl(p,d);case 6:var x=Fn,j=ms;Fn=null,Xa(l,d,p),Fn=x,ms=j,Fn!==null&&(ms?(l=Fn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Fn.removeChild(p.stateNode));break;case 18:Fn!==null&&(ms?(l=Fn,p=p.stateNode,l.nodeType===8?vp(l.parentNode,p):l.nodeType===1&&vp(l,p),Ha(l)):vp(Fn,p.stateNode));break;case 4:x=Fn,j=ms,Fn=p.stateNode.containerInfo,ms=!0,Xa(l,d,p),Fn=x,ms=j;break;case 0:case 11:case 14:case 15:if(!Zn&&(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)&&sm(p,d,A),j=j.next}while(j!==x)}Xa(l,d,p);break;case 1:if(!Zn&&(hl(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(H){sn(p,d,H)}Xa(l,d,p);break;case 21:Xa(l,d,p);break;case 22:p.mode&1?(Zn=(x=Zn)||p.memoizedState!==null,Xa(l,d,p),Zn=x):Xa(l,d,p);break;default:Xa(l,d,p)}}function nv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new Z3),d.forEach(function(x){var j=cE.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function gs(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=A),x&=~S}if(x=j,x=It()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*nE(x/1960))-x,10l?16:l,ei===null)var x=!1;else{if(l=ei,ei=null,vu=0,(gt&6)!==0)throw Error(n(331));var j=gt;for(gt|=4,_e=l.current;_e!==null;){var S=_e,A=S.child;if((_e.flags&16)!==0){var H=S.deletions;if(H!==null){for(var Q=0;QIt()-dm?io(l,0):cm|=p),Cr(l,d)}function mv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ps,Ps<<=1,(Ps&130023424)===0&&(Ps=4194304)));var p=hr();l=la(l,d),l!==null&&(kn(l,d,p),Cr(l,p))}function lE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),mv(l,p)}function cE(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),mv(l,p)}var gv;gv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||wr.current)kr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return kr=!1,Y3(l,d,p);kr=(l.flags&131072)!==0}else kr=!1,Jt&&(d.flags&1048576)!==0&&Jy(d,Xd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;fu(l,d),l=d.pendingProps;var j=rl(d,Yn.current);cl(d,p),j=Bp(null,d,x,l,j,p);var S=Vp();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,jr(x)?(S=!0,Jd(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Op(d),j.updater=uu,d.stateNode=j,j._reactInternals=d,Gp(d,x,l,p),d=Xp(null,d,x,!0,S,p)):(d.tag=0,Jt&&S&&kp(d),ur(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(fu(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=uE(x),l=ps(x,l),j){case 0:d=Qp(null,d,x,l,p);break e;case 1:d=Vb(null,d,x,l,p);break e;case 11:d=_b(null,d,x,l,p);break e;case 14:d=zb(null,d,x,ps(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:ps(x,j),Qp(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),Vb(l,d,x,j,p);case 3:e:{if(Hb(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,sb(l,d),su(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=ul(Error(n(423)),d),d=Wb(l,d,x,p,j);break e}else if(x!==j){j=ul(Error(n(424)),d),d=Wb(l,d,x,p,j);break e}else for(Pr=Ka(d.stateNode.containerInfo.firstChild),Rr=d,Jt=!0,fs=null,p=nb(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(il(),x===j){d=da(l,d,p);break e}ur(l,d,x,p)}d=d.child}return d;case 5:return ob(d),l===null&&Ep(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,yp(x,j)?A=null:S!==null&&yp(x,S)&&(d.flags|=32),Bb(l,d),ur(l,d,A,p),d.child;case 6:return l===null&&Ep(d),null;case 13:return Ub(l,d,p);case 4:return Dp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=ol(d,null,x,p):ur(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),_b(l,d,x,j,p);case 7:return ur(l,d,d.pendingProps,p),d.child;case 8:return ur(l,d,d.pendingProps.children,p),d.child;case 12:return ur(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,zt(tu,x._currentValue),x._currentValue=A,S!==null)if(hs(S.value,A)){if(S.children===j.children&&!wr.current){d=da(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var H=S.dependencies;if(H!==null){A=S.child;for(var Q=H.firstContext;Q!==null;){if(Q.context===x){if(S.tag===1){Q=ca(-1,p&-p),Q.tag=2;var me=S.updateQueue;if(me!==null){me=me.shared;var je=me.pending;je===null?Q.next=Q:(Q.next=je.next,je.next=Q),me.pending=Q}}S.lanes|=p,Q=S.alternate,Q!==null&&(Q.lanes|=p),Rp(S.return,p,d),H.lanes|=p;break}Q=Q.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,H=A.alternate,H!==null&&(H.lanes|=p),Rp(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}ur(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,cl(d,p),j=Ur(j),x=x(j),d.flags|=1,ur(l,d,x,p),d.child;case 14:return x=d.type,j=ps(x,d.pendingProps),j=ps(x.type,j),zb(l,d,x,j,p);case 15:return $b(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),fu(l,d),d.tag=1,jr(x)?(l=!0,Jd(d)):l=!1,cl(d,p),Ab(d,x,j),Gp(d,x,j,p),Xp(null,d,x,!0,l,p);case 19:return qb(l,d,p);case 22:return Fb(l,d,p)}throw Error(n(156,d.tag))};function xv(l,d){return un(l,d)}function dE(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 Gr(l,d,p,x){return new dE(l,d,p,x)}function ym(l){return l=l.prototype,!(!l||!l.isReactComponent)}function uE(l){if(typeof l=="function")return ym(l)?1:0;if(l!=null){if(l=l.$$typeof,l===K)return 11;if(l===z)return 14}return 2}function ri(l,d){var p=l.alternate;return p===null?(p=Gr(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 ku(l,d,p,x,j,S){var A=2;if(x=l,typeof l=="function")ym(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case L:return lo(p.children,j,S,d);case R:A=8,j|=8;break;case D:return l=Gr(12,p,d,j|2),l.elementType=D,l.lanes=S,l;case he:return l=Gr(13,p,d,j),l.elementType=he,l.lanes=S,l;case ge:return l=Gr(19,p,d,j),l.elementType=ge,l.lanes=S,l;case U:return Su(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case _:A=10;break e;case te:A=9;break e;case K:A=11;break e;case z:A=14;break e;case V:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Gr(A,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function lo(l,d,p,x){return l=Gr(7,l,x,d),l.lanes=p,l}function Su(l,d,p,x){return l=Gr(22,l,x,d),l.elementType=U,l.lanes=p,l.stateNode={isHidden:!1},l}function bm(l,d,p){return l=Gr(6,l,null,d),l.lanes=p,l}function vm(l,d,p){return d=Gr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function hE(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=xn(0),this.expirationTimes=xn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xn(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function Nm(l,d,p,x,j,S,A,H,Q){return l=new hE(l,d,p,H,Q),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Gr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Op(S),l}function fE(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(),Em.exports=SE(),Em.exports}var Iv;function CE(){if(Iv)return Ru;Iv=1;var t=Lw();return Ru.createRoot=t.createRoot,Ru.hydrateRoot=t.hydrateRoot,Ru}var EE=CE(),kd=Lw();const _w=Dw(kd);/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function id(){return id=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Hx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function ME(){return Math.random().toString(36).substr(2,8)}function Pv(t,e){return{usr:t.state,key:t.key,idx:e}}function Mg(t,e,n,r){return n===void 0&&(n=null),id({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ul(e):e,{state:n,key:e&&e.key||r||ME()})}function mh(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 Ul(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 AE(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=gi.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(id({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=gi.Pop;let N=f(),k=N==null?null:N-h;h=N,u&&u({action:c,location:w.location,delta:k})}function g(N,k){c=gi.Push;let C=Mg(w.location,N,k);h=f()+1;let E=Pv(C,h),I=w.createHref(C);try{o.pushState(E,"",I)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;a.location.assign(I)}i&&u&&u({action:c,location:w.location,delta:1})}function y(N,k){c=gi.Replace;let C=Mg(w.location,N,k);h=f();let E=Pv(C,h),I=w.createHref(C);o.replaceState(E,"",I),i&&u&&u({action:c,location:w.location,delta:0})}function v(N){let k=a.location.origin!=="null"?a.location.origin:a.location.href,C=typeof N=="string"?N:mh(N);return C=C.replace(/ $/,"%20"),gn(k,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,k)}let w={get action(){return c},get location(){return t(a,o)},listen(N){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Rv,m),u=N,()=>{a.removeEventListener(Rv,m),u=null}},createHref(N){return e(a,N)},createURL:v,encodeLocation(N){let k=v(N);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(N){return o.go(N)}};return w}var Ov;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Ov||(Ov={}));function IE(t,e,n){return n===void 0&&(n="/"),RE(t,e,n)}function RE(t,e,n,r){let a=typeof e=="string"?Ul(e):e,i=Wx(a.pathname||"/",n);if(i==null)return null;let o=zw(t);PE(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};u.relativePath.startsWith("/")&&(gn(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=wi([r,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(gn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),zw(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:FE(h,i.index),routesMeta:f})};return t.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let u of $w(i.path))a(i,o,u)}),e}function $w(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=$w(r.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function PE(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:BE(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const OE=/^:[\w-]+$/,DE=3,LE=2,_E=1,zE=10,$E=-2,Dv=t=>t==="*";function FE(t,e){let n=t.split("/"),r=n.length;return n.some(Dv)&&(r+=$E),e&&(r+=LE),n.filter(a=>!Dv(a)).reduce((a,i)=>a+(OE.test(i)?DE:i===""?_E:zE),r)}function BE(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function VE(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const v=c[m];return y&&!v?h[g]=void 0:h[g]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function WE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Hx(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=[],a="^"+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:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function UE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Hx(!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 Wx(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 KE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qE=t=>KE.test(t);function GE(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Ul(t):t,i;if(n)if(qE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Hx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Lv(n.substring(1),"/"):i=Lv(n,e)}else i=e;return{pathname:i,search:QE(r),hash:XE(a)}}function Lv(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Am(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 JE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Ux(t,e){let n=JE(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Kx(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Ul(t):(a=id({},t),gn(!a.pathname||!a.pathname.includes("?"),Am("?","pathname","search",a)),gn(!a.pathname||!a.pathname.includes("#"),Am("#","pathname","hash",a)),gn(!a.search||!a.search.includes("#"),Am("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.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;a.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=GE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const wi=t=>t.join("/").replace(/\/\/+/g,"/"),YE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),QE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,XE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function ZE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Fw=["post","put","patch","delete"];new Set(Fw);const eT=["get",...Fw];new Set(eT);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function od(){return od=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=Kx(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:wi([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const sT=b.createContext(null);function aT(t){let e=b.useContext(Ia).outlet;return e&&b.createElement(sT.Provider,{value:t},e)}function Hw(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(Pi),{matches:a}=b.useContext(Ia),{pathname:i}=Oi(),o=JSON.stringify(Ux(a,r.v7_relativeSplatPath));return b.useMemo(()=>Kx(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function iT(t,e){return oT(t,e)}function oT(t,e,n,r){Kl()||gn(!1);let{navigator:a}=b.useContext(Pi),{matches:i}=b.useContext(Ia),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Oi(),f;if(e){var m;let N=typeof e=="string"?Ul(e):e;u==="/"||(m=N.pathname)!=null&&m.startsWith(u)||gn(!1),f=N}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let N=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(N.length).join("/")}let v=IE(t,{pathname:y}),w=hT(v&&v.map(N=>Object.assign({},N,{params:Object.assign({},c,N.params),pathname:wi([u,a.encodeLocation?a.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?u:wi([u,a.encodeLocation?a.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),i,n,r);return e&&w?b.createElement(bf.Provider,{value:{location:od({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:gi.Pop}},w):w}function lT(){let t=gT(),e=ZE(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:a},n):null,null)}const cT=b.createElement(lT,null);class dT extends b.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?b.createElement(Ia.Provider,{value:this.props.routeContext},b.createElement(Bw.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function uT(t){let{routeContext:e,match:n,children:r}=t,a=b.useContext(qx);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Ia.Provider,{value:e},r)}function hT(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||gn(!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,v=!1,w=null,N=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,w=m.route.errorElement||cT,u&&(h<0&&g===0?(yT("route-fallback"),v=!0,N=null):h===g&&(v=!0,N=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),C=()=>{let E;return y?E=w:v?E=N:m.route.Component?E=b.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=f,b.createElement(uT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:E})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(dT,{location:n.location,revalidation:n.revalidation,component:w,error:y,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):C()},null)}var Ww=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Ww||{}),Uw=(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})(Uw||{});function fT(t){let e=b.useContext(qx);return e||gn(!1),e}function pT(t){let e=b.useContext(tT);return e||gn(!1),e}function mT(t){let e=b.useContext(Ia);return e||gn(!1),e}function Kw(t){let e=mT(),n=e.matches[e.matches.length-1];return n.route.id||gn(!1),n.route.id}function gT(){var t;let e=b.useContext(Bw),n=pT(),r=Kw();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function xT(){let{router:t}=fT(Ww.UseNavigateStable),e=Kw(Uw.UseNavigateStable),n=b.useRef(!1);return Vw(()=>{n.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,od({fromRouteId:e},i)))},[t,e])}const _v={};function yT(t,e,n){_v[t]||(_v[t]=!0)}function bT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Im(t){let{to:e,replace:n,state:r,relative:a}=t;Kl()||gn(!1);let{future:i,static:o}=b.useContext(Pi),{matches:c}=b.useContext(Ia),{pathname:u}=Oi(),h=Di(),f=Kx(e,Ux(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:a}),[h,m,a,n,r]),null}function vT(t){return aT(t.context)}function $t(t){gn(!1)}function NT(t){let{basename:e="/",children:n=null,location:r,navigationType:a=gi.Pop,navigator:i,static:o=!1,future:c}=t;Kl()&&gn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:i,static:o,future:od({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=Ul(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:v="default"}=r,w=b.useMemo(()=>{let N=Wx(f,u);return N==null?null:{location:{pathname:N,search:m,hash:g,state:y,key:v},navigationType:a}},[u,f,m,g,y,v,a]);return w==null?null:b.createElement(Pi.Provider,{value:h},b.createElement(bf.Provider,{children:n,value:w}))}function wT(t){let{children:e,location:n}=t;return iT(Ag(e),n)}new Promise(()=>{});function Ag(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,a)=>{if(!b.isValidElement(r))return;let i=[...e,a];if(r.type===b.Fragment){n.push.apply(n,Ag(r.props.children,i));return}r.type!==$t&&gn(!1),!r.props.index||!r.props.children||gn(!1);let o={id:r.props.id||i.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=Ag(r.props.children,i)),n.push(o)}),n}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Ig(){return Ig=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function kT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ST(t,e){return t.button===0&&(!e||e==="_self")&&!kT(t)}function Rg(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(a=>[n,a]):[[n,r]])},[]))}function CT(t,e){let n=Rg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const ET=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],TT="6";try{window.__reactRouterVersion=TT}catch{}const MT="startTransition",zv=yf[MT];function AT(t){let{basename:e,children:n,future:r,window:a}=t,i=b.useRef();i.current==null&&(i.current=TE({window:a,v5Compat:!0}));let o=i.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&zv?zv(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>bT(r),[r]),b.createElement(NT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const IT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",RT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pg=b.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=jT(e,ET),{basename:y}=b.useContext(Pi),v,w=!1;if(typeof h=="string"&&RT.test(h)&&(v=h,IT))try{let E=new URL(window.location.href),I=h.startsWith("//")?new URL(E.protocol+h):new URL(h),P=Wx(I.pathname,y);I.origin===E.origin&&P!=null?h=P+I.search+I.hash:w=!0}catch{}let N=nT(h,{relative:a}),k=PT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function C(E){r&&r(E),E.defaultPrevented||k(E)}return b.createElement("a",Ig({},g,{href:v||N,onClick:w||i?r:C,ref:n,target:u}))});var $v;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})($v||($v={}));var Fv;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Fv||(Fv={}));function PT(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Di(),h=Oi(),f=Hw(t,{relative:o});return b.useCallback(m=>{if(ST(m,n)){m.preventDefault();let g=r!==void 0?r:mh(h)===mh(f);u(t,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function qw(t){let e=b.useRef(Rg(t)),n=b.useRef(!1),r=Oi(),a=b.useMemo(()=>CT(r.search,n.current?null:e.current),[r.search]),i=Di(),o=b.useCallback((c,u)=>{const h=Rg(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,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 OT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),DT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Bv=t=>{const e=DT(t);return e.charAt(0).toUpperCase()+e.slice(1)},Gw=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),LT=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. - * See the LICENSE file in the root directory of this source tree. - */var _T={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zT=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,..._T,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Gw("lucide",a),...!i&&!LT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(i)?i:[i]]));/** - * @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 Ee=(t,e)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement(zT,{ref:i,iconNode:e,className:Gw(`lucide-${OT(Bv(t))}`,`lucide-${t}`,r),...a}));return n.displayName=Bv(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 $T=[["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"}]],Rm=Ee("arrow-up-down",$T);/** - * @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 FT=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],BT=Ee("at-sign",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 VT=[["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"}]],Vv=Ee("bitcoin",VT);/** - * @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 HT=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],WT=Ee("bold",HT);/** - * @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:"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"}]],$r=Ee("book-open",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=[["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"}]],Og=Ee("calendar",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:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Dg=Ee("chart-column",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=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],vf=Ee("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=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ld=Ee("chevron-down",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=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],QT=Ee("chevron-left",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 XT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],mo=Ee("chevron-right",XT);/** - * @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 ZT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Jw=Ee("chevron-up",ZT);/** - * @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 eM=[["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"}]],tM=Ee("circle-alert",eM);/** - * @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=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Hv=Ee("circle-check-big",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Lg=Ee("circle-check",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=[["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"}]],Yw=Ee("circle-question-mark",sM);/** - * @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 aM=[["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"}]],Pm=Ee("circle-user",aM);/** - * @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 iM=[["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"}]],Qw=Ee("circle-x",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 oM=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_g=Ee("clock",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:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],cM=Ee("cloud",lM);/** - * @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 dM=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],uM=Ee("code",dM);/** - * @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 hM=[["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"}]],Xw=Ee("copy",hM);/** - * @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=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Wv=Ee("credit-card",fM);/** - * @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 pM=[["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=Ee("crown",pM);/** - * @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 mM=[["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"}]],gh=Ee("dollar-sign",mM);/** - * @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 gM=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],xM=Ee("download",gM);/** - * @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 yM=[["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"}]],Ta=Ee("external-link",yM);/** - * @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 bM=[["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"}]],zg=Ee("eye",bM);/** - * @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 vM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],NM=Ee("file-text",vM);/** - * @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 wM=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Zw=Ee("funnel",wM);/** - * @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 jM=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],kM=Ee("gift",jM);/** - * @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=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],CM=Ee("git-merge",SM);/** - * @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 EM=[["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"}]],$g=Ee("globe",EM);/** - * @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 TM=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],MM=Ee("graduation-cap",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 AM=[["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"}]],ha=Ee("grip-vertical",AM);/** - * @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 IM=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],RM=Ee("handshake",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 PM=[["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"}]],Uv=Ee("hash",PM);/** - * @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 OM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],DM=Ee("heading-1",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:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],_M=Ee("heading-2",LM);/** - * @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 zM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],$M=Ee("heading-3",zM);/** - * @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:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],BM=Ee("house",FM);/** - * @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 VM=[["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"}]],ej=Ee("image",VM);/** - * @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 HM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],$c=Ee("info",HM);/** - * @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 WM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],UM=Ee("italic",WM);/** - * @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 KM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],tj=Ee("key",KM);/** - * @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 qM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],GM=Ee("layout-dashboard",qM);/** - * @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 JM=[["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"}]],Ns=Ee("link-2",JM);/** - * @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 YM=[["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"}]],Fg=Ee("link",YM);/** - * @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 QM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],XM=Ee("list-ordered",QM);/** - * @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 ZM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],eA=Ee("list",ZM);/** - * @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:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],nA=Ee("lock",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 rA=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],sA=Ee("log-out",rA);/** - * @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:"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"}]],nj=Ee("map-pin",aA);/** - * @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 iA=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],oA=Ee("menu",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 lA=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],cA=Ee("message-circle",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 dA=[["path",{d:"M5 12h14",key:"1ays0h"}]],uA=Ee("minus",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 hA=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],El=Ee("navigation",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 fA=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],pA=Ee("palette",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 mA=[["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=Ee("pen-line",mA);/** - * @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 gA=[["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"}]],xA=Ee("pencil",gA);/** - * @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 yA=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],bA=Ee("percent",yA);/** - * @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:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],NA=Ee("phone",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 wA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],jA=Ee("pin",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 kA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],pn=Ee("plus",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=[["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"}]],Kv=Ee("qr-code",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:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],EA=Ee("quote",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 TA=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],MA=Ee("redo",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 AA=[["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"}]],Ue=Ee("refresh-cw",AA);/** - * @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 IA=[["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"}]],mn=Ee("save",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 RA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ka=Ee("search",RA);/** - * @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=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],OA=Ee("send",PA);/** - * @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:"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"}]],vo=Ee("settings",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:"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"}]],Pu=Ee("settings-2",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:"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"}]],qc=Ee("shield-check",_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:"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"}]],Bg=Ee("shopping-bag",zA);/** - * @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=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Ol=Ee("smartphone",$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 FA=[["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"}]],xi=Ee("star",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 BA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],VA=Ee("strikethrough",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 HA=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],WA=Ee("table",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 UA=[["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"}]],Gc=Ee("tag",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:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],er=Ee("trash-2",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:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Dl=Ee("trending-up",qA);/** - * @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 GA=[["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"}]],Vg=Ee("trophy",GA);/** - * @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 JA=[["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"}]],rj=Ee("undo-2",JA);/** - * @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 YA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],QA=Ee("undo",YA);/** - * @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 XA=[["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"}]],xh=Ee("upload",XA);/** - * @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:"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"}]],Hg=Ee("user-plus",ZA);/** - * @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 e5=[["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"}]],No=Ee("user",e5);/** - * @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 t5=[["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"}]],Dn=Ee("users",t5);/** - * @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 n5=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],r5=Ee("video",n5);/** - * @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 s5=[["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"}]],Ll=Ee("wallet",s5);/** - * @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 a5=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],nr=Ee("x",a5);/** - * @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 i5=[["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"}]],yi=Ee("zap",i5),Gx="admin_token";function Sd(){try{return localStorage.getItem(Gx)}catch{return null}}function o5(t){try{localStorage.setItem(Gx,t)}catch{}}function Om(){try{localStorage.removeItem(Gx)}catch{}}const l5="https://soulapi.quwanzhi.com",c5=15e3,d5=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):l5};function wa(t){const e=d5(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Nf(t,e={}){const{data:n,...r}=e,a=wa(t),i=new Headers(r.headers),o=Sd();o&&i.set("Authorization",`Bearer ${o}`),n!=null&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=new AbortController,h=setTimeout(()=>u.abort(),c5),f=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:u.signal}).finally(()=>clearTimeout(h)),g=(f.headers.get("Content-Type")||"").includes("application/json")?await f.json():f;if(!f.ok){const y=new Error((g==null?void 0:g.error)||`HTTP ${f.status}`);throw y.status=f.status,y.data=g,y}return g}function Le(t,e){return Nf(t,{...e,method:"GET"})}function vt(t,e,n){return Nf(t,{...n,method:"POST",data:e})}function Tt(t,e,n){return Nf(t,{...n,method:"PUT",data:e})}function Na(t,e){return Nf(t,{...e,method:"DELETE"})}const u5=[{icon:GM,label:"数据概览",href:"/dashboard"},{icon:$r,label:"内容管理",href:"/content"},{icon:Dn,label:"用户管理",href:"/users"},{icon:CM,label:"找伙伴",href:"/find-partner"},{icon:Ll,label:"推广中心",href:"/distribution"}];function h5(){const t=Oi(),e=Di(),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;return Sd()?(Le("/api/admin").then(h=>{c||((h==null?void 0:h.success)===!0?i(!0):(Om(),e("/login",{replace:!0})))}).catch(()=>{c||(Om(),e("/login",{replace:!0}))}),()=>{c=!0}):(e("/login",{replace:!0,state:{from:t.pathname}}),()=>{c=!0})},[t.pathname,n,e]);const o=async()=>{Om();try{await vt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?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.jsx("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:u5.map(c=>{const u=t.pathname===c.href;return s.jsxs(Pg,{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.jsxs("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:[s.jsxs(Pg,{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(vo,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",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(sA,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:s.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:s.jsx(vT,{})})})]})}function qv(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Jx(...t){return e=>{let n=!1;const r=t.map(a=>{const i=qv(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;sj(i)&&typeof yh=="function"&&(i=yh(i._payload));const c=b.Children.toArray(i),u=c.find(x5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var ij=aj("Slot");function m5(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(sj(a)&&typeof yh=="function"&&(a=yh(a._payload)),b.isValidElement(a)){const o=b5(a),c=y5(i,a.props);return a.type!==b.Fragment&&(c.ref=r?Jx(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var g5=Symbol("radix.slottable");function x5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===g5}function y5(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function b5(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function oj(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Jv=lj,cj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Jv(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const g=Gv(f)||Gv(m);return a[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(v=>{let[w,N]=v;return Array.isArray(N)?N.includes({...i,...c}[w]):{...i,...c}[w]===N})?[...h,m,g]:h},[]);return Jv(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},v5=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),dj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),bh="-",Yv=[],w5="arbitrary..",j5=t=>{const e=S5(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return k5(o);const c=o.split(bh),u=c[0]===""&&c.length>1?1:0;return uj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?v5(h,u):u:h||Yv}return n[o]||Yv}}},uj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=uj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(bh):t.slice(e).join(bh),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?w5+r:void 0})(),S5=t=>{const{theme:e,classGroups:n}=t;return C5(n,e)},C5=(t,e)=>{const n=dj();for(const r in t){const a=t[r];Yx(a,n,r,e)}return n},Yx=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){T5(t,e,n);return}if(typeof t=="function"){M5(t,e,n,r);return}A5(t,e,n,r)},T5=(t,e,n)=>{const r=t===""?e:hj(e,t);r.classGroupId=n},M5=(t,e,n,r)=>{if(I5(t)){Yx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(N5(n,t))},A5=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(bh),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,R5=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const a=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},Wg="!",Qv=":",P5=[],Xv=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),O5=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let w=0;wu?h-u:void 0;return Xv(i,y,g,v)};if(e){const a=e+Qv,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):Xv(P5,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},D5=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i0&&(a.sort(),r.push(...a),a=[]),r.push(o)):a.push(o)}return a.length>0&&(a.sort(),r.push(...a)),r}},L5=t=>({cache:R5(t.cacheSize),parseClassName:O5(t),sortModifiers:D5(t),...j5(t)}),_5=/\s+/,z5=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(_5);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let N=!!w,k=r(N?v.substring(0,w):v);if(!k){if(!N){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}N=!1}const C=g.length===0?"":g.length===1?g[0]:i(g).join(":"),E=y?C+Wg:C,I=E+k;if(o.indexOf(I)>-1)continue;o.push(I);const P=a(k,N);for(let B=0;B0?" "+u:u)}return u},$5=(...t)=>{let e=0,n,r,a="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,a,i;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=L5(h),r=n.cache.get,a=n.cache.set,i=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=z5(u,n);return a(u,f),f};return i=o,(...u)=>i($5(...u))},B5=[],En=t=>{const e=n=>n[t]||B5;return e.isThemeGetter=!0,e},pj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,mj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,V5=/^\d+\/\d+$/,H5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,W5=/\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$/,U5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,K5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,q5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gl=t=>V5.test(t),ut=t=>!!t&&!Number.isNaN(Number(t)),ai=t=>!!t&&Number.isInteger(Number(t)),Dm=t=>t.endsWith("%")&&ut(t.slice(0,-1)),fa=t=>H5.test(t),G5=()=>!0,J5=t=>W5.test(t)&&!U5.test(t),gj=()=>!1,Y5=t=>K5.test(t),Q5=t=>q5.test(t),X5=t=>!Fe(t)&&!Be(t),Z5=t=>ql(t,bj,gj),Fe=t=>pj.test(t),co=t=>ql(t,vj,J5),Lm=t=>ql(t,sI,ut),Zv=t=>ql(t,xj,gj),eI=t=>ql(t,yj,Q5),Ou=t=>ql(t,Nj,Y5),Be=t=>mj.test(t),Pc=t=>Gl(t,vj),tI=t=>Gl(t,aI),e1=t=>Gl(t,xj),nI=t=>Gl(t,bj),rI=t=>Gl(t,yj),Du=t=>Gl(t,Nj,!0),ql=(t,e,n)=>{const r=pj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Gl=(t,e,n=!1)=>{const r=mj.exec(t);return r?r[1]?e(r[1]):n:!1},xj=t=>t==="position"||t==="percentage",yj=t=>t==="image"||t==="url",bj=t=>t==="length"||t==="size"||t==="bg-size",vj=t=>t==="length",sI=t=>t==="number",aI=t=>t==="family-name",Nj=t=>t==="shadow",iI=()=>{const t=En("color"),e=En("font"),n=En("text"),r=En("font-weight"),a=En("tracking"),i=En("leading"),o=En("breakpoint"),c=En("container"),u=En("spacing"),h=En("radius"),f=En("shadow"),m=En("inset-shadow"),g=En("text-shadow"),y=En("drop-shadow"),v=En("blur"),w=En("perspective"),N=En("aspect"),k=En("ease"),C=En("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...I(),Be,Fe],B=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],R=()=>[Be,Fe,u],D=()=>[gl,"full","auto",...R()],_=()=>[ai,"none","subgrid",Be,Fe],te=()=>["auto",{span:["full",ai,Be,Fe]},ai,Be,Fe],K=()=>[ai,"auto",Be,Fe],he=()=>["auto","min","max","fr",Be,Fe],ge=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...R()],U=()=>[gl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],M=()=>[t,Be,Fe],q=()=>[...I(),e1,Zv,{position:[Be,Fe]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],O=()=>["auto","cover","contain",nI,Z5,{size:[Be,Fe]}],W=()=>[Dm,Pc,co],ie=()=>["","none","full",h,Be,Fe],J=()=>["",ut,Pc,co],X=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[ut,Dm,e1,Zv],de=()=>["","none",v,Be,Fe],ce=()=>["none",ut,Be,Fe],ye=()=>["none",ut,Be,Fe],ze=()=>[ut,Be,Fe],Oe=()=>[gl,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fa],breakpoint:[fa],color:[G5],container:[fa],"drop-shadow":[fa],ease:["in","out","in-out"],font:[X5],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fa],shadow:[fa],spacing:["px",ut],text:[fa],"text-shadow":[fa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gl,Fe,Be,N]}],container:["container"],columns:[{columns:[ut,Fe,Be,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:P()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[ai,"auto",Be,Fe]}],basis:[{basis:[gl,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,gl,"auto","initial","none",Fe]}],grow:[{grow:["",ut,Be,Fe]}],shrink:[{shrink:["",ut,Be,Fe]}],order:[{order:[ai,"first","last","none",Be,Fe]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":he()}],"auto-rows":[{"auto-rows":he()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ge(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...ge()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":ge()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[c,"screen",...U()]}],"min-w":[{"min-w":[c,"screen","none",...U()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,Pc,co]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Be,Lm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dm,Fe]}],"font-family":[{font:[tI,Fe,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:[a,Be,Fe]}],"line-clamp":[{"line-clamp":[ut,"none",Be,Lm]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Be,Fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Be,Fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",Be,co]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[ut,"auto",Be,Fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Be,Fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Be,Fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:O()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ai,Be,Fe],radial:["",Be,Fe],conic:[ai,Be,Fe]},rI,eI]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,Be,Fe]}],"outline-w":[{outline:["",ut,Pc,co]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",f,Du,Ou]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",m,Du,Ou]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[ut,co]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",g,Du,Ou]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[ut,Be,Fe]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"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":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Be,Fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":I()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Be,Fe]}],filter:[{filter:["","none",Be,Fe]}],blur:[{blur:de()}],brightness:[{brightness:[ut,Be,Fe]}],contrast:[{contrast:[ut,Be,Fe]}],"drop-shadow":[{"drop-shadow":["","none",y,Du,Ou]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",ut,Be,Fe]}],"hue-rotate":[{"hue-rotate":[ut,Be,Fe]}],invert:[{invert:["",ut,Be,Fe]}],saturate:[{saturate:[ut,Be,Fe]}],sepia:[{sepia:["",ut,Be,Fe]}],"backdrop-filter":[{"backdrop-filter":["","none",Be,Fe]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[ut,Be,Fe]}],"backdrop-contrast":[{"backdrop-contrast":[ut,Be,Fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,Be,Fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,Be,Fe]}],"backdrop-invert":[{"backdrop-invert":["",ut,Be,Fe]}],"backdrop-opacity":[{"backdrop-opacity":[ut,Be,Fe]}],"backdrop-saturate":[{"backdrop-saturate":[ut,Be,Fe]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,Be,Fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Be,Fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",Be,Fe]}],ease:[{ease:["linear","initial",k,Be,Fe]}],delay:[{delay:[ut,Be,Fe]}],animate:[{animate:["none",C,Be,Fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Be,Fe]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ze()}],"skew-x":[{"skew-x":ze()}],"skew-y":[{"skew-y":ze()}],transform:[{transform:[Be,Fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Be,Fe]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Be,Fe]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[ut,Pc,co,Lm]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},oI=F5(iI);function Et(...t){return oI(lj(t))}function ts(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const lI=cj("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 re({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?ij:"button";return s.jsx(i,{"data-slot":"button",className:Et(lI({variant:e,size:n,className:t})),...a})}function le({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Et("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 cI(){const t=Di(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1);b.useEffect(()=>{Sd()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await vt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){o5(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(qc,{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(No,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(le,{type:"text",value:e,onChange:f=>{n(f.target.value),i&&o("")},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(nA,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(le,{type:"password",value:r,onChange:f=>{a(f.target.value),i&&o("")},placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(re,{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 Ae=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Et("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ae.displayName="Card";const Xe=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Et("flex flex-col space-y-1.5 p-6",t),...e}));Xe.displayName="CardHeader";const Ze=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Et("font-semibold leading-none tracking-tight",t),...e}));Ze.displayName="CardTitle";const Ot=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Et("text-sm text-muted-foreground",t),...e}));Ot.displayName="CardDescription";const Ie=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Et("p-6 pt-0",t),...e}));Ie.displayName="CardContent";const dI=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Et("flex items-center p-6 pt-0",t),...e}));dI.displayName="CardFooter";const uI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function _m(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=uI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.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:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.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 oe={success:(t,e)=>_m(t,"success",e),error:(t,e)=>_m(t,"error",e),info:(t,e)=>_m(t,"info",e)};function at(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function hI(t,e){const n=b.createContext(e),r=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,a]}function Li(t,e=[]){let n=[];function r(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...v}=m,w=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,N=b.useMemo(()=>v,Object.values(v));return s.jsx(w.Provider,{value:N,children:y})};h.displayName=i+"Provider";function f(m,g){var w;const y=((w=g==null?void 0:g[t])==null?void 0:w[u])||c,v=b.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,fI(a,...e)]}function fI(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(i)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var rr=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},pI=yf[" useId ".trim().toString()]||(()=>{}),mI=0;function ji(t){const[e,n]=b.useState(pI());return rr(()=>{n(r=>r??String(mI++))},[t]),e?`radix-${e}`:""}var gI=yf[" useInsertionEffect ".trim().toString()]||rr;function Eo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=xI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=b.useRef(t!==void 0);b.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=b.useCallback(f=>{var m;if(c){const g=yI(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function xI({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return gI(()=>{i.current=e},[e]),b.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function yI(t){return typeof t=="function"}function cd(t){const e=bI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(NI);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function bI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=jI(a),c=wI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?Jx(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var vI=Symbol("radix.slottable");function NI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===vI}function wI(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function jI(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var kI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=kI.reduce((t,e)=>{const n=cd(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function SI(t,e){t&&kd.flushSync(()=>t.dispatchEvent(e))}function Ti(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function CI(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t);b.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var EI="DismissableLayer",Ug="dismissableLayer.update",TI="dismissableLayer.pointerDownOutside",MI="dismissableLayer.focusOutside",t1,wj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qx=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(wj),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=Ct(e,L=>m(L)),w=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(N),C=f?w.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,I=C>=k,P=RI(L=>{const R=L.target,D=[...h.branches].some(_=>_.contains(R));!I||D||(a==null||a(L),o==null||o(L),L.defaultPrevented||c==null||c())},g),B=PI(L=>{const R=L.target;[...h.branches].some(_=>_.contains(R))||(i==null||i(L),o==null||o(L),L.defaultPrevented||c==null||c())},g);return CI(L=>{C===h.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&c&&(L.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(t1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),n1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=t1)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),n1())},[f,h]),b.useEffect(()=>{const L=()=>y({});return document.addEventListener(Ug,L),()=>document.removeEventListener(Ug,L)},[]),s.jsx(ht.div,{...u,ref:v,style:{pointerEvents:E?I?"auto":"none":void 0,...t.style},onFocusCapture:at(t.onFocusCapture,B.onFocusCapture),onBlurCapture:at(t.onBlurCapture,B.onBlurCapture),onPointerDownCapture:at(t.onPointerDownCapture,P.onPointerDownCapture)})});Qx.displayName=EI;var AI="DismissableLayerBranch",II=b.forwardRef((t,e)=>{const n=b.useContext(wj),r=b.useRef(null),a=Ct(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(ht.div,{...t,ref:a})});II.displayName=AI;function RI(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){jj(TI,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=u,e.addEventListener("click",a.current,{once:!0})):u()}else e.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function PI(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&jj(MI,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function n1(){const t=new CustomEvent(Ug);document.dispatchEvent(t)}function jj(t,e,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),r?SI(a,i):a.dispatchEvent(i)}var zm="focusScope.autoFocusOnMount",$m="focusScope.autoFocusOnUnmount",r1={bubbles:!1,cancelable:!0},OI="FocusScope",Xx=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=Ti(a),f=Ti(i),m=b.useRef(null),g=Ct(e,w=>u(w)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let w=function(E){if(y.paused||!c)return;const I=E.target;c.contains(I)?m.current=I:li(m.current,{select:!0})},N=function(E){if(y.paused||!c)return;const I=E.relatedTarget;I!==null&&(c.contains(I)||li(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const P of E)P.removedNodes.length>0&&li(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",N),C.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){a1.add(y);const w=document.activeElement;if(!c.contains(w)){const k=new CustomEvent(zm,r1);c.addEventListener(zm,h),c.dispatchEvent(k),k.defaultPrevented||(DI(FI(kj(c)),{select:!0}),document.activeElement===w&&li(c))}return()=>{c.removeEventListener(zm,h),setTimeout(()=>{const k=new CustomEvent($m,r1);c.addEventListener($m,f),c.dispatchEvent(k),k.defaultPrevented||li(w??document.body,{select:!0}),c.removeEventListener($m,f),a1.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(w=>{if(!n&&!r||y.paused)return;const N=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(N&&k){const C=w.currentTarget,[E,I]=LI(C);E&&I?!w.shiftKey&&k===I?(w.preventDefault(),n&&li(E,{select:!0})):w.shiftKey&&k===E&&(w.preventDefault(),n&&li(I,{select:!0})):k===C&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(ht.div,{tabIndex:-1,...o,ref:g,onKeyDown:v})});Xx.displayName=OI;function DI(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(li(r,{select:e}),document.activeElement!==n)return}function LI(t){const e=kj(t),n=s1(e,t),r=s1(e.reverse(),t);return[n,r]}function kj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function s1(t,e){for(const n of t)if(!_I(n,{upTo:e}))return n}function _I(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 zI(t){return t instanceof HTMLInputElement&&"select"in t}function li(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&zI(t)&&e&&t.select()}}var a1=$I();function $I(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=i1(t,e),t.unshift(e)},remove(e){var n;t=i1(t,e),(n=t[0])==null||n.resume()}}}function i1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function FI(t){return t.filter(e=>e.tagName!=="A")}var BI="Portal",Zx=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);rr(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?_w.createPortal(s.jsx(ht.div,{...r,ref:e}),o):null});Zx.displayName=BI;function VI(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Cd=t=>{const{present:e,children:n}=t,r=HI(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=Ct(r.ref,WI(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};Cd.displayName="Presence";function HI(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=VI(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=Lu(r.current);i.current=c==="mounted"?h:"none"},[c]),rr(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,y=Lu(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),rr(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const w=Lu(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(u("ANIMATION_END"),!a.current)){const N=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=N)})}},g=y=>{y.target===e&&(i.current=Lu(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:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Lu(t){return(t==null?void 0:t.animationName)||"none"}function WI(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Fm=0;function Sj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??o1()),document.body.insertAdjacentElement("beforeend",t[1]??o1()),Fm++,()=>{Fm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Fm--}},[])}function o1(){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 Hs=function(){return Hs=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return oR;var e=lR(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])}},dR=Mj(),Al="data-scroll-locked",uR=function(t,e,n,r){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` - .`.concat(KI,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(Al,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(a,`px; - padding-top: `).concat(i,`px; - padding-right: `).concat(o,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(ah,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(ih,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(ah," .").concat(ah,` { - right: 0 `).concat(r,`; - } - - .`).concat(ih," .").concat(ih,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Al,`] { - `).concat(qI,": ").concat(c,`px; - } -`)},c1=function(){var t=parseInt(document.body.getAttribute(Al)||"0",10);return isFinite(t)?t:0},hR=function(){b.useEffect(function(){return document.body.setAttribute(Al,(c1()+1).toString()),function(){var t=c1()-1;t<=0?document.body.removeAttribute(Al):document.body.setAttribute(Al,t.toString())}},[])},fR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;hR();var i=b.useMemo(function(){return cR(a)},[a]);return b.createElement(dR,{styles:uR(i,!e,a,n?"":"!important")})},Kg=!1;if(typeof window<"u")try{var _u=Object.defineProperty({},"passive",{get:function(){return Kg=!0,!0}});window.addEventListener("test",_u,_u),window.removeEventListener("test",_u,_u)}catch{Kg=!1}var xl=Kg?{passive:!1}:!1,pR=function(t){return t.tagName==="TEXTAREA"},Aj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!pR(t)&&n[e]==="visible")},mR=function(t){return Aj(t,"overflowY")},gR=function(t){return Aj(t,"overflowX")},d1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Ij(t,r);if(a){var i=Rj(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},xR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},yR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Ij=function(t,e){return t==="v"?mR(e):gR(e)},Rj=function(t,e){return t==="v"?xR(e):yR(e)},bR=function(t,e){return t==="h"&&e==="rtl"?-1:1},vR=function(t,e,n,r,a){var i=bR(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=Rj(t,c),v=y[0],w=y[1],N=y[2],k=w-N-i*v;(v||k)&&Ij(t,c)&&(m+=k,g+=v);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},zu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},u1=function(t){return[t.deltaX,t.deltaY]},h1=function(t){return t&&"current"in t?t.current:t},NR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},wR=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},jR=0,yl=[];function kR(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(jR++)[0],i=b.useState(Mj)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var w=UI([t.lockRef.current],(t.shards||[]).map(h1),!0).filter(Boolean);return w.forEach(function(N){return N.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),w.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(w,N){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var k=zu(w),C=n.current,E="deltaX"in w?w.deltaX:C[0]-k[0],I="deltaY"in w?w.deltaY:C[1]-k[1],P,B=w.target,L=Math.abs(E)>Math.abs(I)?"h":"v";if("touches"in w&&L==="h"&&B.type==="range")return!1;var R=window.getSelection(),D=R&&R.anchorNode,_=D?D===B||D.contains(B):!1;if(_)return!1;var te=d1(L,B);if(!te)return!0;if(te?P=L:(P=L==="v"?"h":"v",te=d1(L,B)),!te)return!1;if(!r.current&&"changedTouches"in w&&(E||I)&&(r.current=P),!P)return!0;var K=r.current||P;return vR(K,N,w,K==="h"?E:I)},[]),u=b.useCallback(function(w){var N=w;if(!(!yl.length||yl[yl.length-1]!==i)){var k="deltaY"in N?u1(N):zu(N),C=e.current.filter(function(P){return P.name===N.type&&(P.target===N.target||N.target===P.shadowParent)&&NR(P.delta,k)})[0];if(C&&C.should){N.cancelable&&N.preventDefault();return}if(!C){var E=(o.current.shards||[]).map(h1).filter(Boolean).filter(function(P){return P.contains(N.target)}),I=E.length>0?c(N,E[0]):!o.current.noIsolation;I&&N.cancelable&&N.preventDefault()}}},[]),h=b.useCallback(function(w,N,k,C){var E={name:w,delta:N,target:k,should:C,shadowParent:SR(k)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(I){return I!==E})},1)},[]),f=b.useCallback(function(w){n.current=zu(w),r.current=void 0},[]),m=b.useCallback(function(w){h(w.type,u1(w),w.target,c(w,t.lockRef.current))},[]),g=b.useCallback(function(w){h(w.type,zu(w),w.target,c(w,t.lockRef.current))},[]);b.useEffect(function(){return yl.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,xl),document.addEventListener("touchmove",u,xl),document.addEventListener("touchstart",f,xl),function(){yl=yl.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,xl),document.removeEventListener("touchmove",u,xl),document.removeEventListener("touchstart",f,xl)}},[]);var y=t.removeScrollBar,v=t.inert;return b.createElement(b.Fragment,null,v?b.createElement(i,{styles:wR(a)}):null,y?b.createElement(fR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function SR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const CR=eR(Tj,kR);var e0=b.forwardRef(function(t,e){return b.createElement(wf,Hs({},t,{ref:e,sideCar:CR}))});e0.classNames=wf.classNames;var ER=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},bl=new WeakMap,$u=new WeakMap,Fu={},Wm=0,Pj=function(t){return t&&(t.host||Pj(t.parentNode))},TR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Pj(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})},MR=function(t,e,n,r){var a=TR(e,Array.isArray(t)?t:[t]);Fu[n]||(Fu[n]=new WeakMap);var i=Fu[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.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),v=y!==null&&y!=="false",w=(bl.get(g)||0)+1,N=(i.get(g)||0)+1;bl.set(g,w),i.set(g,N),o.push(g),w===1&&v&&$u.set(g,!0),N===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Wm++,function(){o.forEach(function(m){var g=bl.get(m)-1,y=i.get(m)-1;bl.set(m,g),i.set(m,y),g||($u.has(m)||m.removeAttribute(r),$u.delete(m)),y||m.removeAttribute(n)}),Wm--,Wm||(bl=new WeakMap,bl=new WeakMap,$u=new WeakMap,Fu={})}},Oj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=ER(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),MR(r,a,n,"aria-hidden")):function(){return null}},jf="Dialog",[Dj]=Li(jf),[AR,Ss]=Dj(jf),Lj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=Eo({prop:r,defaultProp:a??!1,onChange:i,caller:jf});return s.jsx(AR,{scope:e,triggerRef:c,contentRef:u,contentId:ji(),titleId:ji(),descriptionId:ji(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Lj.displayName=jf;var _j="DialogTrigger",IR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ss(_j,n),i=Ct(e,a.triggerRef);return s.jsx(ht.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":r0(a.open),...r,ref:i,onClick:at(t.onClick,a.onOpenToggle)})});IR.displayName=_j;var t0="DialogPortal",[RR,zj]=Dj(t0,{forceMount:void 0}),$j=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=Ss(t0,e);return s.jsx(RR,{scope:e,forceMount:n,children:b.Children.map(r,o=>s.jsx(Cd,{present:n||i.open,children:s.jsx(Zx,{asChild:!0,container:a,children:o})}))})};$j.displayName=t0;var vh="DialogOverlay",Fj=b.forwardRef((t,e)=>{const n=zj(vh,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Ss(vh,t.__scopeDialog);return i.modal?s.jsx(Cd,{present:r||i.open,children:s.jsx(OR,{...a,ref:e})}):null});Fj.displayName=vh;var PR=cd("DialogOverlay.RemoveScroll"),OR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ss(vh,n);return s.jsx(e0,{as:PR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(ht.div,{"data-state":r0(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),To="DialogContent",Bj=b.forwardRef((t,e)=>{const n=zj(To,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Ss(To,t.__scopeDialog);return s.jsx(Cd,{present:r||i.open,children:i.modal?s.jsx(DR,{...a,ref:e}):s.jsx(LR,{...a,ref:e})})});Bj.displayName=To;var DR=b.forwardRef((t,e)=>{const n=Ss(To,t.__scopeDialog),r=b.useRef(null),a=Ct(e,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return Oj(i)},[]),s.jsx(Vj,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:at(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:at(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:at(t.onFocusOutside,i=>i.preventDefault())})}),LR=b.forwardRef((t,e)=>{const n=Ss(To,t.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return s.jsx(Vj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Vj=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=Ss(To,n),u=b.useRef(null),h=Ct(e,u);return Sj(),s.jsxs(s.Fragment,{children:[s.jsx(Xx,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(Qx,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":r0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(_R,{titleId:c.titleId}),s.jsx($R,{contentRef:u,descriptionId:c.descriptionId})]})]})}),n0="DialogTitle",Hj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ss(n0,n);return s.jsx(ht.h2,{id:a.titleId,...r,ref:e})});Hj.displayName=n0;var Wj="DialogDescription",Uj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ss(Wj,n);return s.jsx(ht.p,{id:a.descriptionId,...r,ref:e})});Uj.displayName=Wj;var Kj="DialogClose",qj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ss(Kj,n);return s.jsx(ht.button,{type:"button",...r,ref:e,onClick:at(t.onClick,()=>a.onOpenChange(!1))})});qj.displayName=Kj;function r0(t){return t?"open":"closed"}var Gj="DialogTitleWarning",[ZV,Jj]=hI(Gj,{contentName:To,titleName:n0,docsSlug:"dialog"}),_R=({titleId:t})=>{const e=Jj(Gj),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 b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},zR="DialogDescriptionWarning",$R=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Jj(zR).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},FR=Lj,BR=$j,VR=Fj,HR=Bj,WR=Hj,UR=Uj,KR=qj;function Bt(t){return s.jsx(FR,{"data-slot":"dialog",...t})}function qR(t){return s.jsx(BR,{...t})}const Yj=b.forwardRef(({className:t,...e},n)=>s.jsx(VR,{ref:n,className:Et("fixed inset-0 z-50 bg-black/50",t),...e}));Yj.displayName="DialogOverlay";const Rt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(qR,{children:[s.jsx(Yj,{}),s.jsxs(HR,{ref:a,"aria-describedby":void 0,className:Et("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(KR,{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(nr,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rt.displayName="DialogContent";function Vt({className:t,...e}){return s.jsx("div",{className:Et("flex flex-col gap-2 text-center sm:text-left",t),...e})}function ln({className:t,...e}){return s.jsx("div",{className:Et("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Ht(t){return s.jsx(WR,{className:"text-lg font-semibold leading-none",...t})}function Qj(t){return s.jsx(UR,{className:"text-sm text-muted-foreground",...t})}const GR=cj("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 Ke({className:t,variant:e,asChild:n=!1,...r}){const a=n?ij:"span";return s.jsx(a,{className:Et(GR({variant:e}),t),...r})}var JR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YR=JR.reduce((t,e)=>{const n=aj(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),QR="Label",Xj=b.forwardRef((t,e)=>s.jsx(YR.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Xj.displayName=QR;var Zj=Xj;const ee=b.forwardRef(({className:t,...e},n)=>s.jsx(Zj,{ref:n,className:Et("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));ee.displayName=Zj.displayName;function s0(t){const e=t+"CollectionProvider",[n,r]=Li(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:N,children:k}=w,C=fr.useRef(null),E=fr.useRef(new Map).current;return s.jsx(a,{scope:N,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=cd(c),h=fr.forwardRef((w,N)=>{const{scope:k,children:C}=w,E=i(c,k),I=Ct(N,E.collectionRef);return s.jsx(u,{ref:I,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=cd(f),y=fr.forwardRef((w,N)=>{const{scope:k,children:C,...E}=w,I=fr.useRef(null),P=Ct(N,I),B=i(f,k);return fr.useEffect(()=>(B.itemMap.set(I,{ref:I,...E}),()=>void B.itemMap.delete(I))),s.jsx(g,{[m]:"",ref:P,children:C})});y.displayName=f;function v(w){const N=i(t+"CollectionConsumer",w);return fr.useCallback(()=>{const C=N.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(N.itemMap.values()).sort((B,L)=>E.indexOf(B.ref.current)-E.indexOf(L.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var XR=b.createContext(void 0);function kf(t){const e=b.useContext(XR);return t||e||"ltr"}var Um="rovingFocusGroup.onEntryFocus",ZR={bubbles:!1,cancelable:!0},Ed="RovingFocusGroup",[qg,ek,eP]=s0(Ed),[tP,tk]=Li(Ed,[eP]),[nP,rP]=tP(Ed),nk=b.forwardRef((t,e)=>s.jsx(qg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(qg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(sP,{...t,ref:e})})}));nk.displayName=Ed;var sP=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=Ct(e,g),v=kf(i),[w,N]=Eo({prop:o,defaultProp:c??null,onChange:u,caller:Ed}),[k,C]=b.useState(!1),E=Ti(h),I=ek(n),P=b.useRef(!1),[B,L]=b.useState(0);return b.useEffect(()=>{const R=g.current;if(R)return R.addEventListener(Um,E),()=>R.removeEventListener(Um,E)},[E]),s.jsx(nP,{scope:n,orientation:r,dir:v,loop:a,currentTabStopId:w,onItemFocus:b.useCallback(R=>N(R),[N]),onItemShiftTab:b.useCallback(()=>C(!0),[]),onFocusableItemAdd:b.useCallback(()=>L(R=>R+1),[]),onFocusableItemRemove:b.useCallback(()=>L(R=>R-1),[]),children:s.jsx(ht.div,{tabIndex:k||B===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:at(t.onMouseDown,()=>{P.current=!0}),onFocus:at(t.onFocus,R=>{const D=!P.current;if(R.target===R.currentTarget&&D&&!k){const _=new CustomEvent(Um,ZR);if(R.currentTarget.dispatchEvent(_),!_.defaultPrevented){const te=I().filter(V=>V.focusable),K=te.find(V=>V.active),he=te.find(V=>V.id===w),z=[K,he,...te].filter(Boolean).map(V=>V.ref.current);ak(z,f)}}P.current=!1}),onBlur:at(t.onBlur,()=>C(!1))})})}),rk="RovingFocusGroupItem",sk=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=ji(),h=i||u,f=rP(rk,n),m=f.currentTabStopId===h,g=ek(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),s.jsx(qg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(ht.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:at(t.onMouseDown,N=>{r?f.onItemFocus(h):N.preventDefault()}),onFocus:at(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:at(t.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){f.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const k=oP(N,f.orientation,f.dir);if(k!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let E=g().filter(I=>I.focusable).map(I=>I.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const I=E.indexOf(N.currentTarget);E=f.loop?lP(E,I+1):E.slice(I+1)}setTimeout(()=>ak(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});sk.displayName=rk;var aP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function oP(t,e,n){const r=iP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return aP[r]}function ak(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function lP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var cP=nk,dP=sk,Sf="Tabs",[uP]=Li(Sf,[tk]),ik=tk(),[hP,a0]=uP(Sf),ok=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=kf(c),[m,g]=Eo({prop:r,onChange:a,defaultProp:i??"",caller:Sf});return s.jsx(hP,{scope:n,baseId:ji(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(ht.div,{dir:f,"data-orientation":o,...h,ref:e})})});ok.displayName=Sf;var lk="TabsList",ck=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=a0(lk,n),o=ik(n);return s.jsx(cP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(ht.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});ck.displayName=lk;var dk="TabsTrigger",uk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=a0(dk,n),c=ik(n),u=pk(o.baseId,r),h=mk(o.baseId,r),f=r===o.value;return s.jsx(dP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(ht.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:at(t.onMouseDown,m=>{!a&&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&&!a&&m&&o.onValueChange(r)})})})});uk.displayName=dk;var hk="TabsContent",fk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=a0(hk,n),u=pk(c.baseId,r),h=mk(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Cd,{present:a||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&&i})})});fk.displayName=hk;function pk(t,e){return`${t}-trigger-${e}`}function mk(t,e){return`${t}-content-${e}`}var fP=ok,gk=ck,xk=uk,yk=fk;const Td=fP,Jl=b.forwardRef(({className:t,...e},n)=>s.jsx(gk,{ref:n,className:Et("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Jl.displayName=gk.displayName;const tn=b.forwardRef(({className:t,...e},n)=>s.jsx(xk,{ref:n,className:Et("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=xk.displayName;const nn=b.forwardRef(({className:t,...e},n)=>s.jsx(yk,{ref:n,className:Et("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=yk.displayName;function i0(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function o0(t){const[e,n]=b.useState(void 0);return rr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,c;if("borderBoxSize"in i){const u=i.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 Cf="Switch",[pP]=Li(Cf),[mP,gP]=pP(Cf),bk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),v=Ct(e,E=>y(E)),w=b.useRef(!1),N=g?f||!!g.closest("form"):!0,[k,C]=Eo({prop:a,defaultProp:i??!1,onChange:h,caller:Cf});return s.jsxs(mP,{scope:n,checked:k,disabled:c,children:[s.jsx(ht.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":jk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:at(t.onClick,E=>{C(I=>!I),N&&(w.current=E.isPropagationStopped(),w.current||E.stopPropagation())})}),N&&s.jsx(wk,{control:g,bubbles:!w.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});bk.displayName=Cf;var vk="SwitchThumb",Nk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=gP(vk,n);return s.jsx(ht.span,{"data-state":jk(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});Nk.displayName=vk;var xP="SwitchBubbleInput",wk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=Ct(o,i),u=i0(n),h=o0(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});wk.displayName=xP;function jk(t){return t?"checked":"unchecked"}var kk=bk,yP=Nk;const kt=b.forwardRef(({className:t,...e},n)=>s.jsx(kk,{className:Et("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(yP,{className:Et("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")})}));kt.displayName=kk.displayName;function l0({open:t,onClose:e,userId:n,onUserUpdated:r}){var or;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,w]=b.useState(!1),[N,k]=b.useState("info"),[C,E]=b.useState(""),[I,P]=b.useState(""),[B,L]=b.useState([]),[R,D]=b.useState(""),[_,te]=b.useState(""),[K,he]=b.useState(""),[ge,z]=b.useState(!1),[V,U]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[M,q]=b.useState([]),[F,O]=b.useState(!1),[W,ie]=b.useState(!1),[J,X]=b.useState(null),[G,se]=b.useState(null),[de,ce]=b.useState(""),[ye,ze]=b.useState(""),[Oe,ct]=b.useState(""),[Lt,jn]=b.useState(!1),[it,Mt]=b.useState(null),[ne,Pe]=b.useState("");b.useEffect(()=>{t&&n&&(k("info"),X(null),se(null),Mt(null),Pe(""),te(""),he(""),et(),Le("/api/db/vip-roles").then(xe=>{xe!=null&&xe.success&&xe.data&&q(xe.data)}).catch(()=>{}))},[t,n]);async function et(){if(n){m(!0);try{const xe=await Le(`/api/db/users?id=${encodeURIComponent(n)}`);if(xe!=null&&xe.success&&xe.user){const we=xe.user;i(we),E(we.phone||""),P(we.nickname||""),ce(we.phone||""),ze(we.wechatId||""),ct(we.openId||"");try{L(typeof we.tags=="string"?JSON.parse(we.tags||"[]"):[])}catch{L([])}U({isVip:!!(we.isVip??!1),vipExpireDate:we.vipExpireDate?String(we.vipExpireDate).slice(0,10):"",vipRole:String(we.vipRole??""),vipName:String(we.vipName??""),vipProject:String(we.vipProject??""),vipContact:String(we.vipContact??""),vipBio:String(we.vipBio??"")})}try{const we=await Le(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);we!=null&&we.success&&we.tracks&&c(we.tracks)}catch{c([])}try{const we=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);we!=null&&we.success&&we.referrals&&h(we.referrals)}catch{h([])}}catch(xe){console.error("Load user detail error:",xe)}finally{m(!1)}}}async function xt(){if(!(a!=null&&a.phone)){oe.info("用户未绑定手机号,无法同步");return}y(!0);try{const xe=await vt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});xe!=null&&xe.success?(oe.success("同步成功"),et()):oe.error("同步失败: "+(xe==null?void 0:xe.error))}catch(xe){console.error("Sync CKB error:",xe),oe.error("同步失败")}finally{y(!1)}}async function pt(){if(a){w(!0);try{const xe={id:a.id,phone:C||void 0,nickname:I||void 0,tags:JSON.stringify(B)},we=await Tt("/api/db/users",xe);we!=null&&we.success?(oe.success("保存成功"),et(),r==null||r()):oe.error("保存失败: "+(we==null?void 0:we.error))}catch(xe){console.error("Save user error:",xe),oe.error("保存失败")}finally{w(!1)}}}const mt=()=>{R&&!B.includes(R)&&(L([...B,R]),D(""))},wt=xe=>L(B.filter(we=>we!==xe));async function Qt(){if(a){if(!_){oe.error("请输入新密码");return}if(_!==K){oe.error("两次密码不一致");return}if(_.length<6){oe.error("密码至少 6 位");return}z(!0);try{const xe=await Tt("/api/db/users",{id:a.id,password:_});xe!=null&&xe.success?(oe.success("修改成功"),te(""),he("")):oe.error("修改失败: "+((xe==null?void 0:xe.error)||""))}catch{oe.error("修改失败")}finally{z(!1)}}}async function _t(){if(a){if(V.isVip&&!V.vipExpireDate.trim()){oe.error("开启 VIP 请填写有效到期日");return}O(!0);try{const xe={id:a.id,isVip:V.isVip,vipExpireDate:V.isVip?V.vipExpireDate:void 0,vipRole:V.vipRole||void 0,vipName:V.vipName||void 0,vipProject:V.vipProject||void 0,vipContact:V.vipContact||void 0,vipBio:V.vipBio||void 0},we=await Tt("/api/db/users",xe);we!=null&&we.success?(oe.success("VIP 设置已保存"),et(),r==null||r()):oe.error("保存失败: "+((we==null?void 0:we.error)||""))}catch{oe.error("保存失败")}finally{O(!1)}}}async function Mn(){if(!de&&!Oe&&!ye){se("请至少输入手机号、微信号或 OpenID 中的一项");return}ie(!0),se(null),X(null);try{const xe=new URLSearchParams;de&&xe.set("phone",de),Oe&&xe.set("openId",Oe),ye&&xe.set("wechatId",ye);const we=await Le(`/api/admin/shensheshou/query?${xe}`);we!=null&&we.success&&we.data?(X(we.data),a&&await At(we.data)):se((we==null?void 0:we.error)||"未查询到数据,该用户可能未在神射手收录")}catch(xe){console.error("SSS query error:",xe),se("请求失败,请检查神射手接口配置")}finally{ie(!1)}}async function At(xe){if(a)try{await vt("/api/admin/shensheshou/enrich",{userId:a.id,phone:de||a.phone||"",openId:Oe||a.openId||"",wechatId:ye||a.wechatId||""}),et()}catch(we){console.error("SSS enrich error:",we)}}async function Kn(){if(a){jn(!0),Mt(null);try{const xe={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:B}]},we=await vt("/api/admin/shensheshou/ingest",xe);we!=null&&we.success&&we.data?Mt(we.data):Mt({error:(we==null?void 0:we.error)||"推送失败"})}catch(xe){console.error("SSS ingest error:",xe),Mt({error:"请求失败"})}finally{jn(!1)}}}const ns=xe=>{const qn={view_chapter:$r,purchase:Bg,match:Dn,login:No,register:No,share:Ns,bind_phone:NA,bind_wechat:cA,fill_profile:Gc,visit_page:El}[xe]||_g;return s.jsx(qn,{className:"w-4 h-4"})};return t?s.jsx(Bt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(No,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Ke,{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(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",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:a.avatar?s.jsx("img",{src:ts(a.avatar),className:"w-full h-full rounded-full object-cover",alt:""}):((or=a.nickname)==null?void 0:or.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:a.nickname}),a.isAdmin&&s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),a.hasFullBook&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),a.vipRole&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0",children:a.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[a.phone?`📱 ${a.phone}`:"未绑定手机",a.wechatId&&` · 💬 ${a.wechatId}`,a.mbti&&` · ${a.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",a.id.slice(0,16),"…"]}),a.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:a.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(a.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(Td,{value:N,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs(Jl,{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(El,{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(yi,{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(ee,{className:"text-gray-300",children:"手机号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:C,onChange:xe=>E(xe.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"昵称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:I,onChange:xe=>P(xe.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.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:a.openId})]}),a.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(nj,{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:a.region})]})]}),a.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:a.industry})]}),a.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:a.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:a.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:["¥",(a.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:a.createdAt?new Date(a.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(tj,{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(le,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:_,onChange:xe=>te(xe.target.value)}),s.jsx(le,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:K,onChange:xe=>he(xe.target.value)}),s.jsx(re,{size:"sm",onClick:Qt,disabled:ge||!_||!K,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:ge?"保存中...":"确认修改"})]})]}),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(ee,{className:"text-gray-400 text-sm",children:"VIP 会员"}),s.jsx(kt,{checked:V.isVip,onCheckedChange:xe=>U(we=>({...we,isVip:xe}))})]}),V.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(le,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:V.vipExpireDate,onChange:xe=>U(we=>({...we,vipExpireDate:xe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{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:V.vipRole,onChange:xe=>U(we=>({...we,vipRole:xe.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),M.map(xe=>s.jsx("option",{value:xe.name,children:xe.name},xe.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:V.vipName,onChange:xe=>U(we=>({...we,vipName:xe.target.value}))})]}),s.jsx(re,{size:"sm",onClick:_t,disabled:F,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:F?"保存中...":"保存 VIP"})]})]})]}),a.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(Ke,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:a.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:a.vipName})]}),a.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:a.vipProject})]}),a.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:a.vipContact})]}),a.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(a.vipExpireDate).toLocaleDateString()})]})]}),a.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:a.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(Ol,{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(le,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:ne,onChange:xe=>Pe(xe.target.value)}),s.jsxs(re,{size:"sm",onClick:async()=>{if(!(!ne||!a))try{await Tt("/api/db/users",{id:a.id,wechatId:ne}),oe.success("已保存微信归属"),et()}catch{oe.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[s.jsx(mn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),a.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:a.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(Ns,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(re,{size:"sm",onClick:xt,disabled:g||!a.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ue,{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:"同步状态:"}),a.ckbSyncedAt?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):s.jsx(Ke,{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:a.ckbSyncedAt?new Date(a.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(Gc,{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(Lg,{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(xe=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:xe.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:xe.tags.map(we=>s.jsxs("button",{type:"button",onClick:()=>{B.includes(we)?wt(we):L([...B,we])},className:`px-2 py-0.5 rounded text-xs border transition-all ${B.includes(we)?"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:[B.includes(we)?"✓ ":"",we]},we))})]},xe.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:[B.map((xe,we)=>s.jsxs(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[xe,s.jsx("button",{type:"button",onClick:()=>wt(xe),className:"ml-1 hover:text-red-400",children:s.jsx(nr,{className:"w-3 h-3"})})]},we)),B.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:R,onChange:xe=>D(xe.target.value),onKeyDown:xe=>xe.key==="Enter"&&mt()}),s.jsx(re,{onClick:mt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),a.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(Gc,{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 a.ckbTags=="string"?a.ckbTags.split(","):[]).map((xe,we)=>s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 border-0",children:xe.trim()},we))})]})]}),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(El,{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((xe,we)=>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:ns(xe.action)}),we0?u.map((xe,we)=>{var Es;const qn=xe;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:((Es=qn.nickname)==null?void 0:Es.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:qn.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[qn.status==="vip"&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-xs",children:qn.createdAt?new Date(qn.createdAt).toLocaleDateString():""})]})]},qn.id||we)}):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(yi,{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(ee,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:de,onChange:xe=>ce(xe.target.value)})]}),s.jsxs("div",{children:[s.jsx(ee,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:ye,onChange:xe=>ze(xe.target.value)})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx(ee,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:Oe,onChange:xe=>ct(xe.target.value)})]})]}),s.jsx(re,{onClick:Mn,disabled:W,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:W?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ka,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),G&&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:G}),J&&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:J.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:J.user_level??"-"})]})]}),J.tags&&J.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:J.tags.map((xe,we)=>s.jsx(Ke,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:xe},we))})]}),J.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",J.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(yi,{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(re,{onClick:Kn,disabled:Lt||!a.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Lt?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(yi,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!a.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),it&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:it.error?s.jsx("p",{className:"text-red-400",children:String(it.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(Lg,{className:"w-4 h-4"})," 推送成功"]}),it.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(it.new_tags_added??0)]})]})})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(re,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(re,{onClick:pt,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function Bu(t){if(!t)return"";const e=t.replace(/\s+/g,"");return e.length<7?e:`${e.slice(0,3)}****${e.slice(-4)}`}function bP(){const t=Di(),[e,n]=b.useState(!0),[r,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,g]=b.useState(0),[y,v]=b.useState(0),[w,N]=b.useState(0),[k,C]=b.useState(0),[E,I]=b.useState(0),[P,B]=b.useState(null),[L,R]=b.useState(null),[D,_]=b.useState(!1),[te,K]=b.useState("week"),[he,ge]=b.useState(null),[z,V]=b.useState(!1),[U,M]=b.useState(!1),q=X=>{const G=X;if((G==null?void 0:G.status)===401)B("登录已过期,请重新登录");else{if((G==null?void 0:G.name)==="AbortError")return;B("加载失败,请检查网络或联系管理员")}};async function F(X){const G=X?{signal:X}:void 0;n(!0),B(null);try{const ce=await Le("/api/admin/dashboard/stats",G);ce!=null&&ce.success&&(g(ce.totalUsers??0),v(ce.paidOrderCount??0),N(ce.totalRevenue??0),C(ce.conversionRate??0))}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",ce);try{const ye=await Le("/api/admin/dashboard/overview",G);ye!=null&&ye.success&&(g(ye.totalUsers??0),v(ye.paidOrderCount??0),N(ye.totalRevenue??0),C(ye.conversionRate??0))}catch(ye){q(ye)}}}finally{n(!1)}try{const ce=await Le("/api/admin/balance/summary",G);ce!=null&&ce.success&&ce.data&&I(ce.data.totalGifted??0)}catch{}a(!0),o(!0);const se=async()=>{try{const ce=await Le("/api/admin/dashboard/recent-orders",G);if(ce!=null&&ce.success&&ce.recentOrders)f(ce.recentOrders);else throw new Error("no data")}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError")try{const ye=await Le("/api/admin/orders?page=1&pageSize=20&status=paid",G),Oe=((ye==null?void 0:ye.orders)??[]).filter(ct=>["paid","completed","success"].includes(ct.status||""));f(Oe.slice(0,10))}catch{f([])}}finally{a(!1)}},de=async()=>{try{const ce=await Le("/api/admin/dashboard/new-users",G);if(ce!=null&&ce.success&&ce.newUsers)u(ce.newUsers);else throw new Error("no data")}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError")try{const ye=await Le("/api/db/users?page=1&pageSize=10",G);u((ye==null?void 0:ye.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([se(),de()])}async function O(X){const G=X||te;V(!0);try{const se=await Le(`/api/admin/track/stats?period=${G}`);se!=null&&se.success&&ge({total:se.total??0,byModule:se.byModule??{}})}catch{ge(null)}finally{V(!1)}}b.useEffect(()=>{const X=new AbortController;F(X.signal),O();const G=setInterval(()=>{F(),O()},3e4);return()=>{X.abort(),clearInterval(G)}},[]);const W=m,ie=X=>{const G=X.productType||"",se=X.description||"";if(se){if(G==="section"&&se.includes("章节")){if(se.includes("-")){const de=se.split("-");if(de.length>=3)return{title:`第${de[1]}章 第${de[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:se,subtitle:"章节购买"}}return G==="fullbook"||se.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:G==="match"||se.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:se,subtitle:G==="section"?"单章":G==="fullbook"?"全书":"其他"}}return G==="section"?{title:`章节 ${X.productId||""}`,subtitle:"单章购买"}:G==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:G==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:G||"其他"}},J=[{title:"总用户数",value:e?null:W,sub:null,icon:Dn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:E>0?`含代付 ¥${E.toFixed(2)}`:null,icon:Dl,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:Bg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${k.toFixed(1)}%`,sub:null,icon:Dl,color:"text-amber-400",bg:"bg-amber-500/20",link:"/users"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),P&&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:P}),s.jsx("button",{type:"button",onClick:()=>F(),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-6",children:J.map((X,G)=>s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>X.link&&t(X.link),children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(Ze,{className:"text-sm font-medium text-gray-400",children:X.title}),s.jsx("div",{className:`p-2 rounded-lg ${X.bg}`,children:s.jsx(X.icon,{className:`w-4 h-4 ${X.color}`})})]}),s.jsx(Ie,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-8 flex items-center",children:X.value!=null?X.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Ue,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),X.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:X.sub})]}),s.jsx(mo,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},G))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[s.jsx(Ze,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>F(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(Ue,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Ue,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(Ie,{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(Ue,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,U?10:4).map(X=>{var ye,ze;const G=X.referrerId?c.find(Oe=>Oe.id===X.referrerId):void 0,se=X.referralCode||(G==null?void 0:G.referralCode)||(G==null?void 0:G.nickname)||(X.referrerId?String(X.referrerId).slice(0,8):""),de=ie(X),ce=X.userNickname||((ye=c.find(Oe=>Oe.id===X.userId))==null?void 0:ye.nickname)||Bu((ze=c.find(Oe=>Oe.id===X.userId))==null?void 0:ze.phone)||"匿名用户";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:[X.userAvatar?s.jsx("img",{src:ts(X.userAvatar),alt:ce,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:Oe=>{Oe.currentTarget.style.display="none";const ct=Oe.currentTarget.nextElementSibling;ct&&ct.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] shrink-0 mt-0.5 ${X.userAvatar?"hidden":""}`,children:ce.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:()=>{X.userId&&(R(X.userId),_(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:ce}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:de.title,children:de.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[de.subtitle&&de.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:de.subtitle}),s.jsx("span",{children:new Date(X.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),se&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",se]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(X.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:X.paymentMethod||"微信"})]})]},X.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Bg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]}),h.length>4&&s.jsxs("button",{type:"button",onClick:()=>M(!U),className:"w-full py-2 text-xs text-gray-400 hover:text-[#38bdac] transition-colors flex items-center justify-center gap-1",children:[s.jsx(mo,{className:`w-3.5 h-3.5 transition-transform ${U?"rotate-90":"rotate-270"}`}),U?"收起":`展开更多(共 ${h.length} 条)`]})]})})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"新注册用户"})}),s.jsx(Ie,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ue,{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(X=>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:(X.nickname||Bu(X.phone)||"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{R(X.id),_(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:X.nickname||Bu(X.phone)||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:Bu(X.phone)||"未填写手机号"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:X.createdAt?new Date(X.createdAt).toLocaleDateString():"-"})]},X.id)),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mt-8",children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Dg,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(X=>s.jsx("button",{type:"button",onClick:()=>{K(X),O(X)},className:`px-3 py-1 text-xs rounded-full transition-colors ${te===X?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[X]},X))})]}),s.jsx(Ie,{children:z&&!he?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Ue,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):he&&Object.keys(he.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:he.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(he.byModule).sort((X,G)=>G[1].reduce((se,de)=>se+de.count,0)-X[1].reduce((se,de)=>se+de.count,0)).map(([X,G])=>{const se=G.reduce((ce,ye)=>ce+ye.count,0),de={home:"首页",chapters:"目录",read:"阅读",my:"我的",vip:"VIP",wallet:"钱包",match:"找伙伴",referral:"推广",search:"搜索",settings:"设置",about:"关于",other:"其他"};return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:de[X]||X}),s.jsxs("span",{className:"text-xs text-gray-500",children:[se," 次"]})]}),s.jsx("div",{className:"space-y-2",children:G.sort((ce,ye)=>ye.count-ce.count).slice(0,8).map((ce,ye)=>{const ze={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",rule_trigger:"规则触发",view_chapter:"浏览章节",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元"},Oe={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节"},ct=ze[ce.target]||ce.target||Oe[ce.action]||ce.action;return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:`${ce.action}: ${ce.target}`,children:ct}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${se>0?ce.count/se*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:ce.count})]})]},ye)})})]},X)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Dg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),s.jsx(l0,{open:D,onClose:()=>{_(!1),R(null)},userId:L,onUserUpdated:()=>F()})]})}const pr=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Et("w-full caption-bottom text-sm",t),...e})}));pr.displayName="Table";const mr=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Et("[&_tr]:border-b",t),...e}));mr.displayName="TableHeader";const gr=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Et("[&_tr:last-child]:border-0",t),...e}));gr.displayName="TableBody";const lt=b.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Et("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));lt.displayName="TableRow";const Ce=b.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Et("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Ce.displayName="TableHead";const ve=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Et("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ve.displayName="TableCell";function c0(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function ws({page:t,totalPages:e,total:n,pageSize:r,onPageChange:a,onPageSizeChange:i,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!i?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," 条"]}),i&&s.jsx("select",{value:r,onChange:c=>i(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:()=>a(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:()=>a(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:()=>a(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:()=>a(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 vP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,w]=b.useState(""),N=c0(v,300),[k,C]=b.useState("all"),[E,I]=b.useState(!0),[P,B]=b.useState(null),[L,R]=b.useState(null),[D,_]=b.useState(""),[te,K]=b.useState(!1);async function he(){I(!0),B(null);try{const F=k==="all"?"":k==="completed"?"completed":k,O=new URLSearchParams({page:String(f),pageSize:String(g),...F&&{status:F},...N&&{search:N}}),[W,ie]=await Promise.all([Le(`/api/admin/orders?${O}`),Le("/api/db/users?page=1&pageSize=500")]);W!=null&&W.success&&(e(W.orders||[]),i(W.total??0),c(W.totalRevenue??0),h(W.todayRevenue??0)),ie!=null&&ie.success&&ie.users&&r(ie.users)}catch(F){console.error("加载订单失败",F),B("加载订单失败,请检查网络后重试")}finally{I(!1)}}b.useEffect(()=>{m(1)},[N,k]),b.useEffect(()=>{he()},[f,g,N,k]);const ge=F=>{var O;return F.userNickname||((O=n.find(W=>W.id===F.userId))==null?void 0:O.nickname)||"匿名用户"},z=F=>{var O;return((O=n.find(W=>W.id===F))==null?void 0:O.phone)||"-"},V=F=>{const O=F.productType||F.type||"",W=F.description||"";if(W){if(O==="section"&&W.includes("章节")){if(W.includes("-")){const ie=W.split("-");if(ie.length>=3)return{name:`第${ie[1]}章 第${ie[2]}节`,type:"《一场Soul的创业实验》"}}return{name:W,type:"章节购买"}}return O==="fullbook"||W.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:O==="vip"||W.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:O==="match"||W.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:W,type:"其他"}}return O==="section"?{name:`章节 ${F.productId||F.sectionId||""}`,type:"单章"}:O==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:O==="vip"?{name:"VIP年度会员",type:"VIP"}:O==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:O||"其他"}},U=Math.ceil(a/g)||1;async function M(){var F;if(!(!(L!=null&&L.orderSn)&&!(L!=null&&L.id))){K(!0),B(null);try{const O=await Tt("/api/admin/orders/refund",{orderSn:L.orderSn||L.id,reason:D||void 0});O!=null&&O.success?(R(null),_(""),he()):B((O==null?void 0:O.error)||"退款失败")}catch(O){const W=O;B(((F=W==null?void 0:W.data)==null?void 0:F.error)||"退款失败,请检查网络后重试")}finally{K(!1)}}}function q(){if(t.length===0){oe.info("暂无数据可导出");return}const F=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],O=t.map(G=>{const se=V(G);return[G.orderSn||G.id||"",ge(G),z(G.userId),se.name,Number(G.amount||0).toFixed(2),G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付",G.status==="refunded"?"已退款":G.status==="paid"||G.status==="completed"?"已完成":G.status==="pending"||G.status==="created"?"待支付":"已失败",G.status==="refunded"&&G.refundReason?G.refundReason:"-",G.referrerEarnings?Number(G.referrerEarnings).toFixed(2):"-",G.createdAt?new Date(G.createdAt).toLocaleString("zh-CN"):""].join(",")}),W="\uFEFF"+[F.join(","),...O].join(` -`),ie=new Blob([W],{type:"text/csv;charset=utf-8"}),J=URL.createObjectURL(ie),X=document.createElement("a");X.href=J,X.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,X.click(),URL.revokeObjectURL(J)}return s.jsxs("div",{className:"p-8 w-full",children:[P&&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:P}),s.jsx("button",{type:"button",onClick:()=>B(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(re,{variant:"outline",onClick:he,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{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(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(le,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:F=>w(F.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Zw,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:F=>C(F.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(re,{variant:"outline",onClick:q,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(xM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:E?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{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(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"订单号"}),s.jsx(Ce,{className:"text-gray-400",children:"用户"}),s.jsx(Ce,{className:"text-gray-400",children:"商品"}),s.jsx(Ce,{className:"text-gray-400",children:"金额"}),s.jsx(Ce,{className:"text-gray-400",children:"支付方式"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-gray-400",children:"退款原因"}),s.jsx(Ce,{className:"text-gray-400",children:"分销佣金"}),s.jsx(Ce,{className:"text-gray-400",children:"下单时间"}),s.jsx(Ce,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(F=>{const O=V(F);return s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(ve,{className:"font-mono text-xs text-gray-400",children:[(F.orderSn||F.id||"").slice(0,12),"..."]}),s.jsx(ve,{children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:ge(F)}),s.jsx("p",{className:"text-gray-500 text-xs",children:z(F.userId)})]})}),s.jsx(ve,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[O.name,(F.productType||F.type)==="vip"&&s.jsx(Ke,{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:O.type})]})}),s.jsxs(ve,{className:"text-[#38bdac] font-bold",children:["¥",Number(F.amount||0).toFixed(2)]}),s.jsx(ve,{className:"text-gray-300",children:F.paymentMethod==="wechat"?"微信支付":F.paymentMethod==="alipay"?"支付宝":F.paymentMethod||"微信支付"}),s.jsx(ve,{children:F.status==="refunded"?s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):F.status==="paid"||F.status==="completed"?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):F.status==="pending"||F.status==="created"?s.jsx(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ke,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),s.jsx(ve,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:F.refundReason,children:F.status==="refunded"&&F.refundReason?F.refundReason:"-"}),s.jsx(ve,{className:"text-[#FFD700]",children:F.referrerEarnings?`¥${Number(F.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(ve,{className:"text-gray-400 text-sm",children:new Date(F.createdAt).toLocaleString("zh-CN")}),s.jsx(ve,{children:(F.status==="paid"||F.status==="completed")&&s.jsxs(re,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{R(F),_("")},children:[s.jsx(rj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},F.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(ws,{page:f,totalPages:U,total:a,pageSize:g,onPageChange:m,onPageSizeChange:F=>{y(F),m(1)}})]})})}),s.jsx(Bt,{open:!!L,onOpenChange:F=>!F&&R(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"订单退款"})}),L&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",L.orderSn||L.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(L.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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:D,onChange:F=>_(F.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>R(null),disabled:te,children:"取消"}),s.jsx(re,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:M,disabled:te,children:te?"退款中...":"确认退款"})]})]})})]})}const Yl=b.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Et("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}));Yl.displayName="Textarea";const Oc=[{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 NP(){var Fa,ta,Rs,Ps,Os,Ds;const[t,e]=qw(),n=t.get("pool"),[r,a]=b.useState([]),[i,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=c0(m,300),v=n==="vip"?"vip":n==="complete"?"complete":"all",[w,N]=b.useState(v),[k,C]=b.useState(!0),[E,I]=b.useState(!1),[P,B]=b.useState(null),[L,R]=b.useState(!1),[D,_]=b.useState("desc");b.useEffect(()=>{n==="vip"?N("vip"):n==="complete"?N("complete"):n==="all"&&N("all")},[n]);const[te,K]=b.useState(!1),[he,ge]=b.useState(null),[z,V]=b.useState(!1),[U,M]=b.useState(!1),[q,F]=b.useState({referrals:[],stats:{}}),[O,W]=b.useState(!1),[ie,J]=b.useState(null),[X,G]=b.useState(!1),[se,de]=b.useState(null),[ce,ye]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[ze,Oe]=b.useState([]),[ct,Lt]=b.useState(!1),[jn,it]=b.useState(!1),[Mt,ne]=b.useState(null),[Pe,et]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[xt,pt]=b.useState([]),[mt,wt]=b.useState(!1),[Qt,_t]=b.useState(null),[Mn,At]=b.useState(null),[Kn,ns]=b.useState({}),[or,xe]=b.useState(!1),[we,qn]=b.useState(null),[Es,Ts]=b.useState([]),[Pa,br]=b.useState(!1),[Vi,vr]=b.useState(!1);async function lr($=!1){var Te;C(!0),$&&I(!0),B(null);try{if(L){const Ge=new URLSearchParams({search:y,limit:String(h*5)}),dt=await Le(`/api/db/users/rfm?${Ge}`);if(dt!=null&&dt.success){let xn=dt.users||[];D==="asc"&&(xn=[...xn].reverse());const kn=(c-1)*h;a(xn.slice(kn,kn+h)),o(((Te=dt.users)==null?void 0:Te.length)??0),xn.length===0&&(R(!1),B("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else R(!1),B((dt==null?void 0:dt.error)||"RFM 加载失败,已切回普通模式")}else{const Ge=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...w==="vip"&&{vip:"true"},...w==="complete"&&{pool:"complete"}}),dt=await Le(`/api/db/users?${Ge}`);dt!=null&&dt.success?(a(dt.users||[]),o(dt.total??0)):B((dt==null?void 0:dt.error)||"加载失败")}}catch(Ge){console.error("Load users error:",Ge),B("网络错误")}finally{C(!1),$&&I(!1)}}b.useEffect(()=>{u(1)},[y,w,L]),b.useEffect(()=>{lr()},[c,h,y,w,L,D]);const Ms=Math.ceil(i/h)||1,Oa=()=>{L?D==="desc"?_("asc"):(R(!1),_("desc")):(R(!0),_("desc"))},Hi=$=>({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"})[$||""]||"bg-gray-500/20 text-gray-400";async function Qs($){if(confirm("确定要删除这个用户吗?"))try{const Te=await Na(`/api/db/users?id=${encodeURIComponent($)}`);Te!=null&&Te.success?lr():oe.error("删除失败: "+((Te==null?void 0:Te.error)||""))}catch{oe.error("删除失败")}}const Nt=$=>{ge($),ye({phone:$.phone||"",nickname:$.nickname||"",password:"",isAdmin:!!($.isAdmin??!1),hasFullBook:!!($.hasFullBook??!1)}),K(!0)},Gn=()=>{ge(null),ye({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),K(!0)};async function Da(){if(!ce.phone||!ce.nickname){oe.error("请填写手机号和昵称");return}V(!0);try{if(he){const $=await Tt("/api/db/users",{id:he.id,nickname:ce.nickname,isAdmin:ce.isAdmin,hasFullBook:ce.hasFullBook,...ce.password&&{password:ce.password}});if(!($!=null&&$.success)){oe.error("更新失败: "+(($==null?void 0:$.error)||""));return}}else{const $=await vt("/api/db/users",{phone:ce.phone,nickname:ce.nickname,password:ce.password,isAdmin:ce.isAdmin});if(!($!=null&&$.success)){oe.error("创建失败: "+(($==null?void 0:$.error)||""));return}}K(!1),lr()}catch{oe.error("保存失败")}finally{V(!1)}}async function As($){J($),M(!0),W(!0);try{const Te=await Le(`/api/db/users/referrals?userId=${encodeURIComponent($.id)}`);Te!=null&&Te.success?F({referrals:Te.referrals||[],stats:Te.stats||{}}):F({referrals:[],stats:{}})}catch{F({referrals:[],stats:{}})}finally{W(!1)}}const Nr=b.useCallback(async()=>{Lt(!0);try{const $=await Le("/api/db/user-rules");$!=null&&$.success&&Oe($.rules||[])}catch{}finally{Lt(!1)}},[]);async function Wi(){if(!Pe.title){oe.error("请填写规则标题");return}V(!0);try{if(Mt){const $=await Tt("/api/db/user-rules",{id:Mt.id,...Pe});if(!($!=null&&$.success)){oe.error("更新失败: "+(($==null?void 0:$.error)||"未知错误"));return}oe.success("规则已更新")}else{const $=await vt("/api/db/user-rules",Pe);if(!($!=null&&$.success)){oe.error("创建失败: "+(($==null?void 0:$.error)||"未知错误"));return}oe.success("规则已创建")}it(!1),Nr()}catch($){const Te=$;(Te==null?void 0:Te.status)===401?oe.error("登录已过期,请重新登录"):(Te==null?void 0:Te.status)===404?oe.error("接口不存在,请确认后端已部署最新版本"):oe.error("保存失败: "+((Te==null?void 0:Te.message)||"网络错误"))}finally{V(!1)}}async function Xs($){if(confirm("确定删除?"))try{const Te=await Na(`/api/db/user-rules?id=${$}`);Te!=null&&Te.success&&Nr()}catch{}}async function nc($){try{await Tt("/api/db/user-rules",{id:$.id,enabled:!$.enabled}),Nr()}catch{}}const Jn=b.useCallback(async()=>{wt(!0);try{const $=await Le("/api/db/vip-members?limit=500");if($!=null&&$.success&&$.data){const Te=[...$.data].map((Ge,dt)=>({...Ge,vipSort:typeof Ge.vipSort=="number"?Ge.vipSort:dt+1}));Te.sort((Ge,dt)=>(Ge.vipSort??999999)-(dt.vipSort??999999)),pt(Te)}else $&&$.error&&oe.error($.error)}catch{oe.error("加载超级个体列表失败")}finally{wt(!1)}},[]),[Zs,rs]=b.useState(!1),[Ar,La]=b.useState(null),[ea,Ui]=b.useState(""),[cr,Ki]=b.useState(!1),ss=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],rc=$=>{La($),Ui($.vipRole||""),rs(!0)},Vo=async $=>{const Te=$.trim();if(Ar){if(!Te){oe.error("请选择或输入标签");return}Ki(!0);try{const Ge=await Tt("/api/db/users",{id:Ar.id,vipRole:Te});if(!(Ge!=null&&Ge.success)){oe.error((Ge==null?void 0:Ge.error)||"更新超级个体标签失败");return}oe.success("已更新超级个体标签"),rs(!1),La(null),await Jn()}catch{oe.error("更新超级个体标签失败")}finally{Ki(!1)}}},[qi,un]=b.useState(!1),[as,Is]=b.useState(null),[_a,It]=b.useState(""),[zn,Vr]=b.useState(!1),Ho=$=>{Is($),It($.vipSort!=null?String($.vipSort):""),un(!0)},za=async()=>{if(!as)return;const $=Number(_a);if(!Number.isFinite($)){oe.error("请输入有效的数字序号");return}Vr(!0);try{const Te=await Tt("/api/db/users",{id:as.id,vipSort:$});if(!(Te!=null&&Te.success)){oe.error((Te==null?void 0:Te.error)||"更新排序序号失败");return}oe.success("已更新排序序号"),un(!1),Is(null),await Jn()}catch{oe.error("更新排序序号失败")}finally{Vr(!1)}},sc=($,Te)=>{$.dataTransfer.effectAllowed="move",$.dataTransfer.setData("text/plain",Te),_t(Te)},Gi=($,Te)=>{$.preventDefault(),Mn!==Te&&At(Te)},$a=()=>{_t(null),At(null)},dr=async($,Te)=>{$.preventDefault();const Ge=$.dataTransfer.getData("text/plain")||Qt;if(_t(null),At(null),!Ge||Ge===Te)return;const dt=xt.find(Xt=>Xt.id===Ge),xn=xt.find(Xt=>Xt.id===Te);if(!dt||!xn)return;const kn=dt.vipSort??xt.findIndex(Xt=>Xt.id===Ge)+1,Uo=xn.vipSort??xt.findIndex(Xt=>Xt.id===Te)+1;pt(Xt=>{const st=[...Xt],Ba=st.findIndex(na=>na.id===Ge),Va=st.findIndex(na=>na.id===Te);if(Ba===-1||Va===-1)return Xt;const ls=[...st],[Ko,qo]=[ls[Ba],ls[Va]];return ls[Ba]={...qo,vipSort:kn},ls[Va]={...Ko,vipSort:Uo},ls});try{const[Xt,st]=await Promise.all([Tt("/api/db/users",{id:Ge,vipSort:Uo}),Tt("/api/db/users",{id:Te,vipSort:kn})]);if(!(Xt!=null&&Xt.success)||!(st!=null&&st.success)){oe.error((Xt==null?void 0:Xt.error)||(st==null?void 0:st.error)||"更新排序失败"),await Jn();return}oe.success("已更新排序"),await Jn()}catch{oe.error("更新排序失败"),await Jn()}},is=b.useCallback(async()=>{xe(!0);try{const $=await Le("/api/db/users/journey-stats");$!=null&&$.success&&$.stats&&ns($.stats)}catch{}finally{xe(!1)}},[]);async function $n($){qn($),br(!0);try{const Te=await Le(`/api/db/users/journey-users?stage=${encodeURIComponent($)}&limit=20`);Te!=null&&Te.success&&Te.users?Ts(Te.users):Ts([])}catch{Ts([])}finally{br(!1)}}async function Wo($){if(!$.hasFullBook){oe.error("仅 VIP 用户可置顶到超级个体");return}if(confirm("确定将该用户置顶到首页超级个体位?(最多4位)"))try{const Te=await Tt("/api/db/users",{id:$.id,vipSort:1});if(!(Te!=null&&Te.success)){oe.error((Te==null?void 0:Te.error)||"置顶失败");return}oe.success("已置顶到超级个体"),lr()}catch{oe.error("置顶失败")}}return s.jsxs("div",{className:"p-8 w-full",children:[P&&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:P}),s.jsx("button",{type:"button",onClick:()=>B(null),children:"×"})]}),s.jsx("div",{className:"flex justify-between items-center mb-6",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>vr(!0),className:"text-gray-500 hover:text-[#38bdac] h-8 w-8 p-0",title:"RFM 算法说明",children:s.jsx($c,{className:"w-4 h-4"})})]}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",i," 位注册用户",L&&" · RFM 排序中"]})]})}),s.jsxs(Td,{defaultValue:"users",className:"w-full",children:[s.jsxs(Jl,{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(Dn,{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:is,children:[s.jsx(El,{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:Nr,children:[s.jsx(vo,{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:Jn,children:[s.jsx(Ml,{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(re,{variant:"outline",onClick:()=>lr(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:w,onChange:$=>{const Te=$.target.value;N(Te),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:L,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(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(le,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:$=>g($.target.value)})]}),s.jsxs(re,{onClick:Gn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Hg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{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(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"用户信息"}),s.jsx(Ce,{className:"text-gray-400",children:"绑定信息"}),s.jsx(Ce,{className:"text-gray-400",children:"购买状态"}),s.jsx(Ce,{className:"text-gray-400",children:"分销收益"}),s.jsx(Ce,{className:"text-gray-400",children:"余额/提现"}),s.jsxs(Ce,{className:"text-gray-400 cursor-pointer select-none",onClick:Oa,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Dl,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),L?D==="desc"?s.jsx(ld,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Jw,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Rm,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),L&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(Ce,{className:"text-gray-400",children:"注册时间"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[r.map($=>{var Te,Ge,dt;return s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ve,{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:$.avatar?s.jsx("img",{src:ts($.avatar),className:"w-full h-full rounded-full object-cover",alt:""}):((Te=$.nickname)==null?void 0:Te.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{de($.id),G(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:$.nickname}),$.isAdmin&&s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),$.openId&&!((Ge=$.id)!=null&&Ge.startsWith("user_"))&&s.jsx(Ke,{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:$.openId?$.openId.slice(0,12)+"...":(dt=$.id)==null?void 0:dt.slice(0,12)})]})]})}),s.jsx(ve,{children:s.jsxs("div",{className:"space-y-1",children:[$.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:$.phone})]}),$.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:$.wechatId})]}),$.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:$.openId,children:[$.openId.slice(0,12),"..."]})]}),!$.phone&&!$.wechatId&&!$.openId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(ve,{children:$.hasFullBook?s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),s.jsx(ve,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String($.earnings||0)).toFixed(2)]}),parseFloat(String($.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String($.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>As($),role:"button",tabIndex:0,onKeyDown:xn=>xn.key==="Enter"&&As($),children:[s.jsx(Dn,{className:"w-3 h-3"})," 绑定",$.referralCount||0,"人"]})]})}),s.jsx(ve,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String($.walletBalance||0)).toFixed(2)]}),parseFloat(String($.withdrawnEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-gray-400",children:["已提现: ¥",parseFloat(String($.withdrawnEarnings||0)).toFixed(2)]})]})}),s.jsx(ve,{children:$.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:$.rfmScore}),s.jsx(Ke,{className:`border-0 text-xs ${Hi($.rfmLevel)}`,children:$.rfmLevel})]})}):s.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",s.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),s.jsx(ve,{className:"text-gray-400",children:$.createdAt?new Date($.createdAt).toLocaleDateString():"-"}),s.jsx(ve,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>{de($.id),G(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(zg,{className:"w-4 h-4"})}),$.hasFullBook&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Wo($),className:"text-gray-400 hover:text-orange-400 hover:bg-orange-400/10",title:"置顶超级个体",children:s.jsx(xi,{className:"w-4 h-4"})}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Nt($),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Qs($.id),title:"删除",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},$.id)}),r.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(ws,{page:c,totalPages:Ms,total:i,pageSize:h,onPageChange:u,onPageSizeChange:$=>{f($),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(re,{variant:"outline",onClick:is,disabled:or,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${or?"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:Oc.map(($,Te)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{role:"button",tabIndex:0,className:`relative w-full p-3 rounded-xl border ${$.color} text-center cursor-pointer`,onClick:()=>$n($.id),onKeyDown:Ge=>Ge.key==="Enter"&&$n($.id),children:[s.jsx("div",{className:"text-2xl mb-1",children:$.icon}),s.jsx("div",{className:`text-xs font-medium ${$.color.split(" ").find(Ge=>Ge.startsWith("text-"))}`,children:$.label}),Kn[$.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[$.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:Te+1})]}),Te$.id===we))==null?void 0:Fa.label," — 用户列表"]}),s.jsxs(re,{variant:"ghost",size:"sm",onClick:()=>qn(null),className:"text-gray-500 hover:text-white",children:[s.jsx(nr,{className:"w-4 h-4"})," 关闭"]})]}),Pa?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Es.length>0?s.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:Es.map($=>s.jsxs("div",{className:"flex items-center justify-between py-2 px-3 bg-[#0a1628] rounded-lg hover:bg-[#0a1628]/80 cursor-pointer",onClick:()=>{de($.id),G(!0)},onKeyDown:Te=>Te.key==="Enter"&&(de($.id),G(!0)),role:"button",tabIndex:0,children:[s.jsx("span",{className:"text-white font-medium",children:$.nickname}),s.jsx("span",{className:"text-gray-400 text-sm",children:$.phone||"—"}),s.jsx("span",{className:"text-gray-500 text-xs",children:$.createdAt?new Date($.createdAt).toLocaleDateString():"—"})]},$.id))}):s.jsx("p",{className:"text-gray-500 text-sm py-4",children:"暂无用户"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[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(El,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"旅程关键节点"})]}),s.jsx("div",{className:"space-y-2 text-sm",children:[{step:"① 注册",action:"微信 OAuth 或手机号注册",next:"引导填写头像"},{step:"② 浏览",action:"点击章节/阅读免费内容",next:"触发绑定手机"},{step:"③ 首付",action:"购买单章或全书",next:"推送分销功能"},{step:"④ VIP",action:"¥1980 购买全书",next:"进入 VIP 私域群"},{step:"⑤ 分销",action:"推广好友购买",next:"提现分销收益"}].map($=>s.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:$.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:$.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",$.next]})]})]},$.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($r,{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:"实时更新"})]}),or?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Kn).length>0?s.jsx("div",{className:"space-y-2",children:Oc.map($=>{const Te=Kn[$.id]||0,Ge=Math.max(...Oc.map(xn=>Kn[xn.id]||0),1),dt=Math.round(Te/Ge*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:[$.icon," ",$.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:`${dt}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Te})]},$.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(re,{variant:"outline",onClick:Nr,disabled:ct,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${ct?"animate-spin":""}`})," 刷新"]}),s.jsxs(re,{onClick:()=>{ne(null),et({title:"",description:"",trigger:"",sort:0,enabled:!0}),it(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),ct?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):ze.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx($r,{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(re,{onClick:Nr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:ze.map($=>s.jsx("div",{className:`p-4 rounded-lg border transition-all ${$.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:$.title}),$.trigger&&s.jsxs(Ke,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",$.trigger]}),s.jsx(Ke,{className:`text-xs border-0 ${$.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:$.enabled?"启用":"禁用"})]}),$.description&&s.jsx("p",{className:"text-gray-400 text-sm ml-6",children:$.description})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[s.jsx(kt,{checked:$.enabled,onCheckedChange:()=>nc($)}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>{ne($),et({title:$.title,description:$.description,trigger:$.trigger,sort:$.sort,enabled:$.enabled}),it(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Xs($.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})]})},$.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(re,{variant:"outline",onClick:Jn,disabled:mt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${mt?"animate-spin":""}`})," ","刷新"]})})]}),mt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{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(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(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400 w-16",children:"序号"}),s.jsx(Ce,{className:"text-gray-400",children:"成员"}),s.jsx(Ce,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),s.jsx(Ce,{className:"text-gray-400 w-24",children:"排序值"}),s.jsx(Ce,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),s.jsx(gr,{children:xt.map(($,Te)=>{var xn;const Ge=Qt===$.id,dt=Mn===$.id;return s.jsxs(lt,{draggable:!0,onDragStart:kn=>sc(kn,$.id),onDragOver:kn=>Gi(kn,$.id),onDrop:kn=>dr(kn,$.id),onDragEnd:$a,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Ge?"opacity-60":""} ${dt?"bg-[#38bdac]/10":""}`,children:[s.jsx(ve,{className:"text-gray-300",children:Te+1}),s.jsx(ve,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[$.avatar?s.jsx("img",{src:ts($.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:((xn=$.name)==null?void 0:xn[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:$.name})})]})}),s.jsx(ve,{className:"text-gray-300 whitespace-nowrap",children:$.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(ve,{className:"text-gray-300",children:$.vipSort??Te+1}),s.jsx(ve,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>rc($),title:"设置超级个体标签",children:s.jsx(Gc,{className:"w-3.5 h-3.5"})}),s.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{de($.id),G(!0)},title:"编辑资料",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Ho($),title:"设置排序序号",children:s.jsx(Rm,{className:"w-3.5 h-3.5"})})]})})]},$.id)})})]})})})]})]}),s.jsx(Bt,{open:qi,onOpenChange:$=>{un($),$||Is(null)},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Rm,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",as==null?void 0:as.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:_a,onChange:$=>It($.target.value)})]}),s.jsxs(ln,{children:[s.jsxs(re,{variant:"outline",onClick:()=>un(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(re,{onClick:za,disabled:zn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),zn?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:Zs,onOpenChange:$=>{rs($),$||La(null)},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ml,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Ar==null?void 0:Ar.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:ss.map($=>s.jsx(re,{variant:ea===$?"default":"outline",size:"sm",className:ea===$?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ui($),children:$},$))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:ea,onChange:$=>Ui($.target.value)})]})]}),s.jsxs(ln,{children:[s.jsxs(re,{variant:"outline",onClick:()=>rs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(re,{onClick:()=>Vo(ea),disabled:cr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),cr?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:te,onOpenChange:K,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[he?s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Hg,{className:"w-5 h-5 text-[#38bdac]"}),he?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"手机号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ce.phone,onChange:$=>ye({...ce,phone:$.target.value}),disabled:!!he})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"昵称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ce.nickname,onChange:$=>ye({...ce,nickname:$.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:he?"新密码 (留空则不修改)":"密码"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:he?"留空则不修改":"请输入密码",value:ce.password,onChange:$=>ye({...ce,password:$.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ee,{className:"text-gray-300",children:"管理员权限"}),s.jsx(kt,{checked:ce.isAdmin,onCheckedChange:$=>ye({...ce,isAdmin:$})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ee,{className:"text-gray-300",children:"已购全书"}),s.jsx(kt,{checked:ce.hasFullBook,onCheckedChange:$=>ye({...ce,hasFullBook:$})})]})]}),s.jsxs(ln,{children:[s.jsxs(re,{variant:"outline",onClick:()=>K(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(re,{onClick:Da,disabled:z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),z?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:jn,onOpenChange:it,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),Mt?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Pe.title,onChange:$=>et({...Pe,title:$.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"规则描述"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Pe.description,onChange:$=>et({...Pe,description:$.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"触发条件"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Pe.trigger,onChange:$=>et({...Pe,trigger:$.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(ee,{className:"text-gray-300",children:"启用状态"})}),s.jsx(kt,{checked:Pe.enabled,onCheckedChange:$=>et({...Pe,enabled:$})})]})]}),s.jsxs(ln,{children:[s.jsxs(re,{variant:"outline",onClick:()=>it(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(re,{onClick:Wi,disabled:z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),z?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:U,onOpenChange:M,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",ie==null?void 0:ie.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:((ta=q.stats)==null?void 0:ta.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:((Rs=q.stats)==null?void 0:Rs.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:["¥",(((Ps=q.stats)==null?void 0:Ps.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:["¥",(((Os=q.stats)==null?void 0:Os.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),O?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Ds=q.referrals)==null?void 0:Ds.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(q.referrals??[]).map(($,Te)=>{var dt;const Ge=$;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:((dt=Ge.nickname)==null?void 0:dt.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Ge.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Ge.phone||(Ge.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Ge.status==="vip"&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ge.status==="paid"&&s.jsxs(Ke,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ge.purchasedSections,"章"]}),Ge.status==="free"&&s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Ge.createdAt?new Date(Ge.createdAt).toLocaleDateString():""})]})]},Ge.id||Te)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(ln,{children:s.jsx(re,{variant:"outline",onClick:()=>M(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(Bt,{open:Vi,onOpenChange:vr,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Dl,{className:"w-5 h-5 text-[#38bdac]"}),"RFM 算法说明"]})}),s.jsxs("div",{className:"space-y-3 py-4 text-sm text-gray-300",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"R(Recency)"}),":距最近购买天数,越近分越高,权重 40%"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"F(Frequency)"}),":购买频次,越多分越高,权重 30%"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"M(Monetary)"}),":消费金额,越高分越高,权重 30%"]}),s.jsx("p",{className:"text-gray-400",children:"综合分 = R×40% + F×30% + M×30%,归一化到 0-100"}),s.jsxs("p",{className:"text-gray-400",children:["等级:",s.jsx("span",{className:"text-amber-400",children:"S"}),"(≥85)、",s.jsx("span",{className:"text-green-400",children:"A"}),"(≥70)、",s.jsx("span",{className:"text-blue-400",children:"B"}),"(≥50)、",s.jsx("span",{className:"text-gray-400",children:"C"}),"(≥30)、",s.jsx("span",{className:"text-red-400",children:"D"}),"(<30)"]})]}),s.jsx(ln,{children:s.jsx(re,{variant:"outline",onClick:()=>vr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(l0,{open:X,onClose:()=>G(!1),userId:se,onUserUpdated:lr})]})}function Nh(t,[e,n]){return Math.min(n,Math.max(e,t))}var Sk=["PageUp","PageDown"],Ck=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ek={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ql="Slider",[Gg,wP,jP]=s0(Ql),[Tk]=Li(Ql,[jP]),[kP,Ef]=Tk(Ql),Mk=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:v,...w}=t,N=b.useRef(new Set),k=b.useRef(0),E=o==="horizontal"?SP:CP,[I=[],P]=Eo({prop:f,defaultProp:h,onChange:te=>{var he;(he=[...N.current][k.current])==null||he.focus(),m(te)}}),B=b.useRef(I);function L(te){const K=IP(I,te);_(te,K)}function R(te){_(te,k.current)}function D(){const te=B.current[k.current];I[k.current]!==te&&g(I)}function _(te,K,{commit:he}={commit:!1}){const ge=DP(i),z=LP(Math.round((te-r)/i)*i+r,ge),V=Nh(z,[r,a]);P((U=[])=>{const M=MP(U,V,K);if(OP(M,u*i)){k.current=M.indexOf(V);const q=String(M)!==String(U);return q&&he&&g(M),q?M:U}else return U})}return s.jsx(kP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:N.current,values:I,orientation:o,form:v,children:s.jsx(Gg.Provider,{scope:t.__scopeSlider,children:s.jsx(Gg.Slot,{scope:t.__scopeSlider,children:s.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:at(w.onPointerDown,()=>{c||(B.current=I)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:L,onSlideMove:c?void 0:R,onSlideEnd:c?void 0:D,onHomeKeyDown:()=>!c&&_(r,0,{commit:!0}),onEndKeyDown:()=>!c&&_(a,I.length-1,{commit:!0}),onStepKeyDown:({event:te,direction:K})=>{if(!c){const z=Sk.includes(te.key)||te.shiftKey&&Ck.includes(te.key)?10:1,V=k.current,U=I[V],M=i*z*K;_(U+M,V,{commit:!0})}}})})})})});Mk.displayName=Ql;var[Ak,Ik]=Tk(Ql,{startEdge:"left",endEdge:"right",size:"width",direction:1}),SP=b.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=Ct(e,E=>g(E)),v=b.useRef(void 0),w=kf(a),N=w==="ltr",k=N&&!i||!N&&i;function C(E){const I=v.current||m.getBoundingClientRect(),P=[0,I.width],L=d0(P,k?[n,r]:[r,n]);return v.current=I,L(E-I.left)}return s.jsx(Ak,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(Rk,{dir:w,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const I=C(E.clientX);o==null||o(I)},onSlideMove:E=>{const I=C(E.clientX);c==null||c(I)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:E=>{const P=Ek[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:P?-1:1})}})})}),CP=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=Ct(e,f),g=b.useRef(void 0),y=!a;function v(w){const N=g.current||f.current.getBoundingClientRect(),k=[0,N.height],E=d0(k,y?[r,n]:[n,r]);return g.current=N,E(w-N.top)}return s.jsx(Ak,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(Rk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const N=v(w.clientY);i==null||i(N)},onSlideMove:w=>{const N=v(w.clientY);o==null||o(N)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const k=Ek[y?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:k?-1:1})}})})}),Rk=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=Ef(Ql,n);return s.jsx(ht.span,{...h,ref:e,onKeyDown:at(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):Sk.concat(Ck).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)&&a(m)}),onPointerUp:at(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),Pk="SliderTrack",Ok=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Ef(Pk,n);return s.jsx(ht.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});Ok.displayName=Pk;var Jg="SliderRange",Dk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Ef(Jg,n),i=Ik(Jg,n),o=b.useRef(null),c=Ct(e,o),u=a.values.length,h=a.values.map(g=>zk(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(ht.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});Dk.displayName=Jg;var Yg="SliderThumb",Lk=b.forwardRef((t,e)=>{const n=wP(t.__scopeSlider),[r,a]=b.useState(null),i=Ct(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(EP,{...t,ref:i,index:o})}),EP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=Ef(Yg,n),c=Ik(Yg,n),[u,h]=b.useState(null),f=Ct(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=o0(u),y=o.values[r],v=y===void 0?0:zk(y,o.min,o.max),w=AP(r,o.values.length),N=g==null?void 0:g[c.size],k=N?RP(N,v,c.direction):0;return b.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(${v}% + ${k}px)`},children:[s.jsx(Gg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(ht.span,{role:"slider","aria-label":t["aria-label"]||w,"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,...i,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:at(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(_k,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Lk.displayName=Yg;var TP="RadioBubbleInput",_k=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=Ct(a,r),o=i0(e);return b.useEffect(()=>{const c=a.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:i,defaultValue:e})});_k.displayName=TP;function MP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function zk(t,e,n){const i=100/(n-e)*(t-e);return Nh(i,[0,100])}function AP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function IP(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),r=Math.min(...n);return n.indexOf(r)}function RP(t,e,n){const r=t/2,i=d0([0,50],[0,r]);return(r-i(e)*n)*n}function PP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function OP(t,e){if(e>0){const n=PP(t);return Math.min(...n)>=e}return!0}function d0(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 DP(t){return(String(t).split(".")[1]||"").length}function LP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var _P=Mk,zP=Ok,$P=Dk,FP=Lk;function BP({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(_P,{defaultValue:e,value:n,min:r,max:a,className:Et("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(zP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx($P,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(FP,{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 VP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function $k(t){const[e,n]=b.useState(VP),[r,a]=b.useState(!0),[i,o]=b.useState(!1);b.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(()=>a(!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 vt("/api/admin/referral-settings",h);if(!f||f.success===!1){oe.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}oe.success(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),oe.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(Ll,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),s.jsxs(re,{onClick:c,disabled:i||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"flex items-center gap-2 text-white",children:[s.jsx(bA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Ot,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ie,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(le,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Dn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(BP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(le,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(le,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(le,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Dn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(le,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"flex items-center gap-2 text-white",children:[s.jsx(Ll,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Ot,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ie,{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(ee,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(le,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ke,{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(kt,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(Xe,{children:s.jsxs(Ze,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx($c,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ie,{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 HP(){var Mt;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[v,w]=b.useState(null),[N,k]=b.useState(""),[C,E]=b.useState("all"),[I,P]=b.useState(1),[B,L]=b.useState(10),[R,D]=b.useState(0),[_,te]=b.useState(new Set),[K,he]=b.useState(null),[ge,z]=b.useState(""),[V,U]=b.useState(!1),[M,q]=b.useState(null),[F,O]=b.useState(""),[W,ie]=b.useState(!1);b.useEffect(()=>{J()},[]),b.useEffect(()=>{P(1)},[t,C]),b.useEffect(()=>{X(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&X(t,!0)},[I,B,C,N]);async function J(){w(null);try{const ne=await Le("/api/admin/distribution/overview");ne!=null&&ne.success&&ne.overview&&i(ne.overview)}catch(ne){console.error("[Admin] 概览接口异常:",ne),w("加载概览失败")}try{const ne=await Le("/api/db/users");m((ne==null?void 0:ne.users)||[])}catch(ne){console.error("[Admin] 用户数据加载失败:",ne)}}async function X(ne,Pe=!1){var et;if(!(!Pe&&_.has(ne))){y(!0);try{const xt=f;switch(ne){case"overview":break;case"orders":{try{const pt=new URLSearchParams({page:String(I),pageSize:String(B),...C!=="all"&&{status:C},...N&&{search:N}}),mt=await Le(`/api/admin/orders?${pt}`);if(mt!=null&&mt.success&&mt.orders){const wt=mt.orders.map(Qt=>{const _t=xt.find(At=>At.id===Qt.userId),Mn=Qt.referrerId?xt.find(At=>At.id===Qt.referrerId):null;return{...Qt,amount:parseFloat(String(Qt.amount))||0,userNickname:(_t==null?void 0:_t.nickname)||Qt.userNickname||"未知用户",userPhone:(_t==null?void 0:_t.phone)||Qt.userPhone||"-",referrerNickname:(Mn==null?void 0:Mn.nickname)||null,referrerCode:(Mn==null?void 0:Mn.referralCode)??null,type:Qt.productType||Qt.type}});r(wt),D(mt.total??wt.length)}else r([]),D(0)}catch(pt){console.error(pt),w("加载订单失败"),r([])}break}case"bindings":{try{const pt=new URLSearchParams({page:String(I),pageSize:String(B),...C!=="all"&&{status:C}}),mt=await Le(`/api/db/distribution?${pt}`);c((mt==null?void 0:mt.bindings)||[]),D((mt==null?void 0:mt.total)??((et=mt==null?void 0:mt.bindings)==null?void 0:et.length)??0)}catch(pt){console.error(pt),w("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const pt=C==="completed"?"success":C==="rejected"?"failed":C,mt=new URLSearchParams({...pt&&pt!=="all"&&{status:pt},page:String(I),pageSize:String(B)}),wt=await Le(`/api/admin/withdrawals?${mt}`);if(wt!=null&&wt.success&&wt.withdrawals){const Qt=wt.withdrawals.map(_t=>({..._t,account:_t.account??"未绑定微信号",status:_t.status==="success"?"completed":_t.status==="failed"?"rejected":_t.status}));h(Qt),D((wt==null?void 0:wt.total)??Qt.length)}else wt!=null&&wt.success||w(`获取提现记录失败: ${(wt==null?void 0:wt.error)||"未知错误"}`),h([])}catch(pt){console.error(pt),w("加载提现数据失败"),h([])}break}}te(pt=>new Set(pt).add(ne))}catch(xt){console.error(xt)}finally{y(!1)}}}async function G(){w(null),te(ne=>{const Pe=new Set(ne);return Pe.delete(t),Pe}),t==="overview"&&J(),await X(t,!0)}async function se(ne){if(confirm("确认审核通过并打款?"))try{const Pe=await Tt("/api/admin/withdrawals",{id:ne,action:"approve"});if(!(Pe!=null&&Pe.success)){const et=(Pe==null?void 0:Pe.message)||(Pe==null?void 0:Pe.error)||"操作失败";oe.error(et);return}await G()}catch(Pe){console.error(Pe),oe.error("操作失败")}}function de(ne){q(ne),O("")}async function ce(){const ne=M;if(!ne)return;const Pe=F.trim();if(!Pe){oe.error("请填写拒绝原因");return}ie(!0);try{const et=await Tt("/api/admin/withdrawals",{id:ne,action:"reject",errorMessage:Pe});if(!(et!=null&&et.success)){oe.error((et==null?void 0:et.error)||"操作失败");return}oe.success("已拒绝该提现申请"),q(null),O(""),await G()}catch(et){console.error(et),oe.error("操作失败")}finally{ie(!1)}}function ye(){M&&oe.info("已取消操作"),q(null),O("")}async function ze(){var ne;if(!(!(K!=null&&K.orderSn)&&!(K!=null&&K.id))){U(!0),w(null);try{const Pe=await Tt("/api/admin/orders/refund",{orderSn:K.orderSn||K.id,reason:ge||void 0});Pe!=null&&Pe.success?(he(null),z(""),await X("orders",!0)):w((Pe==null?void 0:Pe.error)||"退款失败")}catch(Pe){const et=Pe;w(((ne=et==null?void 0:et.data)==null?void 0:ne.error)||"退款失败,请检查网络后重试")}finally{U(!1)}}}function Oe(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"},et={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ke,{className:`${Pe[ne]||"bg-gray-500/20 text-gray-400"} border-0`,children:et[ne]||ne})}const ct=Math.ceil(R/B)||1,Lt=n,jn=o.filter(ne=>{var et,xt,pt,mt;if(!N)return!0;const Pe=N.toLowerCase();return((et=ne.refereeNickname)==null?void 0:et.toLowerCase().includes(Pe))||((xt=ne.refereePhone)==null?void 0:xt.includes(Pe))||((pt=ne.referrerName)==null?void 0:pt.toLowerCase().includes(Pe))||((mt=ne.referrerCode)==null?void 0:mt.toLowerCase().includes(Pe))}),it=u.filter(ne=>{var et;if(!N)return!0;const Pe=N.toLowerCase();return((et=ne.userName)==null?void 0:et.toLowerCase().includes(Pe))||ne.account&&ne.account.toLowerCase().includes(Pe)});return s.jsxs("div",{className:"p-8 w-full",children:[v&&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:v}),s.jsx("button",{type:"button",onClick:()=>w(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(re,{onClick:G,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Ue,{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:Dl},{key:"orders",label:"订单管理",icon:gh},{key:"bindings",label:"绑定管理",icon:Ns},{key:"withdrawals",label:"提现审核",icon:Ll},{key:"settings",label:"推广设置",icon:vo}].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(Ue,{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"&&a&&s.jsxs("div",{className:"space-y-5",children:[s.jsx("div",{className:"grid grid-cols-6 gap-3",children:[{label:"今日点击",value:a.todayClicks,icon:zg,color:"blue"},{label:"独立用户",value:a.todayUniqueVisitors??0,icon:Dn,color:"cyan"},{label:"人均点击",value:(a.todayClickRate??0).toFixed(1),icon:Dl,color:"amber"},{label:"今日绑定",value:a.todayBindings,icon:Ns,color:"green"},{label:"今日转化",value:a.todayConversions,icon:Hv,color:"purple"},{label:"今日佣金",value:`¥${a.todayEarnings.toFixed(2)}`,icon:gh,color:"teal",isMoney:!0}].map(ne=>s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:ne.label}),s.jsx(ne.icon,{className:`w-4 h-4 text-${ne.color}-400 opacity-60`})]}),s.jsx("p",{className:`text-xl font-bold ${ne.isMoney?"text-[#38bdac]":"text-white"}`,children:ne.value})]})},ne.label))}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 col-span-2",children:s.jsxs(Ie,{className:"p-4",children:[s.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-1.5",children:[s.jsx(zg,{className:"w-4 h-4 text-[#38bdac]"})," 今日文章点击分布"]}),(((Mt=a.todayClicksByPage)==null?void 0:Mt.length)??0)>0?s.jsx("div",{className:"space-y-1.5 max-h-[200px] overflow-y-auto",children:[...a.todayClicksByPage??[]].sort((ne,Pe)=>Pe.clicks-ne.clicks).map((ne,Pe)=>s.jsxs("div",{className:"flex items-center justify-between text-xs py-1 border-b border-gray-700/30 last:border-0",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",children:ne.page||"(未区分)"}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("span",{className:"text-white font-medium",children:ne.clicks}),s.jsxs("span",{className:"text-gray-500 w-12 text-right",children:[a.todayClicks>0?(ne.clicks/a.todayClicks*100).toFixed(1):0,"%"]})]})]},Pe))}):s.jsx("p",{className:"text-gray-500 text-xs",children:"今日暂无点击数据"})]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ae,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ie,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(_g,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-orange-300 text-xs font-medium",children:"即将过期"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[a.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/50 text-[10px]",children:"7天内到期"})]})]})})}),s.jsx(Ae,{className:"bg-blue-500/10 border-blue-500/30 cursor-pointer",onClick:()=>e("withdrawals"),children:s.jsx(Ie,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ll,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-blue-300 text-xs font-medium",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[a.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/50 text-[10px]",children:["共 ¥",a.pendingWithdrawAmount.toFixed(2)," →"]})]})]})})})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{className:"p-4",children:[s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-gray-400 text-xs",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"点击量"}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.monthClicks}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.totalClicks.toLocaleString()})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"绑定数"}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.monthBindings}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.totalBindings.toLocaleString()})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"转化数"}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.monthConversions}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.totalConversions})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"佣金"}),s.jsxs("td",{className:"py-2.5 text-right font-medium text-[#38bdac]",children:["¥",a.monthEarnings.toFixed(2)]}),s.jsxs("td",{className:"py-2.5 text-right font-medium text-[#38bdac]",children:["¥",a.totalEarnings.toFixed(2)]})]}),s.jsxs("tr",{children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"转化率"}),s.jsx("td",{className:"py-2.5 text-right",children:"—"}),s.jsxs("td",{className:"py-2.5 text-right font-medium text-[#38bdac]",children:[a.conversionRate,"%"]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-6 mt-4 pt-3 border-t border-gray-700/30 text-xs",children:[s.jsxs("span",{className:"text-gray-400",children:["推广用户 ",s.jsx("span",{className:"text-white font-medium ml-1",children:a.totalDistributors})]}),s.jsxs("span",{className:"text-gray-400",children:["有收益 ",s.jsx("span",{className:"text-green-400 font-medium ml-1",children:a.activeDistributors})]}),s.jsxs("span",{className:"text-gray-400",children:["佣金比例 ",s.jsx("span",{className:"text-[#38bdac] font-medium ml-1",children:"90%"})]}),s.jsxs("span",{className:"text-gray-400",children:["绑定有效期 ",s.jsx("span",{className:"text-orange-400 font-medium ml-1",children:"30天"})]})]})]})})]}),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(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:N,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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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:Lt.map(ne=>{var Pe,et;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(Ke,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):ne.status==="completed"||ne.status==="paid"?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):ne.status==="pending"||ne.status==="created"?s.jsx(Ke,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ke,{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||((et=ne.referrerId)==null?void 0:et.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(re,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{he(ne),z("")},children:[s.jsx(rj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},ne.id)})})]})}),t==="orders"&&s.jsx(ws,{page:I,totalPages:ct,total:R,pageSize:B,onPageChange:P,onPageSizeChange:ne=>{L(ne),P(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(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:N,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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{className:"p-0",children:[jn.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:jn.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:Oe(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(ws,{page:I,totalPages:ct,total:R,pageSize:B,onPageChange:P,onPageSizeChange:ne=>{L(ne),P(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(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:N,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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{className:"p-0",children:[it.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:it.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:ts(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(Ke,{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:Oe(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(re,{size:"sm",onClick:()=>se(ne.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Hv,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(re,{size:"sm",variant:"outline",onClick:()=>de(ne.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Qw,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},ne.id))})]})}),t==="withdrawals"&&s.jsx(ws,{page:I,totalPages:ct,total:R,pageSize:B,onPageChange:P,onPageSizeChange:ne=>{L(ne),P(1)}})]})})]})]}),s.jsx(Bt,{open:!!K,onOpenChange:ne=>!ne&&he(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"订单退款"})}),K&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",K.orderSn||K.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof K.amount=="number"?K.amount.toFixed(2):parseFloat(String(K.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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:ge,onChange:ne=>z(ne.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>he(null),disabled:V,children:"取消"}),s.jsx(re,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ze,disabled:V,children:V?"退款中...":"确认退款"})]})]})}),s.jsx(Bt,{open:!!M,onOpenChange:ne=>!ne&&ye(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:F,onChange:ne=>O(ne.target.value)})})]})]}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:ye,disabled:W,children:"取消"}),s.jsx(re,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ce,disabled:W||!F.trim(),children:W?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx($k,{embedded:!0})})]})}function WP(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,w]=b.useState(0),[N,k]=b.useState(null),[C,E]=b.useState(null),[I,P]=b.useState(""),[B,L]=b.useState(!1);async function R(){var z,V,U,M,q,F,O;i(!0),c(null);try{const W=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),ie=await Le(`/api/admin/withdrawals?${W}`);if(ie!=null&&ie.success){const J=ie.withdrawals||[];e(J),w(ie.total??((z=ie.stats)==null?void 0:z.total)??J.length),r({total:((V=ie.stats)==null?void 0:V.total)??ie.total??J.length,pendingCount:((U=ie.stats)==null?void 0:U.pendingCount)??0,pendingAmount:((M=ie.stats)==null?void 0:M.pendingAmount)??0,successCount:((q=ie.stats)==null?void 0:q.successCount)??0,successAmount:((F=ie.stats)==null?void 0:F.successAmount)??0,failedCount:((O=ie.stats)==null?void 0:O.failedCount)??0})}else c("加载提现记录失败")}catch(W){console.error("Load withdrawals error:",W),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{R()},[u,f,g]);const D=Math.ceil(v/g)||1;async function _(z){const V=t.find(U=>U.id===z);if(V!=null&&V.userCommissionInfo&&V.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${V.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(z);try{const U=await Tt("/api/admin/withdrawals",{id:z,action:"approve"});U!=null&&U.success?R():oe.error("操作失败: "+((U==null?void 0:U.error)??""))}catch{oe.error("操作失败")}finally{k(null)}}function te(z){E(z),P("")}async function K(){const z=C;if(!z)return;const V=I.trim();if(!V){oe.error("请填写拒绝原因");return}L(!0);try{const U=await Tt("/api/admin/withdrawals",{id:z,action:"reject",errorMessage:V});U!=null&&U.success?(oe.success("已拒绝该提现申请"),E(null),P(""),R()):oe.error("操作失败: "+((U==null?void 0:U.error)??""))}catch{oe.error("操作失败")}finally{L(!1)}}function he(){C&&oe.info("已取消操作"),E(null),P("")}function ge(z){switch(z){case"pending":return s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ke,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ke,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0",children:z})}}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(re,{variant:"outline",onClick:R,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Ae,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ie,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(gh,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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(z=>s.jsx(re,{variant:u===z?"default":"outline",size:"sm",onClick:()=>h(z),className:u===z?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:z==="all"?"全部":z==="pending"?"待处理":z==="success"?"已完成":"已拒绝"},z))}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{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(Ll,{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(z=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(z.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[z.userAvatar?s.jsx("img",{src:ts(z.userAvatar),alt:z.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:(z.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:z.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:z.userPhone??z.referralCode??(z.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(z.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:z.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:["¥",z.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:["¥",z.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:["¥",z.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:z.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",z.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[ge(z.status),z.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:z.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:z.processedAt?new Date(z.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:z.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:z.userConfirmedAt,children:["已确认 ",new Date(z.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(z.status==="pending"||z.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(re,{size:"sm",onClick:()=>_(z.id),disabled:N===z.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(vf,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(re,{size:"sm",variant:"outline",onClick:()=>te(z.id),disabled:N===z.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(z.status==="success"||z.status==="completed")&&z.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:z.transactionId})]})]},z.id))})]})}),s.jsx(ws,{page:f,totalPages:D,total:v,pageSize:g,onPageChange:m,onPageSizeChange:z=>{y(z),m(1)}})]})})}),s.jsx(Bt,{open:!!C,onOpenChange:z=>!z&&he(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:I,onChange:z=>P(z.target.value)})})]})]}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:he,disabled:B,children:"取消"}),s.jsx(re,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:K,disabled:B||!I.trim(),children:B?"提交中...":"确认拒绝"})]})]})})]})}var Km={exports:{}},qm={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var f1;function UP(){if(f1)return qm;f1=1;var t=jd();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,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),w=v[0].inst,N=v[1];return i(function(){w.value=y,w.getSnapshot=g,u(w)&&N({inst:w})},[m,y,g]),a(function(){return u(w)&&N({inst:w}),m(function(){u(w)&&N({inst:w})})},[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 qm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,qm}var p1;function Fk(){return p1||(p1=1,Km.exports=UP()),Km.exports}var Bk=Fk();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 Vk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let o=0;a.text[o]==i.text[o];o++)n++;return n}if(a.content.size||i.content.size){let o=Vk(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function Hk(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),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,a+c,i||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,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",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?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=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),a+=c.nodeSize),o=u}return new be(r,a)}cutByIndex(e,n){return e==n?be.empty:e==0&&n==this.content.length?this:new be(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new be(a,i)}addToStart(e){return new be([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new be(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 a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?Vu(n+1,i):Vu(n,r);r=i}}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 be.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new be(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return be.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};Dt.none=[];class jh extends Error{}class Re{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=Uk(this.content,e+this.openStart,n);return r&&new Re(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Re(Wk(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 Re.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Re(be.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new Re(e,r,a)}}Re.empty=new Re(be.empty,0,0);function Wk(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(a==e||i.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,i.copy(Wk(i.content,e-a-1,n-a-1)))}function Uk(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),o=t.maybeChild(a);if(i==e||o.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Uk(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function KP(t,e,n){if(n.openStart>t.depth)throw new jh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new jh("Inconsistent open depths");return Kk(t,e,n,0)}function Kk(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Jc(t,e,n,r){let a=(e||t).node(n),i=0,o=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(wo(t.nodeAfter,r),i++));for(let c=i;ca&&Xg(t,e,a+1),o=r.depth>a&&Xg(n,r,a+1),c=[];return Jc(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(qk(i,o),wo(jo(i,Gk(t,e,n,r,a+1)),c)):(i&&wo(jo(i,kh(t,e,a+1)),c),Jc(e,n,a,c),o&&wo(jo(o,kh(n,r,a+1)),c)),Jc(r,null,a,c),new be(c)}function kh(t,e,n){let r=[];if(Jc(null,t,n,r),t.depth>n){let a=Xg(t,e,n+1);wo(jo(a,kh(t,e,n+1)),r)}return Jc(e,null,n,r),new be(r)}function qP(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(be.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class dd{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],a=e.child(n);return r?e.child(n).cut(r):a}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],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;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 Sh(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=[],a=0,i=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(i),h=i-u;if(r.push(o,c,a+u),!h||(o=o.child(c),o.isText))break;i=h-1,a+=u+1}return new dd(n,r,i)}static resolveCached(e,n){let r=m1.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}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()+")"),Jk(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=be.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;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 a=be.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};Sa.prototype.text=void 0;class Ch extends Sa{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Jk(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 Ch(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ch(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 Jk(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 QP(e,n);if(r.next==null)return Mo.empty;let a=Yk(r);r.next&&r.err("Unexpected trailing text");let i=sO(rO(a));return aO(i,r),i}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 a=0;a{let i=a+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return i}).join(` -`)}}Mo.empty=new Mo(!0);class QP{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 Yk(t){let e=[];do e.push(XP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function XP(t){let e=[];do e.push(ZP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function ZP(t){let e=nO(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=eO(t,e);else break;return e}function g1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function eO(t,e){let n=g1(t),r=n;return t.eat(",")&&(t.next!="}"?r=g1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function tO(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let i in n){let o=n[i];o.isInGroup(e)&&a.push(o)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function nO(t){if(t.eat("(")){let e=Yk(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=tO(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 rO(t){let e=[[]];return a(i(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 a(o,c){o.forEach(u=>u.to=c)}function i(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(i(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=i(o.exprs[u],c);if(u==o.exprs.length-1)return h;a(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),a(i(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return a(i(o.expr,c),u),a(i(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(i(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||a.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let i=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:Zk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Sa(this,this.computeAttrs(e),be.from(n),Dt.setFrom(r))}createChecked(e=null,n,r){return n=be.from(n),this.checkContent(n),new Sa(this,this.computeAttrs(e),n,Dt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=be.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(be.empty,!0);return i?new Sa(this,e,n.append(i),Dt.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[i]=new nS(i,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function iO(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class oO{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?iO(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Tf{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=tS(e,a.attrs),this.excluded=null;let i=Xk(this.attrs);this.instance=i?new Dt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Dt(this,Zk(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new Tf(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class rS{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=Vn.from(e.nodes),n.marks=Vn.from(e.marks||{}),this.nodes=y1.compile(this.spec.nodes,this),this.marks=Tf.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let i=this.nodes[a],o=i.spec.content||"",c=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Mo.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=c=="_"?null:c?b1(this,c.split(" ")):c==""||!i.inlineContent?[]:null}for(let a in this.marks){let i=this.marks[a],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:b1(this,o.split(" "))}this.nodeFromJSON=a=>Sa.fromJSON(this,a),this.markFromJSON=a=>Dt.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof y1){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,a)}text(e,n){let r=this.nodes.text;return new Ch(r,r.defaultAttrs,e,Dt.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 b1(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 lO(t){return t.tag!=null}function cO(t){return t.style!=null}class ki{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(lO(a))this.tags.push(a);else if(cO(a)){let i=/[^=]*/.exec(a.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let i=e.nodes[a.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new N1(this,n,!1);return r.addAll(e,Dt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new N1(this,n,!0);return r.addAll(e,Dt.none,n.from,n.to),Re.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;ae.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(a){let i=a.priority==null?50:a.priority,o=0;for(;o{r(o=w1(o)),o.mark||o.ignore||o.clearMark||(o.mark=a)})}for(let a in e.nodes){let i=e.nodes[a].spec.parseDOM;i&&i.forEach(o=>{r(o=w1(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ki(e,ki.schemaRules(e)))}}const sS={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},dO={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},aS={ol:!0,ul:!0},ud=1,ex=2,Yc=4;function v1(t,e,n){return e!=null?(e?ud:0)|(e==="full"?ex:0):t&&t.whitespace=="pre"?ud|ex:n&~Yc}class Hu{constructor(e,n,r,a,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=Dt.none,this.match=i||(o&Yc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(be.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ud)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=be.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(be.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&&!sS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class N1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,o=v1(null,n.preserveWhitespace,0)|(r?Yc:0);a?i=new Hu(a.type,a.attrs,Dt.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Hu(null,null,Dt.none,!0,null,o):i=new Hu(e.schema.topNodeType,null,Dt.none,!0,null,o),this.nodes=[i],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,a=this.top,i=a.options&ex?"full":this.localPreserveWS||(a.options&ud)>0,{schema:o}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="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,a){let i,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&&(i=!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(a)this.addElement(e,r,a);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)}i&&this.sync(c)&&this.open--}addAll(e,n,r,a){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=a==null?null:e.childNodes[a];o!=c;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let a,i;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!a||a.length>h.length+c)&&(a=h,i=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!a)return null;this.sync(i);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):j1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Hu(e,n,u,a,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|=ud)}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 a=r.length-1;a>=0;a--)e+=r[a].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,a=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(a?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>=i;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&a?this.nodes[u].type:r&&u>=i?r.node(u-i).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 uO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&aS.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function hO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function w1(t){let e={};for(let n in t)e[n]=t[n];return e}function j1(t,e){let n=e.schema.nodes;for(let r in n){let a=n[r];if(!a.allowsMarkType(t))continue;let i=[],o=c=>{i.push(c);for(let u=0;u{if(i.length||o.marks.length){let c=0,u=0;for(;c=0;a--){let i=this.serializeMark(e.marks[a],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let a=this.marks[e.type.name];return a&&oh(Jm(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return oh(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new $o(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=k1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return k1(e.marks)}}function k1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Jm(t){return t.document||window.document}const S1=new WeakMap;function fO(t){let e=S1.get(t);return e===void 0&&S1.set(t,e=pO(t)),e}function pO(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 a=0;a-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=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),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:v}=oh(t,g,n,r);if(u.appendChild(y),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const iS=65535,oS=Math.pow(2,16);function mO(t,e){return t+e*oS}function C1(t){return t&iS}function gO(t){return(t-(t&iS))/oS}const lS=1,cS=2,lh=4,dS=8;class tx{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&dS)>0}get deletedBefore(){return(this.delInfo&(lS|lh))>0}get deletedAfter(){return(this.delInfo&(cS|lh))>0}get deletedAcross(){return(this.delInfo&lh)>0}}class _r{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&_r.empty)return _r.empty}recover(e){let n=0,r=C1(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+a+(g<0?0:f);if(r)return y;let v=e==(n<0?u:m)?null:mO(c/3,e-u),w=e==u?cS:e==m?lS:lh;return(n<0?e!=u:e!=m)&&(w|=dS),new tx(y,w,v)}a+=f-h}return r?e+a:new tx(e+a,0,null)}touches(e,n){let r=0,a=C1(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+i],f=u+h;if(e<=f&&c==a*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 a=0,i=0;a=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?r-a-1:void 0)}}invert(){let e=new hd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return vn.fromReplace(e,this.from,this.to,i)}invert(){return new vs(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 bi(n.pos,r.pos,this.mark)}merge(e){return e instanceof bi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bi(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 bi(n.from,n.to,e.markFromJSON(n.mark))}}ir.jsonID("addMark",bi);class vs 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 Re(u0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return vn.fromReplace(e,this.from,this.to,r)}invert(){return new bi(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 vs(n.pos,r.pos,this.mark)}merge(e){return e instanceof vs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new vs(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 vs(n.from,n.to,e.markFromJSON(n.mark))}}ir.jsonID("removeMark",vs);class vi extends ir{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return vn.fromReplace(e,this.pos,this.pos+1,new Re(be.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 a=0;ar.pos?null:new Ln(n.pos,r.pos,a,i,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 Ln(n.from,n.to,n.gapFrom,n.gapTo,Re.fromJSON(e,n.slice),n.insert,!!n.structure)}}ir.jsonID("replaceAround",Ln);function nx(t,e,n){let r=t.resolve(e),a=n-e,i=r.depth;for(;a>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,a--;if(a>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;a>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,a--}}return!1}function xO(t,e,n,r){let a=[],i=[],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),v=r.addToSet(m);for(let w=0;wt.step(u)),i.forEach(u=>t.step(u))}function yO(t,e,n,r){let a=[],i=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;i++;let u=null;if(r instanceof Tf){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 vs(o.from,o.to,o.style)))}function h0(t,e,n,r=n.contentMatch,a=!0){let i=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function bO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Xl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;v--)w||r.index(v)>0?(w=!0,f=be.from(r.node(v).copy(f)),m++):u--;let g=be.empty,y=0;for(let v=i,w=!1;v>n;v--)w||a.after(v+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=be.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new Ln(a,i,a,i,new Re(r,0,0),n.length,!0))}function kO(t,e,n,r,a){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof a=="function"?a(o):a;if(o.isTextblock&&!o.hasMarkup(r,u)&&SO(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!v?h=!1:!y&&v&&(h=!0)}h===!1&&hS(t,o,c,i),h0(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new Ln(m,g,m+1,g-1,new Re(be.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&uS(t,o,c,i),!1}})}function uS(t,e,n,r){e.forEach((a,i)=>{if(a.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(a.text);){let u=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function hS(t,e,n,r){e.forEach((a,i)=>{if(a.type==a.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(` -`))}})}function SO(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function CO(t,e,n,r,a){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,a||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ln(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Re(be.from(o),0,0),1,!0))}function Ca(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),g=a.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),v=r&&r[f+1];v&&(y=y.replaceChild(0,v.type.create(v.attrs)));let w=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!w.type.validContent(y))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function EO(t,e,n=1,r){let a=t.doc.resolve(e),i=be.empty,o=be.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=be.from(a.node(c).copy(i));let f=r&&r[h];o=be.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new On(e,e,new Re(i.append(o),n,n),!0))}function _i(t,e){let n=t.resolve(e),r=n.index();return fS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function TO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let a=0;a0?(i=r.node(a+1),c++,o=r.node(a).maybeChild(c)):(i=r.node(a).maybeChild(c-1),o=r.node(a+1)),i&&!i.isTextblock&&fS(i,o)&&r.node(a).canReplace(c,c+1))return e;if(a==0)break;e=n<0?r.before(a):r.after(a)}}function MO(t,e,n){let r=null,{linebreakReplacement:a}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(a&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(a);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);hS(t,f.node(),f.before(),c)}o.inlineContent&&h0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new On(h,u.map(e+n,-1),Re.empty,!0)),r===!0){let f=t.doc.resolve(h);uS(t,f.node(),f.before(),t.steps.length)}return t}function AO(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 a=r.depth-1;a>=0;a--){let i=r.index(a);if(r.node(a).canReplaceWith(i,i,n))return r.before(a+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let a=r.depth-1;a>=0;a--){let i=r.indexAfter(a);if(r.node(a).canReplaceWith(i,i,n))return r.after(a+1);if(i=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(i==1)f=h.canReplace(u,u,a);else{let m=h.contentMatchAt(u).findWrapping(a.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 Af(t,e,n=e,r=Re.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return mS(a,i,r)?new On(e,n,r):new IO(a,i,r).fit()}function mS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class IO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=be.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=be.from(e.node(a).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,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new Re(i,o,c);return e>-1?new Ln(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new On(r.pos,a.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,a=this.unplaced.openEnd;r1&&(a=0),i.type.spec.isolating&&a<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let a,i=null;r?(i=Qm(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.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(be.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=Qm(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Re(e,n+1,Math.max(r,a.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=Qm(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new Re(Fc(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Re(Fc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let w=0;w1||u==0||w.content.size)&&(m=N,f.push(gS(w.mark(g.allowedMarks(w.marks)),h==1?u:0,h==c.childCount?y:-1)))}let v=h==c.childCount;v||(y=-1),this.placed=Bc(this.placed,n,be.from(f)),this.frontier[n].match=m,v&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,N=c;w1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Xm(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:i?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=Bc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let a=e.node(r),i=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,i)}return e}openFrontierNode(e,n=null,r){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=Bc(this.placed,this.depth,be.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(be.empty,!0);n.childCount&&(this.placed=Bc(this.placed,this.frontier.length,n))}}function Fc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Fc(t.firstChild.content,e-1,n)))}function Bc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bc(t.lastChild.content,e-1,n)))}function Qm(t,e){for(let n=0;n1&&(r=r.replaceChild(0,gS(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(be.empty,!0)))),t.copy(r)}function Xm(t,e,n,r,a){let i=t.node(e),o=a?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let c=r.fillBefore(i.content,!0,o);return c&&!RO(n,i.content,o)?c:null}function RO(t,e,n){for(let r=n;r0;g--,y--){let v=a.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(g)>-1?c=g:a.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 v=g.firstChild;if(h.push(v),y==r.openStart)break;g=v.content}for(let g=f-1;g>=0;g--){let y=h[g],v=PO(y.type);if(v&&!y.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(v||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),v=h[y];if(v)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=a.before(y),n=i.after(y))}}function xS(t,e,n,r,a){if(er){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(be.empty,!0))}return t}function DO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=AO(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Re(be.from(r),0,0))}function LO(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=yS(r,a);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),a.indexAfter(c-1))))return t.delete(r.before(c),a.after(c))}for(let o=1;o<=r.depth&&o<=a.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&a.end(o)-n!=a.depth-o&&r.start(o-1)==a.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),a.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function yS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let a=r;a>=0;a--){let i=t.start(a);if(ie.pos+(e.depth-a)||t.node(a).type.spec.isolating||e.node(a).type.spec.isolating)break;(i==e.start(a)||a==t.depth&&a==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&a&&e.start(a-1)==i-1)&&n.push(a)}return n}class Il 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 vn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return vn.fromReplace(e,this.pos,this.pos+1,new Re(be.from(a),0,n.isLeaf?0:1))}getMap(){return _r.empty}invert(e){return new Il(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 Il(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 Il(n.pos,n.attr,n.value)}}ir.jsonID("attr",Il);class fd extends ir{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return vn.ok(r)}getMap(){return _r.empty}invert(e){return new fd(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 fd(n.attr,n.value)}}ir.jsonID("docAttr",fd);let _l=class extends Error{};_l=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};_l.prototype=Object.create(Error.prototype);_l.prototype.constructor=_l;_l.prototype.name="TransformError";class p0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new hd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new _l(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=Re.empty){let a=Af(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new Re(be.from(r),0,0))}delete(e,n){return this.replace(e,n,Re.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return OO(this,e,n,r),this}replaceRangeWith(e,n,r){return DO(this,e,n,r),this}deleteRange(e,n){return LO(this,e,n),this}lift(e,n){return vO(this,e,n),this}join(e,n=1){return MO(this,e,n),this}wrap(e,n){return jO(this,e,n),this}setBlockType(e,n=e,r,a=null){return kO(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return CO(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new Il(e,n,r)),this}setDocAttribute(e,n){return this.step(new fd(e,n)),this}addNodeMark(e,n){return this.step(new vi(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 Dt)n.isInSet(r.marks)&&this.step(new Ao(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Ao(e,i)),a=i.removeFromSet(a);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return EO(this,e,n,r),this}addMark(e,n,r){return xO(this,e,n,r),this}removeMark(e,n,r){return yO(this,e,n,r),this}clearIncompatible(e,n,r){return h0(this,e,n,r),this}}const Zm=Object.create(null);class tt{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new bS(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;i--){let o=n<0?wl(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):wl(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Fr(e.node(0))}static atStart(e){return wl(e,e,0,0,1)||new Fr(e)}static atEnd(e){return wl(e,e,e.content.size,e.childCount,-1)||new Fr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Zm[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 Zm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Zm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Je.between(this.$anchor,this.$head).getBookmark()}}tt.prototype.visible=!0;class bS{constructor(e,n){this.$from=e,this.$to=n}}let T1=!1;function M1(t){!T1&&!t.parent.inlineContent&&(T1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Je extends tt{constructor(e,n=e){M1(e),M1(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 tt.near(r);let a=e.resolve(n.map(this.anchor));return new Je(a.parent.inlineContent?a:r,r)}replace(e,n=Re.empty){if(super.replace(e,n),n==Re.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Je&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new If(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 Je(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=tt.findFrom(n,r,!0)||tt.findFrom(n,-r,!0);if(i)n=i.$head;else return tt.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(tt.findFrom(e,-r,!0)||tt.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&qe.isSelectable(c))return qe.create(t,n-(a<0?c.nodeSize:0))}else{let u=wl(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function A1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(tt.near(t.doc.resolve(o),n))}const I1=1,Wu=2,R1=4;class zO extends p0{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|=Wu,this}ensureMarks(e){return Dt.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&Wu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Wu,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)||Dt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,a.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(tt.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|=R1,this}get scrolledIntoView(){return(this.updated&R1)>0}}function P1(t,e){return!e||!t?t:t.bind(e)}class Vc{constructor(e,n,r){this.name=e,this.init=P1(n.init,r),this.apply=P1(n.apply,r)}}const $O=[new Vc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Vc("selection",{init(t,e){return t.selection||tt.atStart(e.doc)},apply(t){return t.selection}}),new Vc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Vc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class eg{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=$O.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 Vc(r.key,r.spec.state,r))})}}class Tl{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 a=e[r],i=a.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(a,this[a.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 a=new eg(e.schema,e.plugins),i=new Tl(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Sa.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=tt.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.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)){i[o.name]=h.fromJSON.call(u,e,n[c],i);return}}i[o.name]=o.init(e,i)}}),i}}function vS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=vS(a,e,{})),n[r]=a}return n}class Ut{constructor(e){this.spec=e,this.props={},e.props&&vS(e.props,this,this.props),this.key=e.key?e.key.key:NS("plugin")}getState(e){return e[this.key]}}const tg=Object.create(null);function NS(t){return t in tg?t+"$"+ ++tg[t]:(tg[t]=0,t+"$")}class Yt{constructor(e="key"){this.key=NS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const g0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function wS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const jS=(t,e,n)=>{let r=wS(t,n);if(!r)return!1;let a=x0(r);if(!a){let o=r.blockRange(),c=o&&Xl(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(RS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(zl(i,"end")||qe.isSelectable(i)))for(let o=r.depth;;o--){let c=Af(t.doc,r.before(o),r.after(o),Re.empty);if(c&&c.slice.size1)break}return i.isAtom&&a.depth==r.depth-1?(e&&e(t.tr.delete(a.pos-i.nodeSize,a.pos).scrollIntoView()),!0):!1},FO=(t,e,n)=>{let r=wS(t,n);if(!r)return!1;let a=x0(r);return a?kS(t,a,e):!1},BO=(t,e,n)=>{let r=CS(t,n);if(!r)return!1;let a=y0(r);return a?kS(t,a,e):!1};function kS(t,e,n){let r=e.nodeBefore,a=r,i=e.pos-1;for(;!a.isTextblock;i--){if(a.type.spec.isolating)return!1;let f=a.lastChild;if(!f)return!1;a=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=Af(t.doc,i,u,Re.empty);if(!h||h.from!=i||h instanceof On&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(Je.create(f.doc,i)),n(f.scrollIntoView())}return!0}function zl(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 SS=(t,e,n)=>{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=x0(r)}let o=i&&i.nodeBefore;return!o||!qe.isSelectable(o)?!1:(e&&e(t.tr.setSelection(qe.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function x0(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 CS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=CS(t,n);if(!r)return!1;let a=y0(r);if(!a)return!1;let i=a.nodeAfter;if(RS(t,a,e,1))return!0;if(r.parent.content.size==0&&(zl(i,"start")||qe.isSelectable(i))){let o=Af(t.doc,r.before(),r.after(),Re.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)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 qe,a;if(r){if(n.node.isTextblock||!_i(t.doc,n.from))return!1;a=n.from}else if(a=Mf(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(qe.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},HO=(t,e)=>{let n=t.selection,r;if(n instanceof qe){if(n.node.isTextblock||!_i(t.doc,n.to))return!1;r=n.to}else if(r=Mf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},WO=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&Xl(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},MS=(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 b0(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 a=n.node(-1),i=n.indexAfter(-1),o=b0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(tt.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},AS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Fr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=b0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ca(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Xl(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function KO(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof qe&&e.selection.node.isBlock)return!r.parentOffset||!Ca(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],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=b0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),i.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof Je||e.selection instanceof Fr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Ca(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Ca(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),v=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const qO=KO(),GO=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(qe.create(t.doc,a))),!0)};function JO(t,e,n){let r=e.nodeBefore,a=e.nodeAfter,i=e.index();return!r||!a||!r.type.compatibleContent(a.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(a.isTextblock||_i(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function RS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&JO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let y=e.pos+i.nodeSize,v=be.empty;for(let k=o.length-1;k>=0;k--)v=be.from(o[k].create(null,v));v=be.from(a.copy(v));let w=t.tr.step(new Ln(e.pos-1,y,e.pos,y,new Re(v,1,0),o.length,!0)),N=w.doc.resolve(y+2*o.length);N.nodeAfter&&N.nodeAfter.type==a.type&&_i(w.doc,N.pos)&&w.join(N.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:tt.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&Xl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&zl(i,"start",!0)&&zl(a,"end")){let y=a,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let w=i,N=1;for(;!w.isTextblock;w=w.firstChild)N++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let k=be.empty;for(let E=v.length-1;E>=0;E--)k=be.from(v[E].copy(k));let C=t.tr.step(new Ln(e.pos-v.length,e.pos+i.nodeSize,e.pos+N,e.pos+i.nodeSize-N,new Re(k,v.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function PS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(Je.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const YO=PS(-1),QO=PS(1);function XO(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&f0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function O1(t,e=null){return function(n,r){let a=!1;for(let i=0;i{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)a=!0;else{let f=n.doc.resolve(h),m=f.index();a=f.parent.canReplaceWith(m,m+1,t)}})}if(!a)return!1;if(r){let i=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);i=new Sh(u,u,e.depth),e.endIndex=0;f--)i=be.from(n[f].type.create(n[f].attrs,i));t.step(new Ln(e.start-(r?2:0),e.end,e.start,e.end,new Re(i,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?rD(e,n,t,i):sD(e,n,i):!0:!1}}function rD(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);iw;v--)y-=a.child(v).nodeSize,r.delete(y-1,y+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?be.empty:be.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new Ln(m-(c?1:0),g+(u?1:0),m+1,g-1,new Re((c?be.empty:be.from(a.copy(be.empty))).append(u?be.empty:be.from(a.copy(be.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function aD(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=be.from(h?t.create():null),m=new Re(be.from(t.create(null,be.from(c.type.create(null,f)))),h?3:1,0),g=i.start,y=i.end;n(e.tr.step(new Ln(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Hn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},$l=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let rx=null;const ba=function(t,e,n){let r=rx||(rx=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},iD=function(){rx=null},Io=function(t,e,n,r){return n&&(D1(t,e,n,r,-1)||D1(t,e,n,r,1))},oD=/^(img|br|input|textarea|hr)$/i;function D1(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Xr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Md(t)||oD.test(t.nodeName)||t.contentEditable=="false")return!1;e=Hn(t)+(a<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(a<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=a;else return!1;else t=o,e=a<0?Xr(t):0}else return!1}}function Xr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function lD(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=Xr(t)}else if(t.parentNode&&!Md(t))e=Hn(t),t=t.parentNode;else return null}}function cD(t,e){for(;;){if(t.nodeType==3&&e2),Qr=Fl||(Ks?/Mac/.test(Ks.platform):!1),LS=Ks?/Win/.test(Ks.platform):!1,ja=/Android \d/.test(zi),Ad=!!L1&&"webkitFontSmoothing"in L1.documentElement.style,fD=Ad?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function pD(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 pa(t,e){return typeof t=="number"?t:t[e]}function mD(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 _1(t,e,n){let r=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=$l(o);continue}let c=o,u=c==i.body,h=u?pD(i):mD(c),f=0,m=0;if(e.toph.bottom-pa(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+pa(a,"top")-h.top:e.bottom-h.bottom+pa(a,"bottom")),e.lefth.right-pa(r,"right")&&(f=e.right-h.right+pa(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let w=c.scrollLeft-y,N=c.scrollTop-v;e={left:e.left-w,top:e.top-N,right:e.right-w,bottom:e.bottom-N}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:$l(o)}}function gD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,a;for(let i=(e.left+e.right)/2,o=n+1;o=n-20){r=c,a=u.top;break}}return{refDOM:r,refTop:a,stack:_S(t.dom)}}function _S(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=$l(r));return e}function xD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;zS(n,r==0?0:r-e)}function zS(t,e){for(let n=0;n=c){o=Math.max(v.bottom,o),c=Math.min(v.top,c);let w=v.left>e.left?v.left-e.left:v.right=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=f,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?bD(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:$S(n,a)}function bD(t,e){let n=t.nodeValue.length,r=document.createRange(),a;for(let i=0;i=(o.left+o.right)/2?1:0)};break}}return r.detach(),a||{node:t,offset:0}}function N0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function vD(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,a,i)}function wD(t,e,n,r){let a=-1;for(let i=e,o=!1;i!=t.dom;){let c=t.docView.nearestDesc(i,!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?a=c.posBefore:(!o&&u.right-1?a:t.docView.posFromDOM(e,n,-1)}function FS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Ad&&a&&r.nodeType==1&&(h=r.childNodes[a-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&a--,r==t.dom&&a==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(a==0||r.nodeType!=1||r.childNodes[a-1].nodeName!="BR")&&(c=wD(t,r,a,e))}c==null&&(c=ND(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function z1(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Dc(ci(ba(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Xr(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return ng(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Xr(r))){let u=r.childNodes[a-1],h=u.nodeType==3?ba(u,Xr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Dc(ci(h,1),!1)}if(i==null&&a=0)}function Dc(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 ng(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 VS(t,e,n){let r=t.state,a=t.root.activeElement;r!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),a!=t.dom&&a&&a.focus()}}function SD(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return VS(t,e,()=>{let{node:i}=t.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(i,!0);if(!c)break;if(c.node.isBlock){i=c.contentDOM||c.dom;break}i=c.dom.parentNode}let o=BS(t,a.pos,1);for(let c=i.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=ba(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 CD=/[\u0590-\u08ac]/;function ED(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let a=r.parentOffset,i=!a,o=a==r.parent.content.size,c=t.domSelection();return c?!CD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:VS(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:v,focusOffset:w}=t.domSelectionRange(),N=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==w;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),N}):r.pos==r.start()||r.pos==r.end()}let $1=null,F1=null,B1=!1;function TD(t,e,n){return $1==e&&F1==n?B1:($1=e,F1=n,B1=n=="up"||n=="down"?SD(t,e,n):ED(t,e,n))}const es=0,V1=1,go=2,qs=3;class Id{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=es,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;nHn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!1;break}if(i.previousSibling)break}if(a==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!0;break}if(i.nextSibling)break}}return a??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,a=e;a;a=a.parentNode){let i=this.getDesc(a),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}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 a=e;a;a=a.parentNode){let i=this.getDesc(a);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof WS){a=e-i;break}i=c}if(a)return this.children[r].domFromPos(a-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof HS&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Hn(i.dom)+1:0}}else{let i,o=!0;for(;i=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)){a=Hn(g.dom)+1;break}e-=g.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fv&&on){let v=c;c=u,u=v}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,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?go:V1,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=qs:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?go:qs}r=o}this.dirty=go}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?go:V1;n.dirty{if(!i)return a;if(i.parent)return i.parent.posBeforeChild(i)})),!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,i=this}matchesWidget(e){return this.dirty==es&&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 MD extends Id{constructor(e,n,r,a){super(e,[],n,null),this.textDOM=r,this.text=a}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 Ro extends Id{constructor(e,n,r,a,i){super(e,[],r,a),this.mark=n,this.spec=i}static create(e,n,r,a){let i=a.nodeViews[n.type.name],o=i&&i(n,a,r);return(!o||!o.dom)&&(o=$o.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ro(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&qs||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qs&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=es){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=lx(i,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,a),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}=$o.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=qS(f,r,n),h?u=new AD(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new Pf(e,n,r,a,f,g,i):new Ci(e,n,r,a,f,m||null,g,i,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=()=>be.empty)}return e}matchesNode(e,n,r){return this.dirty==es&&e.eq(this.node)&&Eh(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,a=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,c=i&&i.pos<0,u=new RD(this,o&&o.node,e);DD(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?Dt.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==go)&&(o&&this.protectLocalComposition(e,o),US(this.contentDOM,this.children,e),Fl&&LD(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof Je)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=_D(this.node.content,o,r-n,a-n);return c<0?null:{node:i,pos:c,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:a}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new MD(this,i,n,a);e.input.compositionNodes.push(o),this.children=lx(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==qs||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=es}updateOuterDeco(e){if(Eh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=KS(this.dom,this.nodeDOM,ox(this.outerDeco,this.node,n),ox(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 H1(t,e,n,r,a){qS(r,e,t);let i=new Ci(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class Pf extends Ci{constructor(e,n,r,a,i,o,c){super(e,n,r,a,i,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,a){return this.dirty==qs||this.dirty!=es&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=es||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=es,!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 a=this.node.cut(e,n),i=document.createTextNode(a.text);return new Pf(this.parent,a,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=qs)}get domAtom(){return!1}isText(e){return this.node.text==e}}class WS extends Id{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==es&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class AD extends Ci{constructor(e,n,r,a,i,o,c,u,h,f){super(e,n,r,a,i,o,c,h,f),this.spec=u}update(e,n,r,a){if(this.dirty==qs)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,a),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,a){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,a)}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 US(t,e,n){let r=t.firstChild,a=!1;for(let i=0;i>1,c=Math.min(o,e.length);for(;i-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=Ro.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,a){let i=-1,o;if(a>=this.preMatch.index&&(o=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=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 Ro)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(a-1))break;--a,i.set(c,a),o.push(c)}}return{index:a,matched:i,matches:o.reverse()}}function OD(t,e){return t.type.side-e.type.side}function DD(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let v=i+g.nodeSize;if(g.isText){let N=v;o!N.inline):c.slice();r(g,w,e.forChild(i,g),y),i=v}}function LD(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 _D(t,e,n,r){for(let a=0,i=0;a=n){if(i>=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 lx(t,e,n,r,a){let i=[];for(let o=0,c=0;o=n||f<=e?i.push(u):(hn&&i.push(u.slice(n-h,u.size,r)))}return i}function w0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),i=a&&a.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(Rf(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&qe.isSelectable(m)&&a.parent&&!(m.isInline&&dD(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new qe(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!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!GS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function $D(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Hn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Mr&&Si<=11&&(n.disabled=!0,n.disabled=!1)}function JS(t,e){if(e instanceof qe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(G1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else G1(t)}function G1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function j0(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||Je.between(e,n,r)}function J1(t){return t.editable&&!t.hasFocus()?!1:YS(t)}function YS(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 FD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Io(e.node,e.offset,n.anchorNode,n.anchorOffset)}function cx(t,e){let{$anchor:n,$head:r}=t.selection,a=e>0?n.max(r):n.min(r),i=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return i&&tt.findFrom(i,e)}function di(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Y1(t,e,n){let r=t.state.selection;if(r instanceof Je)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return di(t,new Je(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=cx(t.state,e);return a&&a instanceof qe?di(t,a):!1}else if(!(Qr&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?qe.isSelectable(i)?di(t,new qe(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Ad?di(t,new Je(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof qe&&r.node.isInline)return di(t,new Je(e>0?r.$to:r.$from));{let a=cx(t.state,e);return a?di(t,a):!1}}}function Th(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Xc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Nl(t,e){return e<0?BD(t):VD(t)}function BD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(Zr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Xc(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(QS(n))break;{let c=n.previousSibling;for(;c&&Xc(c,-1);)a=n.parentNode,i=Hn(c),c=c.previousSibling;if(c)n=c,r=Th(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?dx(t,n,r):a&&dx(t,a,i)}function VD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=Th(n),i,o;for(;;)if(r{t.state==a&&Ea(t)},50)}function Q1(t,e){let n=t.state.doc.resolve(e);if(!(Un||LS)&&n.parent.inlineContent){let a=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>a.top&&o1)return i.lefta.top&&o1)return i.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function X1(t,e,n){let r=t.state.selection;if(r instanceof Je&&!r.empty||n.indexOf("s")>-1||Qr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=cx(t.state,e);if(o&&o instanceof qe)return di(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Fr?tt.near(o,e):tt.findFrom(o,e);return c?di(t,c):!1}return!1}function Z1(t,e){if(!(t.state.selection instanceof Je))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function eN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function UD(t){if(!sr||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;eN(t,r,"true"),setTimeout(()=>eN(t,r,"false"),20)}return!1}function KD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function qD(t,e){let n=e.keyCode,r=KD(e);if(n==8||Qr&&n==72&&r=="c")return Z1(t,-1)||Nl(t,-1);if(n==46&&!e.shiftKey||Qr&&n==68&&r=="c")return Z1(t,1)||Nl(t,1);if(n==13||n==27)return!0;if(n==37||Qr&&n==66&&r=="c"){let a=n==37?Q1(t,t.state.selection.from)=="ltr"?-1:1:-1;return Y1(t,a,r)||Nl(t,a)}else if(n==39||Qr&&n==70&&r=="c"){let a=n==39?Q1(t,t.state.selection.from)=="ltr"?1:-1:1;return Y1(t,a,r)||Nl(t,a)}else{if(n==38||Qr&&n==80&&r=="c")return X1(t,-1,r)||Nl(t,-1);if(n==40||Qr&&n==78&&r=="c")return UD(t)||X1(t,1,r)||Nl(t,1);if(r==(Qr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function k0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:a,openEnd:i}=e;for(;a>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,i--;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")||$o.fromSchema(t.state.schema),c=r2(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=n2[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let v=c.createElement(f[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` - -`);return{dom:u,text:g,slice:e}}function XS(t,e,n,r,a){let i=a.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,i||r,t)}),i)return c=new Re(be.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,r,t));if(m)c=m;else{let g=a.marks(),{schema:y}=t.state,v=$o.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=o.appendChild(document.createElement("p"));w&&N.appendChild(v.serializeNode(y.text(w,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=QD(n),Ad&&XD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||ki.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!GD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=ZD(tN(c,+f[1],+f[2]),f[4]);else if(c=Re.maxOpen(JD(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const GD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function JD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(c=>{if(!o)return;let u=a.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&i.length&&e2(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=t2(o[o.length-1],i.length));let f=ZS(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return be.from(o)}return t}function ZS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,be.from(t));return t}function e2(t,e,n,r,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(be.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function tN(t,e,n){return en})),sg.createHTML(t)):t}function QD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=r2().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&n2[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=YD(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=be.from(u.create(r[c+1],a)),i++,o++}return new Re(a,i,o)}const xr={},yr={},eL={touchstart:!0,touchmove:!0};class tL{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function nL(t){for(let e in xr){let n=xr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{sL(t,r)&&!S0(t,r)&&(t.editable||!(r.type in yr))&&n(t,r)},eL[e]?{passive:!0}:void 0)}sr&&t.dom.addEventListener("input",()=>null),hx(t)}function Ni(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function rL(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function hx(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>S0(t,r))})}function S0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function sL(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function aL(t,e){!S0(t,e)&&xr[e.type]&&(t.editable||!(e.type in yr))&&xr[e.type](t,e)}yr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!a2(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ja&&Un&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Fl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",a=>a(t,ho(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||qD(t,n)?n.preventDefault():Ni(t,"key")};yr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};yr.keypress=(t,e)=>{let n=e;if(a2(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Qr&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Je)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Of(t){return{left:t.clientX,top:t.clientY}}function iL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function C0(t,e,n,r,a){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,c=>o>i.depth?c(t,n,i.nodeAfter,i.before(o),a,!0):c(t,n,i.node(o),i.before(o),a,!1)))return!0;return!1}function Rl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function oL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&qe.isSelectable(r)?(Rl(t,new qe(n)),!0):!1}function lL(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof qe&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(qe.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(Rl(t,qe.create(t.state.doc,a)),!0):!1}function cL(t,e,n,r,a){return C0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?lL(t,n):oL(t,n))}function dL(t,e,n,r){return C0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function uL(t,e,n,r){return C0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||hL(t,n,r)}function hL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Rl(t,Je.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)Rl(t,Je.create(r,c+1,c+1+o.content.size));else if(qe.isSelectable(o))Rl(t,qe.create(r,c));else continue;return!0}}function E0(t){return Mh(t)}const s2=Qr?"metaKey":"ctrlKey";xr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=E0(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&iL(n,t.input.lastClick)&&!n[s2]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Of(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new fL(t,o,n,!!r)):(i=="doubleClick"?dL:uL)(t,o.pos,o.inside,n)?n.preventDefault():Ni(t,"pointer"))};class fL{constructor(e,n,r,a){this.view=e,this.pos=n,this.event=r,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[s2],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof qe&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Zr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ni(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ea(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Of(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ni(this.view,"pointer"):cL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||sr&&this.mightDrag&&!this.mightDrag.node.isAtom||Un&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Rl(this.view,tt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ni(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ni(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}xr.touchstart=t=>{t.input.lastTouch=Date.now(),E0(t),Ni(t,"pointer")};xr.touchmove=t=>{t.input.lastTouch=Date.now(),Ni(t,"pointer")};xr.contextmenu=t=>E0(t);function a2(t,e){return t.composing?!0:sr&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const pL=ja?5e3:-1;yr.compositionstart=yr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Je&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Un&&LS&&mL(t)))t.markCursor=t.state.storedMarks||n.marks(),Mh(t,!0),t.markCursor=null;else if(Mh(t,!e.selection.empty),Zr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let a=r.focusNode,i=r.focusOffset;a&&a.nodeType==1&&i!=0;){let o=i<0?a.lastChild:a.childNodes[i-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else a=o,i=-1}}t.input.composing=!0}i2(t,pL)};function mL(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}yr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,i2(t,20))};function i2(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Mh(t),e))}function o2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=xL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function gL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=lD(e.focusNode,e.focusOffset),r=cD(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let a=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!a||!a.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function xL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Mh(t,e=!1){if(!(ja&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),o2(t),e||t.docView&&t.docView.dirty){let n=w0(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function yL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),a=document.createRange();a.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const pd=Mr&&Si<15||Fl&&fD<604;xr.copy=yr.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=pd?null:n.clipboardData,o=r.content(),{dom:c,text:u}=k0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):yL(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function bL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function vL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?md(t,r.value,null,a,e):md(t,r.textContent,r.innerHTML,a,e)},50)}function md(t,e,n,r,a){let i=XS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||Re.empty)))return!0;if(!i)return!1;let o=bL(i),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function l2(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}yr.paste=(t,e)=>{let n=e;if(t.composing&&!ja)return;let r=pd?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&md(t,l2(r),r.getData("text/html"),a,n)?n.preventDefault():vL(t,n)};class c2{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const NL=Qr?"altKey":"ctrlKey";function d2(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[NL]}xr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let a=t.state.selection,i=a.empty?null:t.posAtCoords(Of(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof qe?a.to-1:a.to))){if(r&&r.mightDrag)o=qe.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=qe.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=k0(t,c);(!n.dataTransfer.files.length||!Un||DS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(pd?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",pd||n.dataTransfer.setData("text/plain",h),t.dragging=new c2(f,d2(t,n),o)};xr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};yr.dragover=yr.dragenter=(t,e)=>e.preventDefault();yr.drop=(t,e)=>{try{wL(t,e,t.dragging)}finally{t.dragging=null}};function wL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Of(e));if(!r)return;let a=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=XS(t,l2(e.dataTransfer),pd?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&d2(t,e));if(t.someProp("handleDrop",y=>y(t,e,i||Re.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?pS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&qe.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new qe(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,w,N,k)=>y=k),u.setSelection(j0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}xr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ea(t)},20))};xr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};xr.beforeinput=(t,e)=>{if(Un&&ja&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,ho(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in yr)xr[t]=yr[t];function gd(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ah{constructor(e,n){this.toDOM=e,this.spec=n||ko,this.side=this.spec.side||0}map(e,n,r,a){let{pos:i,deleted:o}=e.mapResult(n.from+a,this.side<0?-1:1);return o?null:new Tn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ah&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ei{constructor(e,n){this.attrs=e,this.spec=n||ko}map(e,n,r,a){let i=e.map(n.from+a,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+a,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Tn(i,o,this)}valid(e,n){return n.from=e&&(!i||i(c.spec))&&r.push(c.copy(c.from+a,c.to+a))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,a+c,i)}}map(e,n,r){return this==tr||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ko)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=h2(n,c,h)){for(a||(a=this.children.slice());ic&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let i=e+1,o=i+n.content.size;for(let c=0;ci&&u.type instanceof Ei){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,ko));return fi.from(r)}forChild(e,n){if(n.isLeaf)return Pt.empty;let r=[];for(let a=0;an instanceof Pt)?e:e.reduce((n,r)=>n.concat(r instanceof Pt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let N=w-v-(y-g);for(let k=0;kC+f-m)continue;let E=c[k]+f-m;y>=E?c[k+1]=g<=E?-2:-1:g>=f&&N&&(c[k]+=N,c[k+1]+=N)}m+=N}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),y=g-a,{index:v,offset:w}=r.content.findIndex(m),N=r.maybeChild(v);if(N&&w==m&&w+N.nodeSize==y){let k=c[h+2].mapInner(n,N,f+1,t[h]+i+1,o);k!=tr?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=kL(c,t,e,n,a,i,o),f=Ih(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=h2(t,c,u+n);if(h){i=!0;let f=Ih(h,c,n+u+1,r);f!=tr&&a.push(u,u+c.nodeSize,f)}});let o=u2(i?f2(t):t,-n).sort(So);for(let c=0;c0;)e++;t.splice(e,0,n)}function ag(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=tr&&e.push(r)}),t.cursorWrapper&&e.push(Pt.create(t.state.doc,[t.cursorWrapper.deco])),fi.from(e)}const SL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},CL=Mr&&Si<=11;class EL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class TL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new EL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():sr&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),CL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,SL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(J1(this.view)){if(this.suppressingSelectionUpdates)return Ea(this.view);if(Mr&&Si<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Io(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=$l(i))n.add(i);for(let i=e.anchorNode;i;i=$l(i))if(n.has(i)){r=i;break}let a=r&&this.view.docView.nearestDesc(r);if(a&&a.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&J1(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(Zr&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||IL(e,m)!=y)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),ML(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,RL(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ea(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;N--){let k=r.childNodes[N-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){i=N;break}if(!C||C.size)break}let m=t.state.doc,g=t.someProp("domParser")||ki.fromSchema(t.state.schema),y=m.resolve(o),v=null,w=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:a,to:i,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:OL,context:y});if(h&&h[0].pos!=null){let N=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=N),v={anchor:N+o,head:k+o}}return{doc:w,sel:v,from:o,to:c}}function OL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(sr&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||sr&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const DL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function LL(t,e,n,r,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let L=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,R=w0(t,L);if(R&&!t.state.selection.eq(R)){if(Un&&ja&&t.input.lastKeyCode===13&&Date.now()-100_(t,ho(13,"Enter"))))return;let D=t.state.tr.setSelection(R);L=="pointer"?D.setMeta("pointer",!0):L=="key"&&D.scrollIntoView(),i&&D.setMeta("composition",i),t.dispatch(D)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=PL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ja)&&a.some(L=>L.nodeType==1&&!DL.test(L.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",L=>L(t,ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof Je&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let L=oN(t,t.state.doc,h.sel);if(L&&!L.eq(t.state.selection)){let R=t.state.tr.setSelection(L);i&&R.setMeta("composition",i),t.dispatch(R)}}return}t.state.selection.fromt.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),Mr&&Si<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let w=h.doc.resolveNoCache(v.start-h.from),N=h.doc.resolveNoCache(v.endB-h.from),k=f.resolve(v.start),C=w.sameParent(N)&&w.parent.inlineContent&&k.end()>=v.endA;if((Fl&&t.input.lastIOSEnter>Date.now()-225&&(!C||a.some(L=>L.nodeName=="DIV"||L.nodeName=="P"))||!C&&w.posL(t,ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&zL(f,v.start,v.endA,w,N)&&t.someProp("handleKeyDown",L=>L(t,ho(8,"Backspace")))){ja&&Un&&t.domObserver.suppressSelectionUpdates();return}Un&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),ja&&!C&&w.start()!=N.start()&&N.parentOffset==0&&w.depth==N.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,N=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(L){return L(t,ho(13,"Enter"))})},20));let E=v.start,I=v.endA,P=L=>{let R=L||t.state.tr.replace(E,I,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let D=oN(t,R.doc,h.sel);D&&!(Un&&t.composing&&D.empty&&(v.start!=v.endB||t.input.lastChromeDeleteEa(t),20));let L=P(t.state.tr.delete(E,I)),R=f.resolve(v.start).marksAcross(f.resolve(v.endA));R&&L.ensureMarks(R),t.dispatch(L)}else if(v.endA==v.endB&&(B=_L(w.parent.content.cut(w.parentOffset,N.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let L=P(t.state.tr);B.type=="add"?L.addMark(E,I,B.mark):L.removeMark(E,I,B.mark),t.dispatch(L)}else if(w.parent.child(w.index()).isText&&w.index()==N.index()-(N.textOffset?0:1)){let L=w.parent.textBetween(w.parentOffset,N.parentOffset),R=()=>P(t.state.tr.insertText(L,E,I));t.someProp("handleTextInput",D=>D(t,E,I,L,R))||t.dispatch(R())}else t.dispatch(P());else t.dispatch(P())}function oN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:j0(t,e.resolve(n.anchor),e.resolve(n.head))}function _L(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,a=n,i=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(a.length==0&&i.length==1)c=i[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||ig(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,a++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,a++}return a}function $L(t,e,n,r,a){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let u=Math.max(0,i-Math.min(o,c));r-=o+u-i}if(o=o?i-r:0;i-=u,i&&i=c?i-r:0;i-=u,i&&i=56320&&e<=57343&&n>=55296&&n<=56319}class p2{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new tL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(fN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=uN(this),dN(this),this.nodeViews=hN(this),this.docView=H1(this.state.doc,cN(this),ag(this),this.dom,this),this.domObserver=new TL(this,(r,a,i,o)=>LL(this,r,a,i,o)),this.domObserver.start(),nL(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&hx(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(fN),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let a=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(o2(this),o=!0),this.state=e;let c=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=hN(this);BL(y,this.nodeViews)&&(this.nodeViews=y,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&hx(this),this.editable=uN(this),dN(this);let u=ag(this),h=cN(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&gD(this);if(o){this.domObserver.stop();let y=m&&(Mr||Un)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&FL(a.selection,e.selection);if(m){let v=Un?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=gL(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=H1(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&FD(this))?Ea(this,y):(JS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&xD(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof qe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&_1(this,n.getBoundingClientRect(),e)}else _1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(i))==r.node&&(a=i)}this.dragging=new c2(e.slice,e.move,a<0?void 0:qe.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return jD(this,e)}coordsAtPos(e,n=1){return BS(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let a=this.docView.posFromDOM(e,n,r);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,n){return TD(this,n||this.state,e)}pasteHTML(e,n){return md(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return md(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return k0(this,e)}destroy(){this.docView&&(rL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ag(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,iD())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return aL(this,e)}domSelectionRange(){let e=this.domSelection();return e?sr&&this.root.nodeType===11&&uD(this.dom.ownerDocument)==this.dom&&AL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}p2.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function cN(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Tn.node(0,t.state.doc.content.size,e)]}function dN(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Tn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function uN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function FL(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function hN(t){let e=Object.create(null);function n(r){for(let a in r)Object.prototype.hasOwnProperty.call(e,a)||(e[a]=r[a])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function BL(t,e){let n=0,r=0;for(let a in t){if(t[a]!=e[a])return!0;n++}for(let a in e)r++;return n!=r}function fN(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Mi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Rh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},VL=typeof navigator<"u"&&/Mac/.test(navigator.platform),HL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wn=0;Wn<10;Wn++)Mi[48+Wn]=Mi[96+Wn]=String(Wn);for(var Wn=1;Wn<=24;Wn++)Mi[Wn+111]="F"+Wn;for(var Wn=65;Wn<=90;Wn++)Mi[Wn]=String.fromCharCode(Wn+32),Rh[Wn]=String.fromCharCode(Wn);for(var og in Mi)Rh.hasOwnProperty(og)||(Rh[og]=Mi[og]);function WL(t){var e=VL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||HL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Rh:Mi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const UL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),KL=typeof navigator<"u"&&/Win/.test(navigator.platform);function qL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,a,i,o;for(let c=0;c{for(var n in e)YL(t,n,{get:e[n],enumerable:!0})};function Df(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:a}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return a},get tr(){return r=n.selection,a=n.doc,i=n.storedMarks,n}}}var Lf=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...v)=>{const w=this.buildProps(u,e),N=g(...v)(w);return o.push(N),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,i=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Df({state:a,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},m2={};I0(m2,{blur:()=>QL,clearContent:()=>XL,clearNodes:()=>ZL,command:()=>e8,createParagraphNear:()=>t8,cut:()=>n8,deleteCurrentNode:()=>r8,deleteNode:()=>s8,deleteRange:()=>a8,deleteSelection:()=>i8,enter:()=>o8,exitCode:()=>l8,extendMarkRange:()=>c8,first:()=>d8,focus:()=>h8,forEach:()=>f8,insertContent:()=>p8,insertContentAt:()=>x8,joinBackward:()=>v8,joinDown:()=>b8,joinForward:()=>N8,joinItemBackward:()=>w8,joinItemForward:()=>j8,joinTextblockBackward:()=>k8,joinTextblockForward:()=>S8,joinUp:()=>y8,keyboardShortcut:()=>E8,lift:()=>T8,liftEmptyBlock:()=>M8,liftListItem:()=>A8,newlineInCode:()=>I8,resetAttributes:()=>R8,scrollIntoView:()=>P8,selectAll:()=>O8,selectNodeBackward:()=>D8,selectNodeForward:()=>L8,selectParentNode:()=>_8,selectTextblockEnd:()=>z8,selectTextblockStart:()=>$8,setContent:()=>F8,setMark:()=>i6,setMeta:()=>o6,setNode:()=>l6,setNodeSelection:()=>c6,setTextDirection:()=>d6,setTextSelection:()=>u6,sinkListItem:()=>h6,splitBlock:()=>f6,splitListItem:()=>p6,toggleList:()=>m6,toggleMark:()=>g6,toggleNode:()=>x6,toggleWrap:()=>y6,undoInputRule:()=>b6,unsetAllMarks:()=>v6,unsetMark:()=>N6,unsetTextDirection:()=>w6,updateAttributes:()=>j6,wrapIn:()=>k6,wrapInList:()=>S6});var QL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),XL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),ZL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=Xl(y);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,w)}(v||v===0)&&e.lift(y,v)})}),!0},e8=t=>e=>t(e),t8=()=>({state:t,dispatch:e})=>AS(t,e),n8=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Je(r.doc.resolve(Math.max(o-1,0)))),!0},r8=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===r.type){if(e){const c=a.before(i),u=a.after(i);t.delete(c,u).scrollIntoView()}return!0}return!1};function Nn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var s8=t=>({tr:e,state:n,dispatch:r})=>{const a=Nn(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===a){if(r){const u=i.before(o),h=i.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},a8=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},i8=()=>({state:t,dispatch:e})=>g0(t,e),o8=()=>({commands:t})=>t.keyboardShortcut("Enter"),l8=()=>({state:t,dispatch:e})=>UO(t,e);function R0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ph(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:R0(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function g2(t,e,n={}){return t.find(r=>r.type===e&&Ph(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function pN(t,e,n={}){return!!g2(t,e,n)}function P0(t,e,n){var r;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(f=>f.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(f=>f.type===e)||(n=n||((r=a.node.marks[0])==null?void 0:r.attrs),!g2([...a.node.marks],e,n)))return;let o=a.index,c=t.start()+a.offset,u=o+1,h=c+a.node.nodeSize;for(;o>0&&pN([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:a})=>{const i=Ra(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=P0(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=Je.create(o,m.from,m.to);n.setSelection(g)}}return!0},d8=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:a,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Oh()||mN())&&r.dom.focus(),u8()&&!Oh()&&!mN()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!x2(n.state.selection))return o(),!0;const c=y2(a.doc,t)||n.state.selection,u=n.state.selection.eq(c);return i&&(u||a.setSelection(c),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),o()),!0},f8=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),p8=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),b2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&b2(r)}return t};function Uu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return b2(n)}function xd(t,e,n){if(t instanceof Sa||t instanceof be)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return be.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),xd("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new rS({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?ki.fromSchema(u).parseSlice(Uu(t),n.parseOptions):ki.fromSchema(u).parse(Uu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=ki.fromSchema(e);return n.slice?i.parseSlice(Uu(t),n.parseOptions).content:i.parse(Uu(t),n.parseOptions)}return xd("",e,n)}function m8(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(tt.near(t.doc.resolve(o),n))}var g8=t=>!("type"in t),x8=(t,e,n)=>({tr:r,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=N=>{i.emit("contentError",{editor:i,error:N,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{xd(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(N){u(N)}try{c=xd(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(N){return u(N),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((g8(c)?c:[c]).forEach(N=>{N.check(),g=g?N.isText&&N.marks.length===0:!1,y=y?N.isBlock:!1}),f===m&&y){const{parent:N}=r.doc.resolve(f);N.isTextblock&&!N.type.spec.code&&!N.childCount&&(f-=1,m+=1)}let w;if(g){if(Array.isArray(e))w=e.map(N=>N.text||"").join("");else if(e instanceof be){let N="";e.forEach(k=>{k.text&&(N+=k.text)}),w=N}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,f,m)}else{w=c;const N=r.doc.resolve(f),k=N.node(),C=N.parentOffset===0,E=k.isText||k.isTextblock,I=k.content.size>0;C&&E&&I&&(f=Math.max(0,f-1)),r.replaceWith(f,m,w)}n.updateSelection&&m8(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:w})}return!0},y8=()=>({state:t,dispatch:e})=>VO(t,e),b8=()=>({state:t,dispatch:e})=>HO(t,e),v8=()=>({state:t,dispatch:e})=>jS(t,e),N8=()=>({state:t,dispatch:e})=>ES(t,e),w8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Mf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},j8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Mf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},k8=()=>({state:t,dispatch:e})=>FO(t,e),S8=()=>({state:t,dispatch:e})=>BO(t,e);function v2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function C8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,a,i,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:a})=>{const i=C8(t).split(/-(?!$)/),o=i.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&a&&r.maybeStep(f)}),!0};function Ai(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Nn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),v=Math.min(a,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Ph(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var T8=(t,e={})=>({state:n,dispatch:r})=>{const a=Nn(t,n.schema);return Ai(n,a,e)?WO(n,r):!1},M8=()=>({state:t,dispatch:e})=>IS(t,e),A8=t=>({state:e,dispatch:n})=>{const r=Nn(t,e.schema);return nD(r)(e,n)},I8=()=>({state:t,dispatch:e})=>MS(t,e);function _f(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function gN(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,a)=>(n.includes(a)||(r[a]=t[a]),r),{})}var R8=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=_f(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Nn(t,r.schema)),c==="mark"&&(o=Ra(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{i&&i===f.type&&(u=!0,a&&n.setNodeMarkup(m,void 0,gN(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(gN(g.attrs,e))))})})}),u},P8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),O8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Fr(t.doc);t.setSelection(n)}return!0},D8=()=>({state:t,dispatch:e})=>SS(t,e),L8=()=>({state:t,dispatch:e})=>TS(t,e),_8=()=>({state:t,dispatch:e})=>GO(t,e),z8=()=>({state:t,dispatch:e})=>QO(t,e),$8=()=>({state:t,dispatch:e})=>YO(t,e);function fx(t,e,n={},r={}){return xd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var F8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:a,tr:i,dispatch:o,commands:c})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const h=fx(t,a.schema,r,{errorOnInvalidContent:e??a.options.enableContentCheck});return o&&i.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??a.options.enableContentCheck})};function N2(t,e){const n=Ra(e,t.schema),{from:r,to:a,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,a,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function w2(t,e){const n=new p0(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function B8(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function j2(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function zf(t){return e=>j2(e.$from,t)}function We(t,e,n){return t.config[e]===void 0&&t.parent?We(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?We(t.parent,e,n):null}):t.config[e]}function O0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=We(e,"addExtensions",n);return r?[e,...O0(r())]:e}).flat(10)}function D0(t,e){const n=$o.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function k2(t){return typeof t=="function"}function jt(t,e=void 0,...n){return k2(t)?e?t.bind(e)(...n):t(...n):t}function H8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Bl(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),r=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function S2(t){const e=[],{nodeExtensions:n,markExtensions:r}=Bl(t),a=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:a},m=We(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let v;Array.isArray(y.types)?v=y.types:y.types==="*"?v=u:y.types==="nodes"?v=o:y.types==="marks"?v=c:v=[],v.forEach(w=>{Object.entries(y.attributes).forEach(([N,k])=>{e.push({type:w,name:N,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=We(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,v])=>{const w={...i,...v};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:h.name,name:y,attribute:w})})}),e}function W8(t){const e=[];let n="",r=!1,a=!1,i=0;const o=t.length;for(let c=0;c0){i-=1,n+=u;continue}if(u===";"&&i===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function xN(t){const e=[],n=W8(t||""),r=n.length;for(let a=0;a!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([a,i])=>{if(!r[a]){r[a]=i;return}if(a==="class"){const c=i?String(i).split(" "):[],u=r[a]?r[a].split(" "):[],h=c.filter(f=>!u.includes(f));r[a]=[...u,...h].join(" ")}else if(a==="style"){const c=new Map([...xN(r[a]),...xN(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function yd(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>St(n,r),{})}function U8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function yN(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const a=e.reduce((i,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):U8(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function bN(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&H8(n)?!1:n!=null))}function vN(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function K8(t,e){var n;const r=S2(t),{nodeExtensions:a,markExtensions:i}=Bl(t),o=(n=a.find(h=>We(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(a.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,C)=>{const E=We(C,"extendNodeSchema",m);return{...k,...E?E(h):{}}},{}),y=bN({...g,content:jt(We(h,"content",m)),marks:jt(We(h,"marks",m)),group:jt(We(h,"group",m)),inline:jt(We(h,"inline",m)),atom:jt(We(h,"atom",m)),selectable:jt(We(h,"selectable",m)),draggable:jt(We(h,"draggable",m)),code:jt(We(h,"code",m)),whitespace:jt(We(h,"whitespace",m)),linebreakReplacement:jt(We(h,"linebreakReplacement",m)),defining:jt(We(h,"defining",m)),isolating:jt(We(h,"isolating",m)),attrs:Object.fromEntries(f.map(vN))}),v=jt(We(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>yN(k,f)));const w=We(h,"renderHTML",m);w&&(y.toDOM=k=>w({node:k,HTMLAttributes:yd(k,f)}));const N=We(h,"renderText",m);return N&&(y.toText=N),[h.name,y]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(N=>N.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((N,k)=>{const C=We(k,"extendMarkSchema",m);return{...N,...C?C(h):{}}},{}),y=bN({...g,inclusive:jt(We(h,"inclusive",m)),excludes:jt(We(h,"excludes",m)),group:jt(We(h,"group",m)),spanning:jt(We(h,"spanning",m)),code:jt(We(h,"code",m)),attrs:Object.fromEntries(f.map(vN))}),v=jt(We(h,"parseHTML",m));v&&(y.parseDOM=v.map(N=>yN(N,f)));const w=We(h,"renderHTML",m);return w&&(y.toDOM=N=>w({mark:N,HTMLAttributes:yd(N,f)})),[h.name,y]}));return new rS({topNode:o,nodes:c,marks:u})}function q8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Zc(t){return t.sort((n,r)=>{const a=We(n,"priority")||100,i=We(r,"priority")||100;return a>i?-1:ar.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function E2(t,e,n){const{from:r,to:a}=e,{blockSeparator:i=` - -`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,a,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=i);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,a-h))}),c}function G8(t,e){const n={from:0,to:t.content.size};return E2(t,n,e)}function T2(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function J8(t,e){const n=Nn(e,t.schema),{from:r,to:a}=t.selection,i=[];t.doc.nodesBetween(r,a,c=>{i.push(c)});const o=i.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function M2(t,e){const n=_f(typeof e=="string"?e:e.name,t.schema);return n==="node"?J8(t,e):n==="mark"?N2(t,e):{}}function Y8(t,e=JSON.stringify){const n={};return t.filter(r=>{const a=e(r);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function Q8(t){const e=Y8(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function A2(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((a,i)=>{const o=[];if(a.ranges.length)a.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[i];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(i).map(c,-1),f=e.slice(i).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),Q8(r)}function L0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=P0(i,a.type);o&&r.push({mark:a,...o})}):n.nodesBetween(t,e,(a,i)=>{!a||(a==null?void 0:a.nodeSize)===void 0||r.push(...a.marks.map(o=>({from:i,to:i+a.nodeSize,mark:o})))}),r}var X8=(t,e,n,r=20)=>{const a=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const c=a.node(i);(c==null?void 0:c.type.name)===e?o=c:i-=1}return[o,i]};function Lc(t,e){return e.nodes[t]||e.marks[t]||null}function ch(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const a=t.find(i=>i.type===e&&i.name===r);return a?a.attribute.keepOnSplit:!1}))}var Z8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(a,i,o,c)=>{var u,h;const f=((h=(u=a.type.spec).toText)==null?void 0:h.call(u,{node:a,pos:i,parent:o,index:c}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?f:f.slice(0,Math.max(0,r-i))}),n};function px(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?Ra(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Ph(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const y=m.pos,v=g.pos;t.doc.nodesBetween(y,v,(w,N)=>{if(i&&w.inlineContent&&!w.type.allowsMarkType(i))return!1;if(!w.isText&&!w.marks.length)return;const k=Math.max(y,N),C=Math.min(v,N+w.nodeSize),E=C-k;o+=E,c.push(...w.marks.map(I=>({mark:I,from:k,to:C})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Ph(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function e6(t,e,n={}){if(!e)return Ai(t,null,n)||px(t,null,n);const r=_f(e,t.schema);return r==="node"?Ai(t,e,n):r==="mark"?px(t,e,n):!1}var t6=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=zf(c=>c.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return a.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function NN(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function wN(t,e){const{nodeExtensions:n}=Bl(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=jt(We(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function $f(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let a=!0;return t.content.forEach(i=>{a!==!1&&($f(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function I2(t){return t instanceof qe}var R2=class P2{constructor(e){this.position=e}static fromJSON(e){return new P2(e.position)}toJSON(){return{position:this.position}}};function r6(t,e){const n=e.mapping.mapResult(t.position);return{position:new R2(n.pos),mapResult:n}}function s6(t){return new R2(t)}function a6(t,e,n){var r;const{selection:a}=e;let i=null;if(x2(a)&&(i=a.$cursor),i){const c=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=a;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),v=!!n.isInSet(f.marks)||!f.marks.some(w=>w.type.excludes(n));h=y&&v}return!h}),h})}var i6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=Ra(t,r.schema);if(a)if(o){const h=N2(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,y)=>{const v=Math.max(y,f),w=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(v,w,u.create({...k.attrs,...e}))}):n.addMark(v,w,u.create(e))})});return a6(r,n,u)},o6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),l6=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Nn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?a().command(({commands:c})=>O1(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>O1(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},c6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=yo(t,0,r.content.size),i=qe.create(r,a);e.setSelection(i)}return!0},d6=(t,e)=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=i.from,c=i.to),a&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},u6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Je.atStart(r).from,c=Je.atEnd(r).to,u=yo(a,o,c),h=yo(i,o,c),f=Je.create(r,u,h);e.setSelection(f)}return!0},h6=t=>({state:e,dispatch:n})=>{const r=Nn(t,e.schema);return aD(r)(e,n)};function jN(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(a=>e==null?void 0:e.includes(a.type.name));t.tr.ensureMarks(r)}}var f6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:a})=>{const{selection:i,doc:o}=e,{$from:c,$to:u}=i,h=a.extensionManager.attributes,f=ch(h,c.node().type.name,c.node().attrs);if(i instanceof qe&&i.node.isBlock)return!c.parentOffset||!Ca(o,c.pos)?!1:(r&&(t&&jN(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:B8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,v=Ca(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&Ca(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(v&&(i instanceof Je&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const w=e.mapping.map(c.before()),N=e.doc.resolve(w);c.node(-1).canReplaceWith(N.index(),N.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&jN(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return v},p6=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Nn(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let k=be.empty;const C=u.index(-1)?1:u.index(-2)?2:3;for(let R=u.depth-C;R>=u.depth-3;R-=1)k=be.from(u.node(R).copy(k));const E=u.indexAfter(-1){if(L>-1)return!1;R.isTextblock&&R.content.size===0&&(L=D+1)}),L>-1&&n.setSelection(Je.near(n.doc.resolve(L))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...ch(g,m.type.name,m.attrs),...e},w={...ch(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const N=y?[{type:c,attrs:v},{type:y,attrs:w}]:[{type:c,attrs:v}];if(!Ca(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:C}=r,{splittableMarks:E}=i.extensionManager,I=C||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,N).scrollIntoView(),!I||!a)return!0;const P=I.filter(B=>E.includes(B.type.name));n.ensureMarks(P)}return!0},cg=(t,e)=>{const n=zf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===(a==null?void 0:a.type)&&_i(t.doc,n.pos)&&t.join(n.pos),!0},dg=(t,e)=>{const n=zf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===(a==null?void 0:a.type)&&_i(t.doc,r)&&t.join(r),!0},m6=(t,e,n,r={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=a.extensionManager,y=Nn(t,o.schema),v=Nn(e,o.schema),{selection:w,storedMarks:N}=o,{$from:k,$to:C}=w,E=k.blockRange(C),I=N||w.$to.parentOffset&&w.$from.marks();if(!E)return!1;const P=zf(B=>wN(B.type.name,m))(w);if(E.depth>=1&&P&&E.depth-P.depth<=1){if(P.node.type===y)return h.liftListItem(v);if(wN(P.node.type.name,m)&&y.validContent(P.node.content)&&c)return u().command(()=>(i.setNodeMarkup(P.pos,y),!0)).command(()=>cg(i,y)).command(()=>dg(i,y)).run()}return!n||!I||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>cg(i,y)).command(()=>dg(i,y)).run():u().command(()=>{const B=f().wrapInList(y,r),L=I.filter(R=>g.includes(R.type.name));return i.ensureMarks(L),B?!0:h.clearNodes()}).wrapInList(y,r).command(()=>cg(i,y)).command(()=>dg(i,y)).run()},g6=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ra(t,r.schema);return px(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},x6=(t,e,n={})=>({state:r,commands:a})=>{const i=Nn(t,r.schema),o=Nn(e,r.schema),c=Ai(r,i,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?a.setNode(o,u):a.setNode(i,{...u,...n})},y6=(t,e={})=>({state:n,commands:r})=>{const a=Nn(t,n.schema);return Ai(n,a,e)?r.lift(a):r.wrapIn(a,e)},b6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(i.text){const u=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else o.delete(i.from,i.to)}return!0}}return!1},v6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:a}=n;return r||e&&a.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},N6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=Ra(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:y}=c;const v=(i=h.marks().find(N=>N.type===u))==null?void 0:i.attrs,w=P0(h,u,v);w&&(g=w.from,y=w.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},w6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:a}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=a.from,o=a.to),r&&e.doc.nodesBetween(i,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},j6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=_f(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Nn(t,r.schema)),c==="mark"&&(o=Ra(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,v,w;n.selection.empty?r.doc.nodesBetween(f,m,(N,k)=>{i&&i===N.type&&(u=!0,v=Math.max(k,f),w=Math.min(k+N.nodeSize,m),g=k,y=N)}):r.doc.nodesBetween(f,m,(N,k)=>{k=f&&k<=m&&(i&&i===N.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...N.attrs,...e})),o&&N.marks.length&&N.marks.forEach(C=>{if(o===C.type&&(u=!0,a)){const E=Math.max(k,f),I=Math.min(k+N.nodeSize,m);n.addMark(E,I,o.create({...C.attrs,...e}))}}))}),y&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(N=>{o===N.type&&a&&n.addMark(v,w,o.create({...N.attrs,...e}))}))}),u},k6=(t,e={})=>({state:n,dispatch:r})=>{const a=Nn(t,n.schema);return XO(a,e)(n,r)},S6=(t,e={})=>({state:n,dispatch:r})=>{const a=Nn(t,n.schema);return ZO(a,e)(n,r)},C6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Ff=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},E6=(t,e)=>{if(R0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Ku(t){var e;const{editor:n,from:r,to:a,text:i,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=Z8(h)+i;return o.forEach(g=>{if(f)return;const y=E6(m,g.find);if(!y)return;const v=u.state.tr,w=Df({state:u.state,transaction:v}),N={from:r-(y[0].length-i.length),to:a},{commands:k,chain:C,can:E}=new Lf({editor:n,state:w});g.handler({state:w,range:N,match:y,commands:k,chain:C,can:E})===null||!v.steps.length||(g.undoable&&v.setMeta(c,{transform:v,from:r,to:a,text:i}),u.dispatch(v),f=!0)}),f}function T6(t){const{editor:e,rules:n}=t,r=new Ut({state:{init(){return null},apply(a,i,o){const c=a.getMeta(r);if(c)return c;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=D0(be.from(f),o.schema);const{from:m}=u,g=m+f.length;Ku({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return Ku({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&Ku({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(a,i){if(i.key!=="Enter")return!1;const{$cursor:o}=a.state.selection;return o?Ku({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function M6(t){return Object.prototype.toString.call(t).slice(8,-1)}function qu(t){return M6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function O2(t,e){const n={...t};return qu(t)&&qu(e)&&Object.keys(e).forEach(r=>{qu(e[r])&&qu(t[r])?n[r]=O2(t[r],e[r]):n[r]=e[r]}),n}var _0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...jt(We(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...jt(We(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>O2(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Fo=class D2 extends _0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new D2(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const o=a.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",a.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function A6(t){return typeof t=="number"}var I6=class{constructor(t){this.find=t.find,this.handler=t.handler}},R6=(t,e,n)=>{if(R0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(a=>{const i=[a.text];return i.index=a.index,i.input=t,i.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(a.replaceWith)),i}):[]};function P6(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Lf({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(y,v)=>{var w,N,k,C,E;if((N=(w=y.type)==null?void 0:w.spec)!=null&&N.code||!(y.isText||y.isTextblock||y.isInline))return;const I=(E=(C=(k=y.content)==null?void 0:k.size)!=null?C:y.nodeSize)!=null?E:0,P=Math.max(r,v),B=Math.min(a,v+I);if(P>=B)return;const L=y.isText?y.text||"":y.textBetween(P-v,B-v,void 0,"");R6(L,i.find,o).forEach(D=>{if(D.index===void 0)return;const _=P+D.index+1,te=_+D[0].length,K={from:n.tr.mapping.map(_),to:n.tr.mapping.map(te)},he=i.handler({state:n,range:K,match:D,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(he)})}),m.every(y=>y!==null)}var Gu=null,O6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function D6(t){const{editor:e,rules:n}=t;let r=null,a=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:v})=>{const w=f.tr,N=Df({state:f,transaction:w});if(!(!P6({editor:e,state:N,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:v,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(f=>new Ut({view(m){const g=v=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(v.target)?m.dom.parentElement:null,r&&(Gu=e)},y=()=>{Gu&&(Gu=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=r===m.dom.parentElement,c=g,!i){const y=Gu;y!=null&&y.isEditable&&setTimeout(()=>{const v=y.state.selection;v&&y.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var y;const v=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,a=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const v=m[0],w=v.getMeta("uiEvent")==="paste"&&!a,N=v.getMeta("uiEvent")==="drop"&&!i,k=v.getMeta("applyPasteRules"),C=!!k;if(!w&&!N&&!C)return;if(C){let{text:P}=k;typeof P=="string"?P=P:P=D0(be.from(P),y.schema);const{from:B}=k,L=B+P.length,R=O6(P);return u({rule:f,state:y,from:B,to:{b:L},pasteEvt:R})}const E=g.doc.content.findDiffStart(y.doc.content),I=g.doc.content.findDiffEnd(y.doc.content);if(!(!A6(E)||!I||E===I.b))return u({rule:f,state:y,from:E,to:I,pasteEvt:o})}}))}var Bf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=C2(t),this.schema=K8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Lc(e.name,this.schema)},r=We(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Zc([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Lc(r.name,this.schema)},i=[],o=We(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&We(r,"exitable",a)&&(c.ArrowRight=()=>Fo.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,v])=>[y,()=>v({editor:t})]));c={...c,...g}}const u=JL(c);i.push(u);const h=We(r,"addInputRules",a);if(NN(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=T6({editor:t,rules:g}),v=Array.isArray(y)?y:[y];i.push(...v)}}const f=We(r,"addPasteRules",a);if(NN(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=D6({editor:t,rules:g});i.push(...y)}}const m=We(r,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return S2(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Bl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Nn(n.name,this.schema)},i=We(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const y=yd(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return Zc([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Lc(a.name,this.schema)},o=We(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Zc([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Lc(a.name,this.schema)},o=We(a,"transformPastedHTML",i);return o?(c,u)=>{const h=r(c,u);return o.call(i,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Bl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ra(n.name,this.schema)},i=We(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=yd(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{Y6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Lc(e.name,this.schema)};e.type==="mark"&&((n=jt(We(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=We(e,"onBeforeCreate",r),i=We(e,"onCreate",r),o=We(e,"onUpdate",r),c=We(e,"onSelectionUpdate",r),u=We(e,"onTransaction",r),h=We(e,"onFocus",r),f=We(e,"onBlur",r),m=We(e,"onDestroy",r);a&&this.editor.on("beforeCreate",a),i&&this.editor.on("create",i),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};Bf.resolve=C2;Bf.sort=Zc;Bf.flatten=O0;var L6={};I0(L6,{ClipboardTextSerializer:()=>_2,Commands:()=>z2,Delete:()=>$2,Drop:()=>F2,Editable:()=>B2,FocusEvents:()=>H2,Keymap:()=>W2,Paste:()=>U2,Tabindex:()=>K2,TextDirection:()=>q2,focusEventsPluginKey:()=>V2});var dn=class L2 extends _0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new L2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},_2=dn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ut({key:new Yt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:a}=e,{ranges:i}=a,o=Math.min(...i.map(f=>f.$from.pos)),c=Math.max(...i.map(f=>f.$to.pos)),u=T2(n);return E2(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),z2=dn.create({name:"commands",addCommands(){return{...m2}}}),$2=dn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,a;const i=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=w2(t.before,[t,...e]);A2(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(v,w)=>{const N=w+v.nodeSize-2,k=y.oldRange.from<=w&&N<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:w,to:N,newFrom:f.mapping.map(w),newTo:f.mapping.map(N),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,v)=>{var w,N;if(y instanceof vs){const k=g.slice(v).map(y.from,-1),C=g.slice(v).map(y.to),E=g.invert().map(k,-1),I=g.invert().map(C),P=(w=f.doc.nodeAt(k-1))==null?void 0:w.marks.some(L=>L.eq(y.mark)),B=(N=f.doc.nodeAt(C))==null?void 0:N.marks.some(L=>L.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:E,to:I},newRange:{from:k,to:C},partial:!!(B||P),editor:this.editor,transaction:t,combinedTransform:f})}})};(a=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||a?setTimeout(i,0):i()}}),F2=dn.create({name:"drop",addProseMirrorPlugins(){return[new Ut({key:new Yt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),B2=dn.create({name:"editable",addProseMirrorPlugins(){return[new Ut({key:new Yt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),V2=new Yt("focusEvents"),H2=dn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ut({key:V2,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),W2=dn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,w=v.parent.type.spec.isolating,N=m.pos-m.parentOffset,k=w&&v.parent.childCount===1?N===m.pos:tt.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Oh()||v2()?i:a},addProseMirrorPlugins(){return[new Ut({key:new Yt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),a=t.some(w=>w.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=tt.atStart(e.doc).from,h=tt.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!$f(n.doc))return;const g=n.tr,y=Df({state:n,transaction:g}),{commands:v}=new Lf({editor:this.editor,state:y});if(v.clearNodes(),!!g.steps.length)return g}})]}}),U2=dn.create({name:"paste",addProseMirrorPlugins(){return[new Ut({key:new Yt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),K2=dn.create({name:"tabindex",addProseMirrorPlugins(){return[new Ut({key:new Yt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),q2=dn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Bl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ut({key:new Yt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),_6=class Hc{constructor(e,n,r=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=a}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Hc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Hc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Hc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const a=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+r+(i?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!a&&!o&&u.depth<=this.depth)return;const h=new Hc(u,this.editor,a,a||o?n:null);a&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,a=this.parent;for(;a&&!r;){if(a.node.type.name===e)if(Object.keys(n).length>0){const i=a.node.attrs,o=Object.keys(n);for(let c=0;c{r&&a.length>0||(o.node.type.name===e&&i.every(u=>n[u]===o.node.attrs[u])&&a.push(o),!(r&&a.length>0)&&(a=a.concat(o.querySelectorAll(e,n,r))))}),a}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},z6=`.ProseMirror { - position: relative; -} - -.ProseMirror { - word-wrap: break-word; - white-space: pre-wrap; - white-space: break-spaces; - -webkit-font-variant-ligatures: none; - font-variant-ligatures: none; - font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ -} - -.ProseMirror [contenteditable="false"] { - white-space: normal; -} - -.ProseMirror [contenteditable="false"] [contenteditable="true"] { - white-space: pre-wrap; -} - -.ProseMirror pre { - white-space: pre-wrap; -} - -img.ProseMirror-separator { - display: inline !important; - border: none !important; - margin: 0 !important; - width: 0 !important; - height: 0 !important; -} - -.ProseMirror-gapcursor { - display: none; - pointer-events: none; - position: absolute; - margin: 0; -} - -.ProseMirror-gapcursor:after { - content: ""; - display: block; - position: absolute; - top: -2px; - width: 20px; - border-top: 1px solid black; - animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; -} - -@keyframes ProseMirror-cursor-blink { - to { - visibility: hidden; - } -} - -.ProseMirror-hideselection *::selection { - background: transparent; -} - -.ProseMirror-hideselection *::-moz-selection { - background: transparent; -} - -.ProseMirror-hideselection * { - caret-color: transparent; -} - -.ProseMirror-focused .ProseMirror-gapcursor { - display: block; -}`;function $6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const a=document.createElement("style");return e&&a.setAttribute("nonce",e),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}var F6=class extends C6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:r6,createMappablePosition:s6},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:a,moved:i})=>this.options.onDrop(r,a,i)),this.on("paste",({event:r,slice:a})=>this.options.onPaste(r,a)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=y2(e,this.options.autofocus);this.editorState=Tl.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=$6(z6,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=k2(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(a=>{const i=typeof a=="string"?`${a}$`:a.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[B2,_2.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),z2,H2,W2,K2,F2,U2,$2,q2.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a==null?void 0:a.type));this.extensionManager=new Bf(r,this)}createCommandManager(){this.commandManager=new Lf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=fx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=fx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),a=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new p2(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:a,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),a=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!a)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return M2(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return e6(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return D0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:n={}}=t||{};return G8(this.state.doc,{blockSeparator:e,textSerializers:{...T2(this.schema),...n}})}get isEmpty(){return $f(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new _6(e,this)}get $doc(){return this.$pos(0)}};function Vl(t){return new Ff({find:t.find,handler:({state:e,range:n,match:r})=>{const a=jt(t.getAttributes,void 0,r);if(a===!1||a===null)return null;const{tr:i}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(L0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==y.mark.type)).filter(y=>y.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const g=n.from+u+o.length;i.addMark(n.from+u,g,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function G2(t){return new Ff({find:t.find,handler:({state:e,range:n,match:r})=>{const a=jt(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let c=n.to;const u=t.type.create(a);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];i.insertText(m,o+r[0].length-1),i.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;i.insert(h,t.type.create(a)).delete(i.mapping.map(o),i.mapping.map(c))}i.scrollIntoView()},undoable:t.undoable})}function mx(t){return new Ff({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),i=jt(t.getAttributes,void 0,r)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Hl(t){return new Ff({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const i=jt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&f0(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const w=v.filter(N=>y.includes(N.type.name));o.ensureMarks(w)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&_i(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var B6=t=>"touches"in t,V6=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,a,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(a=t.options)!=null&&a.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),a=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),a&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,B6(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:a}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,a,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,a=this.startHeight;const i=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),c?a=this.startHeight+n:u&&(a=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(a=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,a,t):{width:r,height:a}}applyConstraints(t,e,n){var r,a,i,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(a=this.maxSize)!=null&&a.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",a=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:a?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function H6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof qe){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let a=r.depth;for(;a>=0;){const i=r.index(a);if(r.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function W6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var U6={};I0(U6,{createAtomBlockMarkdownSpec:()=>K6,createBlockMarkdownSpec:()=>q6,createInlineMarkdownSpec:()=>J2,parseAttributes:()=>z0,parseIndentedBlocks:()=>gx,renderNestedMarkdownContent:()=>F0,serializeAttributes:()=>$0});function z0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[h]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function $0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function K6(t){const{nodeName:e,name:n,parseAttributes:r=z0,serializeAttributes:a=$0,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...i,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=f.match(y);if(!v)return;const w=v[1]||"",N=r(w);if(!o.find(C=>!(C in N)))return{type:e,raw:v[0],attributes:N}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=a(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function q6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=z0,serializeAttributes:i=$0,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const w=r(m);y=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const v={...o,...m.attributes};return g.createNode(e,v,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),v=(g=m.match(y))==null?void 0:g.index;return v!==void 0?v:-1},tokenize(m,g,y){var v;const w=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),N=m.match(w);if(!N)return;const[k,C=""]=N,E=a(C);let I=1;const P=k.length;let B="";const L=/^:::([\w-]*)(\s.*)?/gm,R=m.slice(P);for(L.lastIndex=0;;){const D=L.exec(R);if(D===null)break;const _=D.index,te=D[1];if(!((v=D[2])!=null&&v.endsWith(":::"))){if(te)I+=1;else if(I-=1,I===0){const K=R.slice(0,_);B=K.trim();const he=m.slice(0,P+_+D[0].length);let ge=[];if(B)if(c==="block")for(ge=y.blockTokens(K),ge.forEach(z=>{z.text&&(!z.tokens||z.tokens.length===0)&&(z.tokens=y.inlineTokens(z.text))});ge.length>0;){const z=ge[ge.length-1];if(z.type==="paragraph"&&(!z.text||z.text.trim()===""))ge.pop();else break}else ge=y.inlineTokens(B);return{type:e,raw:he,attributes:E,content:B,tokens:ge}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),v=i(y),w=v?` {${v}}`:"",N=g.renderChildren(m.content||[],` - -`);return`:::${h}${w} - -${N} - -:::`}}}function G6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r;e[a]=i||o,r=n.exec(t)}return e}function J6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function J2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=G6,serializeAttributes:i=J6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(v=>{const w=typeof v=="string"?v:v.name,N=typeof v=="string"?void 0:v.skipIfDefault;if(w in g){const k=g[w];if(N!==void 0&&k===N)return;y[w]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const v={...o,...g.attributes};if(c)return y.createNode(e,v);const w=r?r(g):g.content||"";return w?y.createNode(e,v,[y.createTextNode(w)]):y.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),v=g.match(y),w=v==null?void 0:v.index;return w!==void 0?w:-1},tokenize(g,y,v){const w=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),N=g.match(w);if(!N)return;let k="",C="";if(c){const[,I]=N;C=I}else{const[,I,P]=N;C=I,k=P||""}const E=a(C.trim());return{type:e,raw:N[0],content:k.trim(),attributes:E}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const v=f(g.attrs||{}),w=i(v),N=w?` ${w}`:"";return c?`[${h}${N}]`:`[${h}${N}]${y}[/${h}]`}}}function gx(t,e,n){var r,a,i,o;const c=t.split(` -`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} -`;continue}else return}const v=e.extractItemData(y),{indentLevel:w,mainContent:N}=v;h=`${h}${g} -`;const k=[N];for(f+=1;f_.trim()!=="");if(L===-1)break;if((((a=(r=c[f+1+L].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>w){k.push(P),h=`${h}${P} -`,f+=1;continue}else break}if((((o=(i=P.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>w)k.push(P),h=`${h}${P} -`,f+=1;else break}let C;const E=k.slice(1);if(E.length>0){const P=E.map(B=>B.slice(w+m)).join(` -`);P.trim()&&(e.customNestedParser?C=e.customNestedParser(P):C=n.blockTokens(P))}const I=e.createToken(v,C);u.push(I)}if(u.length!==0)return{items:u,raw:h}}function F0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` -`).map(g=>g?e.indent(g):"").join(` -`);u.push(m)}}),u.join(` -`)}function Y6(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,y)}}),i.docChanged&&e.view.dispatch(i)}var wn=class Y2 extends _0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Y2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Po(t){return new I6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=jt(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(L0(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(N=>N===t.type&&N!==v.mark.type)).filter(v=>v.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:Q6,getOwnPropertySymbols:X6}=Object,{hasOwnProperty:Z6}=Object.prototype;function ug(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function Ju(t){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,a);const{cache:i}=a,o=i.get(n),c=i.get(r);if(o&&c)return o===r&&c===n;i.set(n,r),i.set(r,n);const u=t(n,r,a);return i.delete(n),i.delete(r),u}}function e_(t){return t!=null?t[Symbol.toStringTag]:void 0}function kN(t){return Q6(t).concat(X6(t))}const t_=Object.hasOwn||((t,e)=>Z6.call(t,e));function Bo(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const n_="__v",r_="__o",s_="_owner",{getOwnPropertyDescriptor:SN,keys:CN}=Object;function a_(t,e){return t.byteLength===e.byteLength&&Dh(new Uint8Array(t),new Uint8Array(e))}function i_(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function o_(t,e){return t.byteLength===e.byteLength&&Dh(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function l_(t,e){return Bo(t.getTime(),e.getTime())}function c_(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function d_(t,e){return t===e}function EN(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const g=o.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const u_=Bo;function h_(t,e,n){const r=CN(t);let a=r.length;if(CN(e).length!==a)return!1;for(;a-- >0;)if(!Q2(t,e,n,r[a]))return!1;return!0}function _c(t,e,n){const r=kN(t);let a=r.length;if(kN(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!Q2(t,e,n,i)||(o=SN(t,i),c=SN(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function f_(t,e){return Bo(t.valueOf(),e.valueOf())}function p_(t,e){return t.source===e.source&&t.flags===e.flags}function TN(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.values();let o,c;for(;(o=i.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!a[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=a[f]=!0;break}f++}if(!h)return!1}return!0}function Dh(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function m_(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Q2(t,e,n,r){return(r===s_||r===r_||r===n_)&&(t.$$typeof||e.$$typeof)?!0:t_(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const g_="[object ArrayBuffer]",x_="[object Arguments]",y_="[object Boolean]",b_="[object DataView]",v_="[object Date]",N_="[object Error]",w_="[object Map]",j_="[object Number]",k_="[object Object]",S_="[object RegExp]",C_="[object Set]",E_="[object String]",T_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},M_="[object URL]",A_=Object.prototype.toString;function I_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:v}){return function(N,k,C){if(N===k)return!0;if(N==null||k==null)return!1;const E=typeof N;if(E!==typeof k)return!1;if(E!=="object")return E==="number"?c(N,k,C):E==="function"?i(N,k,C):!1;const I=N.constructor;if(I!==k.constructor)return!1;if(I===Object)return u(N,k,C);if(Array.isArray(N))return e(N,k,C);if(I===Date)return r(N,k,C);if(I===RegExp)return f(N,k,C);if(I===Map)return o(N,k,C);if(I===Set)return m(N,k,C);const P=A_.call(N);if(P===v_)return r(N,k,C);if(P===S_)return f(N,k,C);if(P===w_)return o(N,k,C);if(P===C_)return m(N,k,C);if(P===k_)return typeof N.then!="function"&&typeof k.then!="function"&&u(N,k,C);if(P===M_)return y(N,k,C);if(P===N_)return a(N,k,C);if(P===x_)return u(N,k,C);if(T_[P])return g(N,k,C);if(P===g_)return t(N,k,C);if(P===b_)return n(N,k,C);if(P===y_||P===j_||P===E_)return h(N,k,C);if(v){let B=v[P];if(!B){const L=e_(N);L&&(B=v[L])}if(B)return B(N,k,C)}return!1}}function R_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:a_,areArraysEqual:n?_c:i_,areDataViewsEqual:o_,areDatesEqual:l_,areErrorsEqual:c_,areFunctionsEqual:d_,areMapsEqual:n?ug(EN,_c):EN,areNumbersEqual:u_,areObjectsEqual:n?_c:h_,arePrimitiveWrappersEqual:f_,areRegExpsEqual:p_,areSetsEqual:n?ug(TN,_c):TN,areTypedArraysEqual:n?ug(Dh,_c):Dh,areUrlsEqual:m_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=Ju(r.areArraysEqual),i=Ju(r.areMapsEqual),o=Ju(r.areObjectsEqual),c=Ju(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function P_(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function O_({circular:t,comparator:e,createState:n,equals:r,strict:a}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:a})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const i={cache:void 0,equals:r,meta:void 0,strict:a};return function(c,u){return e(c,u,i)}}const D_=$i();$i({strict:!0});$i({circular:!0});$i({circular:!0,strict:!0});$i({createInternalComparator:()=>Bo});$i({strict:!0,createInternalComparator:()=>Bo});$i({circular:!0,createInternalComparator:()=>Bo});$i({circular:!0,createInternalComparator:()=>Bo,strict:!0});function $i(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=R_(t),o=I_(i),c=n?n(o):P_(o);return O_({circular:e,comparator:o,createState:r,equals:c,strict:a})}var hg={exports:{}},fg={};/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var MN;function L_(){if(MN)return fg;MN=1;var t=jd(),e=Fk();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return fg.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var v=i(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=c(function(){function k(B){if(!C){if(C=!0,E=B,B=g(B),y!==void 0&&w.hasValue){var L=w.value;if(y(L,B))return I=L}return I=B}if(L=I,r(E,B))return L;var R=g(B);return y!==void 0&&y(L,R)?(E=B,L):(E=B,I=R)}var C=!1,E,I,P=m===void 0?null:m;return[function(){return k(f())},P===null?void 0:function(){return k(P())}]},[f,m,g,y]);var N=a(h,v[0],v[1]);return o(function(){w.hasValue=!0,w.value=N},[N]),u(N),N},fg}var AN;function __(){return AN||(AN=1,hg.exports=L_()),hg.exports}var z_=__(),$_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},F_=({contentComponent:t})=>{const e=Bk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function B_(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:_w.createPortal(r.reactElement,r.element,n)},t.forEach(a=>a())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(a=>a())}}}var V_=class extends fr.Component{constructor(t){var e;super(t),this.editorContentRef=fr.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=B_(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:$_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(F_,{contentComponent:t.contentComponent})]})}},H_=b.forwardRef((t,e)=>{const n=fr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return fr.createElement(V_,{key:n,innerRef:e,...t})}),X2=fr.memo(H_),W_=typeof window<"u"?b.useLayoutEffect:b.useEffect,U_=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function K_(t){var e;const[n]=b.useState(()=>new U_(t.editor)),r=z_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:D_);return W_(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var q_=!1,xx=typeof window>"u",G_=xx||!!(typeof window<"u"&&window.next),J_=class Z2{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?xx||G_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onBeforeCreate)==null?void 0:i.call(a,...r)},onBlur:(...r)=>{var a,i;return(i=(a=this.options.current).onBlur)==null?void 0:i.call(a,...r)},onCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onCreate)==null?void 0:i.call(a,...r)},onDestroy:(...r)=>{var a,i;return(i=(a=this.options.current).onDestroy)==null?void 0:i.call(a,...r)},onFocus:(...r)=>{var a,i;return(i=(a=this.options.current).onFocus)==null?void 0:i.call(a,...r)},onSelectionUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onSelectionUpdate)==null?void 0:i.call(a,...r)},onTransaction:(...r)=>{var a,i;return(i=(a=this.options.current).onTransaction)==null?void 0:i.call(a,...r)},onUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onUpdate)==null?void 0:i.call(a,...r)},onContentError:(...r)=>{var a,i;return(i=(a=this.options.current).onContentError)==null?void 0:i.call(a,...r)},onDrop:(...r)=>{var a,i;return(i=(a=this.options.current).onDrop)==null?void 0:i.call(a,...r)},onPaste:(...r)=>{var a,i;return(i=(a=this.options.current).onPaste)==null?void 0:i.call(a,...r)},onDelete:(...r)=>{var a,i;return(i=(a=this.options.current).onDelete)==null?void 0:i.call(a,...r)}};return new F6(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,i)=>{var o;return a===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Z2.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,a)=>r===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Y_(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new J_(n)),a=Bk.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(a),b.useEffect(r.onRender(e)),K_({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var eC=b.createContext({editor:null});eC.Consumer;var Q_=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),X_=()=>b.useContext(Q_);fr.forwardRef((t,e)=>{const{onDragStart:n}=X_(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});fr.createContext({markViewContentRef:()=>{}});var B0=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});B0.displayName="TiptapContext";var Z_=()=>b.useContext(B0);function tC({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=b.useMemo(()=>({editor:r}),[r]),i=b.useMemo(()=>({editor:r}),[r]);return s.jsx(eC.Provider,{value:i,children:s.jsx(B0.Provider,{value:a,children:n})})}tC.displayName="Tiptap";function nC({...t}){const{editor:e}=Z_();return s.jsx(X2,{editor:e,...t})}nC.displayName="Tiptap.Content";Object.assign(tC,{Content:nC});var Lh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},e7=/^\s*>\s$/,t7=wn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Lh("blockquote",{...St(this.options.HTMLAttributes,t),children:Lh("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(a=>{const c=e.renderChildren([a]).split(` -`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` -`))}),r.join(` -${n} -`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Hl({find:e7,type:this.type})]}}),n7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,r7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,s7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,a7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,i7=Fo.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Lh("strong",{...St(this.options.HTMLAttributes,t),children:Lh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Vl({find:n7,type:this.type}),Vl({find:s7,type:this.type})]},addPasteRules(){return[Po({find:r7,type:this.type}),Po({find:a7,type:this.type})]}}),o7=/(^|[^`])`([^`]+)`(?!`)$/,l7=/(^|[^`])`([^`]+)`(?!`)/g,c7=Fo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Vl({find:o7,type:this.type})]},addPasteRules(){return[Po({find:l7,type:this.type})]}}),pg=4,d7=/^```([a-z]+)?[\s\n]$/,u7=/^~~~([a-z]+)?[\s\n]$/,h7=wn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:pg,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",St(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const a=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${a}`,e.renderChildren(t.content),"```"].join(` -`):r=`\`\`\`${a} - -\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:pg,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;if(i.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=a,y=r.doc.textBetween(h,f,` -`,` -`).split(` -`).map(v=>c+v).join(` -`);return u.replaceWith(h,f,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:pg,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=i,f=i.start(),m=i.end(),y=r.doc.textBetween(f,m,` -`,` -`).split(` -`);let v=0,w=0;const N=h-f;for(let B=0;B=N){v=B;break}w+=y[B].length+1}const C=((u=y[v].match(/^ */))==null?void 0:u[0])||"",E=Math.min(C.length,n);if(E===0)return!0;let I=f;for(let B=0;B{const{from:u,to:h}=a,g=r.doc.textBetween(u,h,` -`,` -`).split(` -`).map(y=>{var v;const w=((v=y.match(/^ */))==null?void 0:v[0])||"",N=Math.min(w.length,n);return y.slice(N)}).join(` -`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` - -`);return!i||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:a,empty:i}=n;if(!i||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const c=a.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(tt.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[mx({find:d7,type:this.type,getAttributes:t=>({language:t[1]})}),mx({find:u7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ut({key:new Yt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` -`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(Je.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),f7=wn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` - -`):""}),p7=wn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",St(this.options.HTMLAttributes,t)]},renderText(){return` -`},renderMarkdown:()=>` -`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),m7=wn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,St(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,a="#".repeat(r);return t.content?`${a} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>mx({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),g7=wn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",St(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!H6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return I2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Je.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(qe.create(o.doc,u.pos)):o.setSelection(Je.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(Je.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[G2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),x7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,y7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,b7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,v7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,N7=Fo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Vl({find:x7,type:this.type}),Vl({find:b7,type:this.type})]},addPasteRules(){return[Po({find:y7,type:this.type}),Po({find:v7,type:this.type})]}});const w7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",j7="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",yx="numeric",bx="ascii",vx="alpha",ed="asciinumeric",Wc="alphanumeric",Nx="domain",rC="emoji",k7="scheme",S7="slashscheme",mg="whitespace";function C7(t,e){return t in e||(e[t]=[]),e[t]}function bo(t,e,n){e[yx]&&(e[ed]=!0,e[Wc]=!0),e[bx]&&(e[ed]=!0,e[vx]=!0),e[ed]&&(e[Wc]=!0),e[vx]&&(e[Wc]=!0),e[Wc]&&(e[Nx]=!0),e[rC]&&(e[Nx]=!0);for(const r in e){const a=C7(r,n);a.indexOf(t)<0&&a.push(t)}}function E7(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Tr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Tr.groups={};Tr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,a),an=(t,e,n,r,a)=>t.tr(e,n,r,a),IN=(t,e,n,r,a)=>t.ts(e,n,r,a),Se=(t,e,n,r,a)=>t.tt(e,n,r,a),xa="WORD",wx="UWORD",sC="ASCIINUMERICAL",aC="ALPHANUMERICAL",bd="LOCALHOST",jx="TLD",kx="UTLD",dh="SCHEME",kl="SLASH_SCHEME",V0="NUM",Sx="WS",H0="NL",td="OPENBRACE",nd="CLOSEBRACE",_h="OPENBRACKET",zh="CLOSEBRACKET",$h="OPENPAREN",Fh="CLOSEPAREN",Bh="OPENANGLEBRACKET",Vh="CLOSEANGLEBRACKET",Hh="FULLWIDTHLEFTPAREN",Wh="FULLWIDTHRIGHTPAREN",Uh="LEFTCORNERBRACKET",Kh="RIGHTCORNERBRACKET",qh="LEFTWHITECORNERBRACKET",Gh="RIGHTWHITECORNERBRACKET",Jh="FULLWIDTHLESSTHAN",Yh="FULLWIDTHGREATERTHAN",Qh="AMPERSAND",Xh="APOSTROPHE",Zh="ASTERISK",ui="AT",ef="BACKSLASH",tf="BACKTICK",nf="CARET",pi="COLON",W0="COMMA",rf="DOLLAR",Bs="DOT",sf="EQUALS",U0="EXCLAMATION",Yr="HYPHEN",rd="PERCENT",af="PIPE",of="PLUS",lf="POUND",sd="QUERY",K0="QUOTE",iC="FULLWIDTHMIDDLEDOT",q0="SEMI",Vs="SLASH",ad="TILDE",cf="UNDERSCORE",oC="EMOJI",df="SYM";var lC=Object.freeze({__proto__:null,ALPHANUMERICAL:aC,AMPERSAND:Qh,APOSTROPHE:Xh,ASCIINUMERICAL:sC,ASTERISK:Zh,AT:ui,BACKSLASH:ef,BACKTICK:tf,CARET:nf,CLOSEANGLEBRACKET:Vh,CLOSEBRACE:nd,CLOSEBRACKET:zh,CLOSEPAREN:Fh,COLON:pi,COMMA:W0,DOLLAR:rf,DOT:Bs,EMOJI:oC,EQUALS:sf,EXCLAMATION:U0,FULLWIDTHGREATERTHAN:Yh,FULLWIDTHLEFTPAREN:Hh,FULLWIDTHLESSTHAN:Jh,FULLWIDTHMIDDLEDOT:iC,FULLWIDTHRIGHTPAREN:Wh,HYPHEN:Yr,LEFTCORNERBRACKET:Uh,LEFTWHITECORNERBRACKET:qh,LOCALHOST:bd,NL:H0,NUM:V0,OPENANGLEBRACKET:Bh,OPENBRACE:td,OPENBRACKET:_h,OPENPAREN:$h,PERCENT:rd,PIPE:af,PLUS:of,POUND:lf,QUERY:sd,QUOTE:K0,RIGHTCORNERBRACKET:Kh,RIGHTWHITECORNERBRACKET:Gh,SCHEME:dh,SEMI:q0,SLASH:Vs,SLASH_SCHEME:kl,SYM:df,TILDE:ad,TLD:jx,UNDERSCORE:cf,UTLD:kx,UWORD:wx,WORD:xa,WS:Sx});const ma=/[a-z]/,zc=new RegExp("\\p{L}","u"),gg=new RegExp("\\p{Emoji}","u"),ga=/\d/,xg=/\s/,RN="\r",yg=` -`,T7="️",M7="‍",bg="";let Yu=null,Qu=null;function A7(t=[]){const e={};Tr.groups=e;const n=new Tr;Yu==null&&(Yu=PN(w7)),Qu==null&&(Qu=PN(j7)),Se(n,"'",Xh),Se(n,"{",td),Se(n,"}",nd),Se(n,"[",_h),Se(n,"]",zh),Se(n,"(",$h),Se(n,")",Fh),Se(n,"<",Bh),Se(n,">",Vh),Se(n,"(",Hh),Se(n,")",Wh),Se(n,"「",Uh),Se(n,"」",Kh),Se(n,"『",qh),Se(n,"』",Gh),Se(n,"<",Jh),Se(n,">",Yh),Se(n,"&",Qh),Se(n,"*",Zh),Se(n,"@",ui),Se(n,"`",tf),Se(n,"^",nf),Se(n,":",pi),Se(n,",",W0),Se(n,"$",rf),Se(n,".",Bs),Se(n,"=",sf),Se(n,"!",U0),Se(n,"-",Yr),Se(n,"%",rd),Se(n,"|",af),Se(n,"+",of),Se(n,"#",lf),Se(n,"?",sd),Se(n,'"',K0),Se(n,"/",Vs),Se(n,";",q0),Se(n,"~",ad),Se(n,"_",cf),Se(n,"\\",ef),Se(n,"・",iC);const r=an(n,ga,V0,{[yx]:!0});an(r,ga,r);const a=an(r,ma,sC,{[ed]:!0}),i=an(r,zc,aC,{[Wc]:!0}),o=an(n,ma,xa,{[bx]:!0});an(o,ga,a),an(o,ma,o),an(a,ga,a),an(a,ma,a);const c=an(n,zc,wx,{[vx]:!0});an(c,ma),an(c,ga,i),an(c,zc,c),an(i,ga,i),an(i,ma),an(i,zc,i);const u=Se(n,yg,H0,{[mg]:!0}),h=Se(n,RN,Sx,{[mg]:!0}),f=an(n,xg,Sx,{[mg]:!0});Se(n,bg,f),Se(h,yg,u),Se(h,bg,f),an(h,xg,f),Se(f,RN),Se(f,yg),an(f,xg,f),Se(f,bg,f);const m=an(n,gg,oC,{[rC]:!0});Se(m,"#"),an(m,gg,m),Se(m,T7,m);const g=Se(m,M7);Se(g,"#"),an(g,gg,m);const y=[[ma,o],[ga,a]],v=[[ma,null],[zc,c],[ga,i]];for(let w=0;ww[0]>N[0]?1:-1);for(let w=0;w=0?C[Nx]=!0:ma.test(N)?ga.test(N)?C[ed]=!0:C[bx]=!0:C[yx]=!0,IN(n,N,N,C)}return IN(n,"localhost",bd,{ascii:!0}),n.jd=new Tr(df),{start:n,tokens:Object.assign({groups:e},lC)}}function cC(t,e){const n=I7(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function I7(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function ii(t,e,n,r,a){let i;const o=e.length;for(let c=0;c=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const vd={defaultProtocol:"http",events:null,format:ON,formatHref:ON,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function G0(t,e=null){let n=Object.assign({},vd);t&&(n=Object.assign(n,t instanceof G0?t.o:t));const r=n.ignoreTags,a=[];for(let i=0;in?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=vd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),a=t.get("tagName",n,e),i=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:a,attributes:o,content:i,eventListeners:m}}};function Vf(t,e){class n extends dC{constructor(a,i){super(a,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const DN=Vf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),LN=Vf("text"),R7=Vf("nl"),Xu=Vf("url",{isLink:!0,toHref(t=vd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==bd&&t[1].t===pi}}),Jr=t=>new Tr(t);function P7({groups:t}){const e=t.domain.concat([Qh,Zh,ui,ef,tf,nf,rf,sf,Yr,V0,rd,af,of,lf,Vs,df,ad,cf]),n=[Xh,pi,W0,Bs,U0,rd,sd,K0,q0,Bh,Vh,td,nd,zh,_h,$h,Fh,Hh,Wh,Uh,Kh,qh,Gh,Jh,Yh],r=[Qh,Xh,Zh,ef,tf,nf,rf,sf,Yr,td,nd,rd,af,of,lf,sd,Vs,df,ad,cf],a=Jr(),i=Se(a,ad);ot(i,r,i),ot(i,t.domain,i);const o=Jr(),c=Jr(),u=Jr();ot(a,t.domain,o),ot(a,t.scheme,c),ot(a,t.slashscheme,u),ot(o,r,i),ot(o,t.domain,o);const h=Se(o,ui);Se(i,ui,h),Se(c,ui,h),Se(u,ui,h);const f=Se(i,Bs);ot(f,r,i),ot(f,t.domain,i);const m=Jr();ot(h,t.domain,m),ot(m,t.domain,m);const g=Se(m,Bs);ot(g,t.domain,m);const y=Jr(DN);ot(g,t.tld,y),ot(g,t.utld,y),Se(h,bd,y);const v=Se(m,Yr);Se(v,Yr,v),ot(v,t.domain,m),ot(y,t.domain,m),Se(y,Bs,g),Se(y,Yr,v);const w=Se(y,pi);ot(w,t.numeric,DN);const N=Se(o,Yr),k=Se(o,Bs);Se(N,Yr,N),ot(N,t.domain,o),ot(k,r,i),ot(k,t.domain,o);const C=Jr(Xu);ot(k,t.tld,C),ot(k,t.utld,C),ot(C,t.domain,o),ot(C,r,i),Se(C,Bs,k),Se(C,Yr,N),Se(C,ui,h);const E=Se(C,pi),I=Jr(Xu);ot(E,t.numeric,I);const P=Jr(Xu),B=Jr();ot(P,e,P),ot(P,n,B),ot(B,e,P),ot(B,n,B),Se(C,Vs,P),Se(I,Vs,P);const L=Se(c,pi),R=Se(u,pi),D=Se(R,Vs),_=Se(D,Vs);ot(c,t.domain,o),Se(c,Bs,k),Se(c,Yr,N),ot(u,t.domain,o),Se(u,Bs,k),Se(u,Yr,N),ot(L,t.domain,P),Se(L,Vs,P),Se(L,sd,P),ot(_,t.domain,P),ot(_,e,P),Se(_,Vs,P);const te=[[td,nd],[_h,zh],[$h,Fh],[Bh,Vh],[Hh,Wh],[Uh,Kh],[qh,Gh],[Jh,Yh]];for(let K=0;K=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(vg(LN,e,o)),o=[]),a-=g,f-=g;const y=m.t,v=n.slice(a-f,a);i.push(vg(y,e,v))}}return o.length>0&&i.push(vg(LN,e,o)),i}function vg(t,e,n){const r=n[0].s,a=n[n.length-1].e,i=e.slice(r,a);return new t(i,n)}const D7=typeof console<"u"&&console&&console.warn||(()=>{}),L7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Gt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function _7(){return Tr.groups={},Gt.scanner=null,Gt.parser=null,Gt.tokenQueue=[],Gt.pluginQueue=[],Gt.customSchemes=[],Gt.initialized=!1,Gt}function _N(t,e=!1){if(Gt.initialized&&D7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${L7}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. -1. Must only contain digits, lowercase ASCII letters or "-" -2. Cannot start or end with "-" -3. "-" cannot repeat`);Gt.customSchemes.push([t,e])}function z7(){Gt.scanner=A7(Gt.customSchemes);for(let t=0;t{const a=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),i=e.some(h=>h.getMeta("preventAutolink"));if(!a||i)return;const{tr:o}=r,c=w2(n.doc,[...e]);if(A2(c).forEach(({newRange:h})=>{const f=V8(r.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(h.from,h.to," "," ");if(!F7.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split($7).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],w=m.pos+g.lastIndexOf(v);if(!v)return!1;const N=J0(v).map(k=>k.toObject(t.defaultProtocol));if(!V7(N))return!1;N.filter(k=>k.isLink).map(k=>({...k,from:w+k.start+1,to:w+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{L0(k.from,k.to,r.doc).some(C=>C.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function W7(t){return new Ut({key:new Yt("handleClickLink"),props:{handleClick:(e,n,r)=>{var a,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=M2(e.state,t.type.name),h=(a=o.href)!=null?a:u.href,f=(i=o.target)!=null?i:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function U7(t){return new Ut({key:new Yt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:a}=t,{state:i}=e,{selection:o}=i,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=uC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||a!==void 0&&!a(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function uo(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const a=typeof r=="string"?r:r.scheme;a&&n.push(a)}),!t||t.replace(B7,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var hC=Fo.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){_N(t);return}_N(t.scheme,t.optionalSlashes)})},onDestroy(){_7()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!uo(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const a=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(a)||!/\./.test(a))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!uo(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!uo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,a,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(i=(a=t.attrs)==null?void 0:a.title)!=null?i:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!uo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!uo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Po({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=uC(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!uo(o,n),protocols:n,defaultProtocol:r}));a.length&&a.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(H7({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!uo(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(W7({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(U7({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),K7=hC,q7=Object.defineProperty,G7=(t,e)=>{for(var n in e)q7(t,n,{get:e[n],enumerable:!0})},J7="listItem",zN="textStyle",$N=/^\s*([-+*])\s$/,fC=wn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(J7,this.editor.getAttributes(zN)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Hl({find:$N,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Hl({find:$N,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(zN),editor:this.editor})),[t]}}),pC=wn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(a=>a.type==="paragraph"))n=e.parseChildren(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>F0(t,e,r=>{var a,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(a=r.meta)==null?void 0:a.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Y7={};G7(Y7,{findListItemPos:()=>Rd,getNextListDepth:()=>Q0,handleBackspace:()=>Cx,handleDelete:()=>Ex,hasListBefore:()=>mC,hasListItemAfter:()=>Q7,hasListItemBefore:()=>gC,listItemHasSubList:()=>xC,nextListIsDeeper:()=>yC,nextListIsHigher:()=>bC});var Rd=(t,e)=>{const{$from:n}=e.selection,r=Nn(t,e.schema);let a=null,i=n.depth,o=n.pos,c=null;for(;i>0&&c===null;)a=n.node(i),a.type===r?c=i:(i-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},Q0=(t,e)=>{const n=Rd(t,e);if(!n)return!1;const[,r]=X8(e,t,n.$pos.pos+4);return r},mC=(t,e,n)=>{const{$anchor:r}=t.selection,a=Math.max(0,r.pos-2),i=t.doc.resolve(a).node();return!(!i||!n.includes(i.type.name))},gC=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-2);return!(a.index()===0||((n=a.nodeBefore)==null?void 0:n.type.name)!==t)},xC=(t,e,n)=>{if(!n)return!1;const r=Nn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},Cx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Ai(t.state,e)&&mC(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,y)=>{g.type.name===e&&h.push({node:g,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Ai(t.state,e)||!n6(t.state))return!1;const r=Rd(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=xC(e,t.state,i);return gC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},yC=(t,e)=>{const n=Q0(t,e),r=Rd(t,e);return!r||!n?!1:n>r.depth},bC=(t,e)=>{const n=Q0(t,e),r=Rd(t,e);return!r||!n?!1:n{if(!Ai(t.state,e)||!t6(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:yC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():bC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Q7=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-r.parentOffset-2);return!(a.index()===a.parent.childCount-1||((n=a.nodeAfter)==null?void 0:n.type.name)!==t)},vC=dn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Ex(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Ex(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Cx(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Cx(t,n,r)&&(e=!0)}),e}}}}),FN=/^(\s*)(\d+)\.\s+(.*)$/,X7=/^\s/;function Z7(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(w=>w.indent)),v=NC(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:v,raw:g.map(w=>w.raw).join(` -`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function ez(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(a=>{if(a.type==="paragraph"||a.type==="list"||a.type==="blockquote"||a.type==="code")r.push(...e.parseChildren([a]));else if(a.type==="text"&&a.tokens){const i=e.parseChildren([a]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([a]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var tz="listItem",BN="textStyle",VN=/^(\d+)\.\s$/,wC=wn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",St(this.options.HTMLAttributes,n),0]:["ol",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?ez(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const a=t.split(` -`),[i,o]=Z7(a);if(i.length===0)return;const c=NC(i,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:c,raw:a.slice(0,o).join(` -`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tz,this.editor.getAttributes(BN)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Hl({find:VN,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Hl({find:VN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(BN)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),nz=/^\s*(\[([( |x])?\])\s$/,rz=wn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const a=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return F0(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const v=n();if(typeof v!="number")return!1;const w=y.doc.nodeAt(v);return y.setNodeMarkup(v,void 0,{...w==null?void 0:w.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{a.setAttribute(m,g)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,g])=>{a.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=yd(m,g),v=new Set(Object.keys(y)),w=this.options.HTMLAttributes;return f.forEach(N=>{v.has(N)||(N in w?a.setAttribute(N,w[N]):a.removeAttribute(N))}),Object.entries(y).forEach(([N,k])=>{k==null?N in w?a.setAttribute(N,w[N]):a.removeAttribute(N):a.setAttribute(N,k)}),f=v,!0}}}},addInputRules(){return[Hl({find:nz,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),sz=wn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=gx(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},a=gx(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});dn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(fC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(pC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(vC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(wC.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(rz.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(sz.configure(this.options.taskList)),t}});var HN=" ",az=" ",iz=wn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",St(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===HN||r[0].text===az)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?HN:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),oz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,lz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,cz=Fo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Vl({find:oz,type:this.type})]},addPasteRules(){return[Po({find:lz,type:this.type})]}}),dz=wn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),uz=Fo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",St(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const i=a[2].trim();return{type:"underline",raw:a[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function hz(t={}){return new Ut({view(e){return new fz(e,t)}})}class fz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let v=y.getBoundingClientRect(),w=m?v.bottom:v.top;m&&g&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let N=this.width/2*c;r={left:v.left,right:v.right,top:w-N,bottom:w+N}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*y}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=pS(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class on extends tt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return on.valid(r)?new on(r):tt.near(r)}content(){return Re.empty}eq(e){return e instanceof on&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new on(e.resolve(n.pos))}getBookmark(){return new X0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!pz(e)||!mz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&on.valid(e))return e;let a=e.pos,i=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){i=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;a+=n;let u=e.doc.resolve(a);if(on.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!qe.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(on.valid(c))return c}return null}}}on.prototype.visible=!1;on.findFrom=on.findGapCursorFrom;tt.jsonID("gapcursor",on);class X0{constructor(e){this.pos=e}map(e){return new X0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return on.valid(n)?new on(n):tt.near(n)}}function jC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function pz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||jC(a.type))return!0;if(a.inlineContent)return!1}}return!0}function mz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||jC(a.type))return!0;if(a.inlineContent)return!1}}return!0}function gz(){return new Ut({props:{decorations:vz,createSelectionBetween(t,e,n){return e.pos==n.pos&&on.valid(n)?new on(n):null},handleClick:yz,handleKeyDown:xz,handleDOMEvents:{beforeinput:bz}}})}const xz=A0({ArrowLeft:Zu("horiz",-1),ArrowRight:Zu("horiz",1),ArrowUp:Zu("vert",-1),ArrowDown:Zu("vert",1)});function Zu(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof Je){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=on.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new on(h))),!0):!1}}function yz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!on.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&qe.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new on(r))),!0)}function bz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof on))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=be.empty;for(let o=r.length-1;o>=0;o--)a=be.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Re(a,0,0));return i.setSelection(Je.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function vz(t){if(!(t.selection instanceof on))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pt.create(t.doc,[Tn.widget(t.selection.head,e,{key:"gapcursor"})])}var uf=200,_n=function(){};_n.prototype.append=function(e){return e.length?(e=_n.from(e),!this.length&&e||e.length=n?_n.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};_n.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};_n.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};_n.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var a=[];return this.forEach(function(i,o){return a.push(e(i,o))},n,r),a};_n.from=function(e){return e instanceof _n?e:e&&e.length?new kC(e):_n.empty};var kC=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,i){return a==0&&i==this.length?this:new e(this.values.slice(a,i))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,i,o,c){for(var u=i;u=o;u--)if(a(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=uf)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=uf)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(_n);_n.empty=new kC([]);var Nz=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(a-c,0),Math.min(this.length,i)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,i,o){var c=this.left.length;if(a>c&&this.right.forEachInvertedInner(r,a-c,Math.max(i,c)-c,o+c)===!1||i=i?this.right.slice(r-i,a-i):this.left.slice(r,i).append(this.right.slice(0,a-i))},e.prototype.leafAppend=function(r){var a=this.right.leafAppend(r);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(r){var a=this.left.leafPrepend(r);if(a)return new e(a,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(_n);const wz=500;class bs{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){a||(a=this.remapping(r,g+1),i=a.maps.length),i--,f.push(m);return}if(a){f.push(new oi(m.map));let y=m.step.map(a.slice(i)),v;y&&o.maybeStep(y).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],h.push(new oi(v,void 0,void 0,h.length+f.length))),i--,v&&a.appendMap(v,i)}else o.maybeStep(m.step);if(m.selection)return c=a?m.selection.map(a.slice(i)):m.selection,u=new bs(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,a){let i=[],o=this.eventCount,c=this.items,u=!a&&c.length?c.get(c.length-1):null;for(let f=0;fkz&&(c=jz(c,h),o-=h),new bs(c.append(i),o)}remapping(e,n){let r=new hd;return this.items.forEach((a,i)=>{let o=a.mirrorOffset!=null&&i-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new bs(this.items.append(e.map(n=>new oi(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},a);let u=n;this.items.forEach(g=>{let y=i.getMirror(--u);if(y==null)return;o=Math.min(o,y);let v=i.maps[y];if(g.step){let w=e.steps[y].invert(e.docs[y]),N=g.selection&&g.selection.map(i.slice(u+1,y));N&&c++,r.push(new oi(v,w,N))}else r.push(new oi(v))},a);let h=[];for(let g=n;gwz&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,a=[],i=0;return this.items.forEach((o,c)=>{if(c>=e)a.push(o),o.selection&&i++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&i++;let m=new oi(h.invert(),u,f),g,y=a.length-1;(g=a.length&&a[y].merge(m))?a[y]=g:a.push(m)}}else o.map&&r--},this.items.length,0),new bs(_n.from(a.reverse()),i)}}bs.empty=new bs(_n.empty,0);function jz(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let oi=class SC{constructor(e,n,r,a){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new SC(n.getMap().invert(),n,this.selection)}}};class hi{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const kz=20;function Sz(t,e,n,r){let a=n.getMeta(Co),i;if(a)return a.historyState;n.getMeta(Tz)&&(t=new hi(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Co))return o.getMeta(Co).redo?new hi(t.done.addTransform(n,void 0,r,uh(e)),t.undone,WN(n.mapping.maps),t.prevTime,t.prevComposition):new hi(t.done,t.undone.addTransform(n,void 0,r,uh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Cz(n,t.prevRanges)),h=o?Ng(t.prevRanges,n.mapping):WN(n.mapping.maps);return new hi(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,uh(e)),bs.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new hi(t.done.rebased(n,i),t.undone.rebased(n,i),Ng(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new hi(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ng(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Cz(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,a)=>{for(let i=0;i=e[i]&&(n=!0)}),n}function WN(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,a,i,o)=>e.push(i,o));return e}function Ng(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=Co.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=Ez(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const EC=CC(!1,!0),TC=CC(!0,!0);dn.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ut({key:new Yt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const o=i-a,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=i-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var Az=dn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[hz(this.options)]}});dn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ut({key:new Yt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return Pt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(a>=h&&a<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(a>=h&&a<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";i.push(Tn.node(h,h+u.nodeSize,{class:this.options.className}))}),Pt.create(t,i)}}})]}});var Iz=dn.create({name:"gapCursor",addProseMirrorPlugins(){return[gz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=jt(We(t,"allowGapCursor",n)))!=null?e:null}}}),KN="placeholder";function Rz(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Pz=dn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:KN,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${Rz(this.options.dataAttribute)}`:`data-${KN}`;return[new Ut({key:new Yt("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,i=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=a>=u&&a<=u+c.nodeSize,f=!c.isLeaf&&$f(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=Tn.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});i.push(g)}return this.options.includeChildren}),Pt.create(e,i)}}})]}});dn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ut({key:new Yt("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||I2(n.selection)||t.view.dragging?null:Pt.create(n.doc,[Tn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function qN({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var Oz=dn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Yt(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new Ut({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!qN({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!qN({node:o,types:r})}}})]}}),Dz=dn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>EC(t,e),redo:()=>({state:t,dispatch:e})=>TC(t,e)}},addProseMirrorPlugins(){return[Mz(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Lz=dn.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(i7.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(t7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(fC.configure(this.options.bulletList)),this.options.code!==!1&&a.push(c7.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(h7.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(f7.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(Az.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(Iz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(p7.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(m7.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(Dz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(g7.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(N7.configure(this.options.italic)),this.options.listItem!==!1&&a.push(pC.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(vC.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(hC.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(wC.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(iz.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(cz.configure(this.options.strike)),this.options.text!==!1&&a.push(dz.configure(this.options.text)),this.options.underline!==!1&&a.push(uz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(Oz.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),_z=Lz,zz=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,$z=wn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",St(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,i,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",h=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:i,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new V6({element:u,editor:c,node:a,getPos:i,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const y=i();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,y)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[G2({find:zz,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),Fz=$z;function Bz(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=W6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=a?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),v=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!v)return null;const w=c.pos-v.length,N=Array.from(v.matchAll(y)).pop();if(!N||N.input===void 0||N.index===void 0)return null;const k=N.input.slice(Math.max(0,N.index-1),N.index),C=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!C)return null;const E=w+N.index;let I=E+N[0].length;return u&&f.test(v.slice(I-1,I+1))&&(N[0]+=" ",I+=1),E=c.pos?{range:{from:E,to:I},query:N[0].slice(n.length),text:N[0]}:null}var Vz=new Yt("suggestion");function Hz({pluginKey:t=Vz,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:w=Bz,shouldShow:N}){let k;const C=y==null?void 0:y(),E=()=>{const L=e.state.selection.$anchor.pos,R=e.view.coordsAtPos(L),{top:D,right:_,bottom:te,left:K}=R;try{return new DOMRect(K,D,_-K,te-D)}catch{return null}},I=(L,R)=>R?()=>{const D=t.getState(e.state),_=D==null?void 0:D.decorationId,te=L.dom.querySelector(`[data-decoration-id="${_}"]`);return(te==null?void 0:te.getBoundingClientRect())||null}:E;function P(L,R){var D;try{const te=t.getState(L.state),K=te!=null&&te.decorationId?L.dom.querySelector(`[data-decoration-id="${te.decorationId}"]`):null,he={editor:e,range:(te==null?void 0:te.range)||{from:0,to:0},query:(te==null?void 0:te.query)||null,text:(te==null?void 0:te.text)||null,items:[],command:ge=>m({editor:e,range:(te==null?void 0:te.range)||{from:0,to:0},props:ge}),decorationNode:K,clientRect:I(L,K)};(D=C==null?void 0:C.onExit)==null||D.call(C,he)}catch{}const _=L.state.tr.setMeta(R,{exit:!0});L.dispatch(_)}const B=new Ut({key:t,view(){return{update:async(L,R)=>{var D,_,te,K,he,ge,z;const V=(D=this.key)==null?void 0:D.getState(R),U=(_=this.key)==null?void 0:_.getState(L.state),M=V.active&&U.active&&V.range.from!==U.range.from,q=!V.active&&U.active,F=V.active&&!U.active,O=!q&&!F&&V.query!==U.query,W=q||M&&O,ie=O||M,J=F||M&&O;if(!W&&!ie&&!J)return;const X=J&&!W?V:U,G=L.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);k={editor:e,range:X.range,query:X.query,text:X.text,items:[],command:se=>m({editor:e,range:X.range,props:se}),decorationNode:G,clientRect:I(L,G)},W&&((te=C==null?void 0:C.onBeforeStart)==null||te.call(C,k)),ie&&((K=C==null?void 0:C.onBeforeUpdate)==null||K.call(C,k)),(ie||W)&&(k.items=await g({editor:e,query:X.query})),J&&((he=C==null?void 0:C.onExit)==null||he.call(C,k)),ie&&((ge=C==null?void 0:C.onUpdate)==null||ge.call(C,k)),W&&((z=C==null?void 0:C.onStart)==null||z.call(C,k))},destroy:()=>{var L;k&&((L=C==null?void 0:C.onExit)==null||L.call(C,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(L,R,D,_){const{isEditable:te}=e,{composing:K}=e.view,{selection:he}=L,{empty:ge,from:z}=he,V={...R},U=L.getMeta(t);if(U&&U.exit)return V.active=!1,V.decorationId=null,V.range={from:0,to:0},V.query=null,V.text=null,V;if(V.composing=K,te&&(ge||e.view.composing)){(zR.range.to)&&!K&&!R.composing&&(V.active=!1);const M=w({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:he.$from}),q=`id_${Math.floor(Math.random()*4294967295)}`;M&&v({editor:e,state:_,range:M.range,isActive:R.active})&&(!N||N({editor:e,range:M.range,query:M.query,text:M.text,transaction:L}))?(V.active=!0,V.decorationId=R.decorationId?R.decorationId:q,V.range=M.range,V.query=M.query,V.text=M.text):V.active=!1}else V.active=!1;return V.active||(V.decorationId=null,V.range={from:0,to:0},V.query=null,V.text=null),V}},props:{handleKeyDown(L,R){var D,_,te,K;const{active:he,range:ge}=B.getState(L.state);if(!he)return!1;if(R.key==="Escape"||R.key==="Esc"){const V=B.getState(L.state),U=(D=k==null?void 0:k.decorationNode)!=null?D:null,M=U??(V!=null&&V.decorationId?L.dom.querySelector(`[data-decoration-id="${V.decorationId}"]`):null);if(((_=C==null?void 0:C.onKeyDown)==null?void 0:_.call(C,{view:L,event:R,range:V.range}))||!1)return!0;const F={editor:e,range:V.range,query:V.query,text:V.text,items:[],command:O=>m({editor:e,range:V.range,props:O}),decorationNode:M,clientRect:M?()=>M.getBoundingClientRect()||null:null};return(te=C==null?void 0:C.onExit)==null||te.call(C,F),P(L,t),!0}return((K=C==null?void 0:C.onKeyDown)==null?void 0:K.call(C,{view:L,event:R,range:ge}))||!1},decorations(L){const{active:R,range:D,decorationId:_,query:te}=B.getState(L);if(!R)return null;const K=!(te!=null&&te.length),he=[u];return K&&he.push(f),Pt.create(L.doc,[Tn.inline(D.from,D.to,{nodeName:c,class:he.join(" "),"data-decoration-id":_,"data-decoration-content":h})])}}});return B}function Wz({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new Yt;return{editor:t,char:r,pluginKey:a,command:({editor:i,range:o,props:c})=>{var u,h,f;const m=i.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=i.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:i,range:o})=>{const c=i.doc.resolve(o.from),u=i.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function MC(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Wz({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function GN(t,e){const n=MC(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var Uz=wn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,a;return["span",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(a=e.attrs.label)!=null?a:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=GN(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...J2({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r,c=i??o;e[a==="char"?"mentionSuggestionChar":a]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:GN(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:a,anchor:i}=r;if(!a)return!1;let o=new Sa,c=0;return e.doc.nodesBetween(i-1,i,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return MC(this).map(Hz)}}),Kz=Uz,qz=Pz;let Tx,Mx;if(typeof WeakMap<"u"){let t=new WeakMap;Tx=e=>t.get(e),Mx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Tx=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var cn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:k-E});break}const I=a+E*e;for(let P=0;Pr&&(i+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Yz(t,e,n){t.problems||(t.problems=[]);const r={};for(let a=0;a0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Xz(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Cs(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Hf(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Oo(e.$head)||Zz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Zz(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Ax(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function e$(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Z0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function AC(t,e,n){const r=t.node(-1),a=cn.get(r),i=t.start(-1),o=a.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function Do(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(a=>a>0)||(r.colwidth=null)),r}function IC(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let a=0;af!=n.pos-i);u.unshift(n.pos-i);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i+f+1;return new bS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(Ax(r)&&Ax(a)&&Z0(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ya.rowSelection(r,a):i&&this.isColSelection()?ya.colSelection(r,a):new ya(r,a)}return Je.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=cn.get(e),r=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=a.top;u0||N>0){let k=v.attrs;if(w>0&&(k=Do(k,0,w)),N>0&&(k=Do(k,k.colspan-N,N)),y.lefta.bottom){const k={...v.attrs,rowspan:Math.min(y.bottom,a.bottom)-Math.max(y.top,a.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),a=cn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(i+a.map[o.left])),c.bottom0&&(n=u.resolve(i+a.map[c.left])),o.bottom0)return!1;const o=a+this.$anchorCell.nodeAfter.attrs.colspan,c=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof ya&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=cn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(i+a.map[o.top*a.width])),c.right0&&(n=u.resolve(i+a.map[c.top*a.width])),o.right{e.push(Tn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Pt.create(t.doc,e)}function s$({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(a+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(a).type.spec.tableRole)}function a$({$from:t,$to:e}){let n,r;for(let a=t.depth;a>0;a--){const i=t.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let a=e.depth;a>0;a--){const i=e.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function i$(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof qe&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=Wt.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=Wt.rowSelection(c,c)}else if(!n){const c=cn.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=Wt.create(a,u+1,h)}}else r instanceof Je&&s$(r)?i=Je.create(a,r.from):r instanceof Je&&a$(r)&&(i=Je.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const o$=new Yt("fix-tables");function PC(t,e,n,r){const a=t.childCount,i=e.childCount;e:for(let o=0,c=0;o{a.type.spec.tableRole=="table"&&(n=l$(t,a,i,n))};return e?e.doc!=t.doc&&PC(e.doc,t.doc,0,r):t.doc.descendants(r),n}function l$(t,e,n,r){const a=cn.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let y="cell";f.firstChild&&(y=f.firstChild.type.spec.tableRole);const v=[];for(let N=0;N0?-1:0;t$(e,r,a+i)&&(i=a==0||a==e.width?null:0);for(let o=0;o0&&a0&&e.map[c-1]==u||a0?-1:0;f$(e,r,a+c)&&(c=a==0||a==e.height?null:0);for(let h=0,f=e.width*a;h0&&a0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(a0&&n[i]==n[i-1]||r.right0&&n[a]==n[a-t]||r.bottom0){const f=u+1+h.content.size,m=JN(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new Wt(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function QN(t,e){const n=ar(t.schema);return b$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function b$(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof Wt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=Xz(r.$from),!a)return!1;i=(o=Oo(r.$from))===null||o===void 0?void 0:o.pos}if(a==null||i==null||a.attrs.colspan==1&&a.attrs.rowspan==1)return!1;if(n){let c=a.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Js(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&i.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function N$(t){return function(e,n){if(!Cs(e))return!1;if(n){const r=ar(e.schema),a=Js(e),i=e.tr,o=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),c=o.map(u=>a.table.nodeAt(u));for(let u=0;u{const y=g+i.tableStart,v=o.doc.nodeAt(y);v&&o.setNodeMarkup(y,m,v.attrs)}),r(o)}return!0}}Nd("row",{useDeprecatedLogic:!0});Nd("column",{useDeprecatedLogic:!0});const w$=Nd("cell",{useDeprecatedLogic:!0});function j$(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,a=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return a-1-o.nodeSize;a-=i.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function eh(t,e){const n=t.selection;if(!(n instanceof Wt))return!1;if(e){const r=t.tr,a=ar(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(a)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new Re(a,0,0))}),r.docChanged&&e(r)}return!0}function S$(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const a=e.child(0),i=a.type.spec.tableRole,o=a.type.schema,c=[];if(i=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=i.child(o).attrs;for(let h=a;h=e.length&&e.push(be.empty),n[a]r&&(g=g.type.createChecked(Do(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;ya&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(be.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function T$(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=ar(c);let h,f;if(a>e.width)for(let m=0,g=0;me.height){const m=[];for(let v=0,w=(e.height-1)*e.width;v=e.width?!1:n.nodeAt(e.map[w+v]).type==u.header_cell;m.push(N?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,be.from(m)),y=[];for(let v=e.height;v{if(!a)return!1;const i=n.selection;if(i instanceof Wt)return hh(n,r,tt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=_C(a,t,e);if(o==null)return!1;if(t=="horiz")return hh(n,r,tt.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=AC(c,t,e);let h;return u?h=tt.near(u,1):e<0?h=tt.near(n.doc.resolve(c.before(-1)),-1):h=tt.near(n.doc.resolve(c.after(-1)),1),hh(n,r,h)}}}function nh(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof Wt)o=i;else{const u=_C(a,t,e);if(u==null)return!1;o=new Wt(n.doc.resolve(u))}const c=AC(o.$headCell,t,e);return c?hh(n,r,new Wt(o.$anchorCell,c)):!1}}function A$(t,e){const n=t.state.doc,r=Oo(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Wt(r))),!0):!1}function I$(t,e,n){if(!Cs(t.state))return!1;let r=S$(n);const a=t.state.selection;if(a instanceof Wt){r||(r={width:1,height:1,rows:[be.from(Ix(ar(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=cn.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=E$(r,c.right-c.left,c.bottom-c.top),nw(t.state,t.dispatch,o,c,r),!0}else if(r){const i=Hf(t.state),o=i.start(-1);return nw(t.state,t.dispatch,o,cn.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function R$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=rw(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof Wt)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=Oo(t.state.selection.$anchor))!=null&&((n=jg(t,e))===null||n===void 0?void 0:n.pos)!=a.pos)i(a,e),e.preventDefault();else if(!r)return;function i(u,h){let f=jg(t,h);const m=mi.getState(t.state)==null;if(!f||!Z0(u,f))if(m)f=u;else return;const g=new Wt(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(mi,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),mi.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(mi,-1))}function c(u){const h=u,f=mi.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(rw(t,h.target)!=r&&(m=jg(t,e),!m))return o();m&&i(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function _C(t,e,n){if(!(t.state.selection instanceof Je))return null;const{$head:r}=t.state.selection;for(let a=r.depth-1;a>=0;a--){const i=r.node(a);if((n<0?r.index(a):r.indexAfter(a))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(a),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function rw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function jg(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:a}=n;return r>=0&&Oo(t.state.doc.resolve(r))||Oo(t.state.doc.resolve(a))}var P$=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Rx(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Rx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Rx(t,e,n,r,a,i){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new D$(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=zr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{L$(o,c,t,a)},mouseleave:o=>{_$(o)},mousedown:(o,c)=>{z$(o,c,e,n)}},decorations:o=>{const c=zr.getState(o);if(c&&c.activeHandle>-1)return H$(o,c.activeHandle)},nodeViews:{}}});return i}var D$=class fh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(zr);if(r&&r.setHandle!=null)return new fh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new fh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return Ax(e.doc.resolve(a))||(a=-1),new fh(a,n.dragging)}return n}};function L$(t,e,n,r){if(!t.editable)return;const a=zr.getState(t.state);if(a&&!a.dragging){const i=F$(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=sw(t,e,"left",n):u-e.clientX<=n&&(o=sw(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=cn.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}zC(t,o)}}}function _$(t){if(!t.editable)return;const e=zr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&zC(t,-1)}function z$(t,e,n,r){var a;if(!t.editable)return!1;const i=(a=t.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,o=zr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=$$(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(zr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const g=zr.getState(t.state);g!=null&&g.dragging&&(B$(t,g.activeHandle,aw(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(zr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=zr.getState(t.state);if(g&&g.dragging){const y=aw(g.dragging,m,n);iw(t,g.activeHandle,y,r)}}return iw(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function $$(t,e,{colspan:n,colwidth:r}){const a=r&&r[r.length-1];if(a)return a;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),a=r?r.split(",").map(i=>parseInt(i,10)):null;if(!a){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const c=i[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return a}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",St(this.options.HTMLAttributes,t),0]}}),FC=wn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",St(this.options.HTMLAttributes,t),0]}}),BC=wn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}});function Px(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function ow(t,e,n,r,a,i){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,y=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function G$(t,e,n,r,a){const i=q$(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!J$(e))return!1;let n=0;const r=j2(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Y$="";function Q$(t){return(t||"").replace(/\s+/g," ").trim()}function X$(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:Y$;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(v=>{const w=[];v.content&&v.content.forEach(N=>{let k="";N.content&&Array.isArray(N.content)&&N.content.length>1?k=N.content.map(P=>e.renderChildren(P)).join(a):k=N.content?e.renderChildren(N.content):"";const C=Q$(k),E=N.type==="tableHeader";w.push({text:C,isHeader:E})}),i.push(w)});const o=i.reduce((v,w)=>Math.max(v,w.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(v=>{var w;for(let N=0;Nc[N]&&(c[N]=C),c[N]<3&&(c[N]=3)}});const u=(v,w)=>v+" ".repeat(Math.max(0,w-v.length)),h=i[0],f=h.some(v=>v.isHeader);let m=` -`;const g=new Array(o).fill(0).map((v,w)=>f&&h[w]&&h[w].text||"");return m+=`| ${g.map((v,w)=>u(v,c[w])).join(" | ")} | -`,m+=`| ${c.map(v=>"-".repeat(Math.max(3,v))).join(" | ")} | -`,(f?i.slice(1):i).forEach(v=>{m+=`| ${new Array(o).fill(0).map((w,N)=>u(v[N]&&v[N].text||"",c[N])).join(" | ")} | -`}),m}var Z$=X$,VC=wn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:U$,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:a}=K$(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",St(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(a=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const a=[];r.forEach(i=>{a.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},a))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>Z$(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=G$(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Je.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>c$(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>d$(t,e),deleteColumn:()=>({state:t,dispatch:e})=>h$(t,e),addRowBefore:()=>({state:t,dispatch:e})=>p$(t,e),addRowAfter:()=>({state:t,dispatch:e})=>m$(t,e),deleteRow:()=>({state:t,dispatch:e})=>x$(t,e),deleteTable:()=>({state:t,dispatch:e})=>k$(t,e),mergeCells:()=>({state:t,dispatch:e})=>YN(t,e),splitCell:()=>({state:t,dispatch:e})=>QN(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Nd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Nd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>w$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>YN(t,e)?!0:QN(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>v$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>ZN(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ZN(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&OC(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Wt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:rh,"Mod-Backspace":rh,Delete:rh,"Mod-Delete":rh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[O$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],W$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:jt(We(t,"tableRole",e))}}});dn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(VC.configure(this.options.table)),this.options.tableCell!==!1&&t.push($C.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(FC.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(BC.configure(this.options.tableRow)),t}});function hf(t){return(t||"").trim().toLowerCase()}function eF(t){return[t.name,...t.aliases?t.aliases.split(","):[]].map(hf).filter(Boolean)}function tF(t){return[t.label,...t.aliases?t.aliases.split(","):[]].map(hf).filter(Boolean)}function kg(t,e,n){if(!t||!e.length&&!n.length||typeof document>"u")return t;const r=new Map,a=new Map;for(const u of e)for(const h of eF(u))r.has(h)||r.set(h,u);for(const u of n)for(const h of tF(u))a.has(h)||a.set(h,u);const i=document.createElement("div");i.innerHTML=t;const o=u=>{const h=u.textContent||"";if(!h||!h.includes("@")&&!h.includes("@")&&!h.includes("#"))return;const f=u.parentNode;if(!f)return;const m=document.createDocumentFragment(),g=/([@@][^\s@#@#]+|#[^\s@#@#]+)/g;let y=0,v;for(;(v=g.exec(h))!==null;){const[w]=v,N=v.index;if(N>y&&m.appendChild(document.createTextNode(h.slice(y,N))),w.startsWith("@")||w.startsWith("@")){const k=r.get(hf(w.slice(1)));if(k){const C=document.createElement("span");C.setAttribute("data-type","mention"),C.setAttribute("data-id",k.id),C.setAttribute("data-label",k.name),C.className="mention-tag",C.textContent=`@${k.name}`,m.appendChild(C)}else m.appendChild(document.createTextNode(w))}else{const k=a.get(hf(w.slice(1)));if(k){const C=document.createElement("span");C.setAttribute("data-type","linkTag"),C.setAttribute("data-url",k.url||""),C.setAttribute("data-tag-type",k.type||"url"),C.setAttribute("data-tag-id",k.id||""),C.setAttribute("data-page-path",k.pagePath||""),C.setAttribute("data-app-id",k.appId||""),k.type==="miniprogram"&&k.appId&&C.setAttribute("data-mp-key",k.appId),C.className="link-tag-node",C.textContent=`#${k.label}`,m.appendChild(C)}else m.appendChild(document.createTextNode(w))}y=N+w.length}y{if(u.nodeType===globalThis.Node.ELEMENT_NODE){const h=u;if(h.matches('[data-type="mention"], [data-type="linkTag"], a, code, pre, script, style'))return;Array.from(h.childNodes).forEach(c);return}u.nodeType===globalThis.Node.TEXT_NODE&&o(u)};return Array.from(i.childNodes).forEach(c),i.innerHTML}function nF(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 - -`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 - -`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 - -`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 - -`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 -`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` -`),e=e.replace(//gi,` -`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 - -`),e=e.replace(//gi,`--- - -`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` - -`),e.trim()}function cw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),e=e.replace(/^## (.+)$/gm,"

$1

"),e=e.replace(/^# (.+)$/gm,"

$1

"),e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/__(.+?)__/g,"$1"),e=e.replace(new RegExp("(?$1"),e=e.replace(new RegExp("(?$1"),e=e.replace(/~~(.+?)~~/g,"$1"),e=e.replace(/`([^`]+)`/g,"$1"),e=e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'$1'),e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1'),e=e.replace(/^> (.+)$/gm,"

$1

"),e=e.replace(/^---$/gm,"
"),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` -`),r=[];for(const a of n){const i=a.trim();i&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(i)?r.push(i):r.push(`

    ${i}

    `))}return r.join("")}const rF=wn.create({name:"linkTag",group:"inline",inline:!0,selectable:!0,atom:!0,addAttributes(){return{label:{default:""},url:{default:""},tagType:{default:"url",parseHTML:t=>t.getAttribute("data-tag-type")||"url"},tagId:{default:"",parseHTML:t=>t.getAttribute("data-tag-id")||""},pagePath:{default:"",parseHTML:t=>t.getAttribute("data-page-path")||""},appId:{default:"",parseHTML:t=>t.getAttribute("data-app-id")||""},mpKey:{default:"",parseHTML:t=>t.getAttribute("data-mp-key")||""}}},parseHTML(){return[{tag:'span[data-type="linkTag"]',getAttrs:t=>{var e;return{label:((e=t.textContent)==null?void 0:e.replace(/^#/,"").trim())||"",url:t.getAttribute("data-url")||"",tagType:t.getAttribute("data-tag-type")||"url",tagId:t.getAttribute("data-tag-id")||"",pagePath:t.getAttribute("data-page-path")||"",appId:t.getAttribute("data-app-id")||"",mpKey:t.getAttribute("data-mp-key")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",St(e,{"data-type":"linkTag","data-url":t.attrs.url,"data-tag-type":t.attrs.tagType,"data-tag-id":t.attrs.tagId,"data-page-path":t.attrs.pagePath,"data-app-id":t.attrs.appId||"","data-mp-key":t.attrs.mpKey||t.attrs.appId||"",class:"link-tag-node"}),`#${t.attrs.label}`]}}),sF=(t,e)=>({items:({query:n})=>{const r=t.current||[],a=n.toLowerCase().trim(),i=r.filter(o=>o.name.toLowerCase().includes(a)||o.id.includes(a)?!0:o.aliases?o.aliases.split(",").some(c=>c.trim().toLowerCase().includes(a)):!1).slice(0,8);return a.length>=1&&!r.some(o=>o.name.toLowerCase()===a)&&i.push({id:"__new__",name:`+ 新增「${n.trim()}」`,_newName:n.trim()}),i},render:()=>{let n=null,r=0,a=[],i=null;const o=async u=>{const h=a[u];if(!h||!i)return;const f=h;if(f.id==="__new__"&&f._newName&&e.current)try{const m=await e.current(f._newName);m&&i({id:m.id,label:m.name})}catch{}else i({id:h.id,label:h.name})},c=()=>{n&&(n.innerHTML=a.map((u,h)=>`
    - @${u.name} - ${u.id==="__new__"?"":u.label||u.id} -
    `).join(""),n.querySelectorAll(".mention-item").forEach(u=>{u.addEventListener("click",()=>{const h=parseInt(u.getAttribute("data-index")||"0");o(h)})}))};return{onStart:u=>{if(n=document.createElement("div"),n.className="mention-popup",document.body.appendChild(n),a=u.items,i=u.command,r=0,c(),u.clientRect){const h=u.clientRect();h&&(n.style.top=`${h.bottom+4}px`,n.style.left=`${h.left}px`)}},onUpdate:u=>{if(a=u.items,i=u.command,r=0,c(),u.clientRect&&n){const h=u.clientRect();h&&(n.style.top=`${h.bottom+4}px`,n.style.left=`${h.left}px`)}},onKeyDown:u=>u.event.key==="ArrowUp"?(r=Math.max(0,r-1),c(),!0):u.event.key==="ArrowDown"?(r=Math.min(a.length-1,r+1),c(),!0):u.event.key==="Enter"?(o(r),!0):u.event.key==="Escape"?(n==null||n.remove(),n=null,!0):!1,onExit:()=>{n==null||n.remove(),n=null}}}}),Ox=b.forwardRef(({content:t,onChange:e,onImageUpload:n,onVideoUpload:r,persons:a=[],linkTags:i=[],onPersonCreate:o,placeholder:c="开始编辑内容...",className:u},h)=>{const f=b.useRef(null),m=b.useRef(null),[g,y]=b.useState(!1),[v,w]=b.useState(""),[N,k]=b.useState(!1),[C,E]=b.useState(!1),[I,P]=b.useState(0),B=b.useRef(kg(cw(t),a,i)),L=b.useRef(e);L.current=e;const R=b.useRef(a);R.current=a;const D=b.useRef(i);D.current=i;const _=b.useRef(o);_.current=o;const te=b.useRef(),K=Y_({extensions:[_z,Fz.configure({inline:!0,allowBase64:!0}),K7.configure({openOnClick:!1,HTMLAttributes:{class:"rich-link"}}),Kz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:{...sF(R,_),allowedPrefixes:null}}),rF,qz.configure({placeholder:c}),VC.configure({resizable:!0}),BC,$C,FC],content:B.current,onUpdate:({editor:M})=>{te.current&&clearTimeout(te.current),te.current=setTimeout(()=>{const q=M.getHTML(),F=kg(q,R.current||[],D.current||[]);if(F!==q){M.commands.setContent(F,{emitUpdate:!1}),L.current(F);return}L.current(q)},300)},editorProps:{attributes:{class:"rich-editor-content"}}});b.useImperativeHandle(h,()=>({getHTML:()=>(K==null?void 0:K.getHTML())||"",getMarkdown:()=>nF((K==null?void 0:K.getHTML())||"")})),b.useEffect(()=>{if(!K)return;const M=kg(cw(t),R.current||[],D.current||[]);M!==K.getHTML()&&K.commands.setContent(M,{emitUpdate:!1})},[t,K,a,i]);const he=b.useCallback(async M=>{var F;const q=(F=M.target.files)==null?void 0:F[0];if(!(!q||!K)){if(n){E(!0),P(10);const O=setInterval(()=>{P(W=>Math.min(W+15,90))},300);try{const W=await n(q);clearInterval(O),P(100),W&&K.chain().focus().setImage({src:W}).run()}finally{clearInterval(O),setTimeout(()=>{E(!1),P(0)},500)}}else{const O=new FileReader;O.onload=()=>{typeof O.result=="string"&&K.chain().focus().setImage({src:O.result}).run()},O.readAsDataURL(q)}M.target.value=""}},[K,n]),ge=b.useCallback(async M=>{var F;const q=(F=M.target.files)==null?void 0:F[0];if(!(!q||!K)){if(r){y(!0),P(5);const O=setInterval(()=>{P(W=>Math.min(W+8,90))},500);try{const W=await r(q);clearInterval(O),P(100),W&&K.chain().focus().insertContent(`

    `).run()}finally{clearInterval(O),setTimeout(()=>{y(!1),P(0)},500)}}M.target.value=""}},[K,r]),z=b.useCallback(()=>{K&&K.chain().focus().insertContent("@").run()},[K]),V=b.useCallback(M=>{K&&K.chain().focus().insertContent({type:"linkTag",attrs:{label:M.label,url:M.url||"",tagType:M.type||"url",tagId:M.id||"",pagePath:M.pagePath||"",appId:M.appId||"",mpKey:M.type==="miniprogram"&&M.appId||""}}).run()},[K]),U=b.useCallback(()=>{!K||!v||(K.chain().focus().setLink({href:v}).run(),w(""),k(!1))},[K,v]);return K?s.jsxs("div",{className:`rich-editor-wrapper ${u||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>K.chain().focus().toggleBold().run(),className:K.isActive("bold")?"is-active":"",type:"button",children:s.jsx(WT,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().toggleItalic().run(),className:K.isActive("italic")?"is-active":"",type:"button",children:s.jsx(UM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().toggleStrike().run(),className:K.isActive("strike")?"is-active":"",type:"button",children:s.jsx(VA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().toggleCode().run(),className:K.isActive("code")?"is-active":"",type:"button",children:s.jsx(uM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>K.chain().focus().toggleHeading({level:1}).run(),className:K.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(DM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().toggleHeading({level:2}).run(),className:K.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(_M,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().toggleHeading({level:3}).run(),className:K.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx($M,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>K.chain().focus().toggleBulletList().run(),className:K.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(eA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().toggleOrderedList().run(),className:K.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(XM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().toggleBlockquote().run(),className:K.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(EA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(uA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:he,className:"hidden"}),s.jsx("button",{onClick:()=>{var M;return(M=f.current)==null?void 0:M.click()},type:"button",title:"插入图片",children:s.jsx(ej,{className:"w-4 h-4"})}),s.jsx("input",{ref:m,type:"file",accept:"video/mp4,video/quicktime,video/webm,.mp4,.mov,.webm",onChange:ge,className:"hidden"}),s.jsx("button",{onClick:()=>{var M;return(M=m.current)==null?void 0:M.click()},disabled:g||!r,type:"button",title:"插入视频",className:g?"opacity-50":"",children:s.jsx(r5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>k(!N),className:K.isActive("link")?"is-active":"",type:"button",title:"插入链接",children:s.jsx(Fg,{className:"w-4 h-4"})}),s.jsx("button",{onClick:z,type:"button",title:"@ 指定人物",className:"mention-trigger-btn",children:s.jsx(BT,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:s.jsx(WA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>K.chain().focus().undo().run(),disabled:!K.can().undo(),type:"button",children:s.jsx(QA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>K.chain().focus().redo().run(),disabled:!K.can().redo(),type:"button",children:s.jsx(MA,{className:"w-4 h-4"})})]}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"toolbar-divider"}),s.jsx("div",{className:"toolbar-group",children:s.jsxs("select",{className:"link-tag-select",onChange:M=>{const q=i.find(F=>F.id===M.target.value);q&&V(q),M.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(M=>s.jsx("option",{value:M.id,children:M.label},M.id))]})})]})]}),N&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:v,onChange:M=>w(M.target.value),onKeyDown:M=>M.key==="Enter"&&U(),className:"link-input"}),s.jsx("button",{onClick:U,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{K.chain().focus().unsetLink().run(),k(!1)},className:"link-remove",type:"button",children:"移除"})]}),(C||g)&&s.jsxs("div",{className:"upload-progress-bar",children:[s.jsx("div",{className:"upload-progress-track",children:s.jsx("div",{className:"upload-progress-fill",style:{width:`${I}%`}})}),s.jsxs("span",{className:"upload-progress-text",children:[g?"视频":"图片","上传中 ",I,"%"]})]}),s.jsx(X2,{editor:K})]}):null});Ox.displayName="RichEditor";const aF=["top","right","bottom","left"],Ii=Math.min,Lr=Math.max,ff=Math.round,sh=Math.floor,Us=t=>({x:t,y:t}),iF={left:"right",right:"left",bottom:"top",top:"bottom"},oF={start:"end",end:"start"};function Dx(t,e,n){return Lr(t,Ii(e,n))}function Ma(t,e){return typeof t=="function"?t(e):t}function Aa(t){return t.split("-")[0]}function Zl(t){return t.split("-")[1]}function ey(t){return t==="x"?"y":"x"}function ty(t){return t==="y"?"height":"width"}const lF=new Set(["top","bottom"]);function Ws(t){return lF.has(Aa(t))?"y":"x"}function ny(t){return ey(Ws(t))}function cF(t,e,n){n===void 0&&(n=!1);const r=Zl(t),a=ny(t),i=ty(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=pf(o)),[o,pf(o)]}function dF(t){const e=pf(t);return[Lx(t),e,Lx(e)]}function Lx(t){return t.replace(/start|end/g,e=>oF[e])}const dw=["left","right"],uw=["right","left"],uF=["top","bottom"],hF=["bottom","top"];function fF(t,e,n){switch(t){case"top":case"bottom":return n?e?uw:dw:e?dw:uw;case"left":case"right":return e?uF:hF;default:return[]}}function pF(t,e,n,r){const a=Zl(t);let i=fF(Aa(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(Lx)))),i}function pf(t){return t.replace(/left|right|bottom|top/g,e=>iF[e])}function mF(t){return{top:0,right:0,bottom:0,left:0,...t}}function HC(t){return typeof t!="number"?mF(t):{top:t,right:t,bottom:t,left:t}}function mf(t){const{x:e,y:n,width:r,height:a}=t;return{width:r,height:a,top:n,left:e,right:e+r,bottom:n+a,x:e,y:n}}function hw(t,e,n){let{reference:r,floating:a}=t;const i=Ws(e),o=ny(e),c=ty(o),u=Aa(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=r[c]/2-a[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-a.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-a.width,y:m};break;default:y={x:r.x,y:r.y}}switch(Zl(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function gF(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:i,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Ma(e,t),v=HC(y),N=c[g?m==="floating"?"reference":"floating":m],k=mf(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(N)))==null||n?N:N.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),C=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),I=await(i.isElement==null?void 0:i.isElement(E))?await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1}:{x:1,y:1},P=mf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:C,offsetParent:E,strategy:u}):C);return{top:(k.top-P.top+v.top)/I.y,bottom:(P.bottom-k.bottom+v.bottom)/I.y,left:(k.left-P.left+v.left)/I.x,right:(P.right-k.right+v.right)/I.x}}const xF=async(t,e,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,c=i.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:a}),{x:f,y:m}=hw(h,r,u),g=r,y={},v=0;for(let N=0;N({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Ma(t,e)||{};if(h==null)return{};const m=HC(f),g={x:n,y:r},y=ny(a),v=ty(y),w=await o.getDimensions(h),N=y==="y",k=N?"top":"left",C=N?"bottom":"right",E=N?"clientHeight":"clientWidth",I=i.reference[v]+i.reference[y]-g[y]-i.floating[v],P=g[y]-i.reference[y],B=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let L=B?B[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(B)))&&(L=c.floating[E]||i.floating[v]);const R=I/2-P/2,D=L/2-w[v]/2-1,_=Ii(m[k],D),te=Ii(m[C],D),K=_,he=L-w[v]-te,ge=L/2-w[v]/2+R,z=Dx(K,ge,he),V=!u.arrow&&Zl(a)!=null&&ge!==z&&i.reference[v]/2-(gege<=0)){var te,K;const ge=(((te=i.flip)==null?void 0:te.index)||0)+1,z=L[ge];if(z&&(!(m==="alignment"?C!==Ws(z):!1)||_.every(M=>Ws(M.placement)===C?M.overflows[0]>0:!0)))return{data:{index:ge,overflows:_},reset:{placement:z}};let V=(K=_.filter(U=>U.overflows[0]<=0).sort((U,M)=>U.overflows[1]-M.overflows[1])[0])==null?void 0:K.placement;if(!V)switch(y){case"bestFit":{var he;const U=(he=_.filter(M=>{if(B){const q=Ws(M.placement);return q===C||q==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(q=>q>0).reduce((q,F)=>q+F,0)]).sort((M,q)=>M[1]-q[1])[0])==null?void 0:he[0];U&&(V=U);break}case"initialPlacement":V=c;break}if(a!==V)return{reset:{placement:V}}}return{}}}};function fw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function pw(t){return aF.some(e=>t[e]>=0)}const vF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Ma(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=fw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:pw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=fw(o,n.floating);return{data:{escapedOffsets:c,escaped:pw(c)}}}default:return{}}}}},WC=new Set(["left","top"]);async function NF(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Aa(n),c=Zl(n),u=Ws(n)==="y",h=WC.has(o)?-1:1,f=i&&u?-1:1,m=Ma(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const wF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:a,y:i,placement:o,middlewareData:c}=e,u=await NF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:a+u.x,y:i+u.y,data:{...u,placement:o}}}}},jF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a,platform:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:C,y:E}=k;return{x:C,y:E}}},...h}=Ma(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=Ws(Aa(a)),y=ey(g);let v=f[y],w=f[g];if(o){const k=y==="y"?"top":"left",C=y==="y"?"bottom":"right",E=v+m[k],I=v-m[C];v=Dx(E,v,I)}if(c){const k=g==="y"?"top":"left",C=g==="y"?"bottom":"right",E=w+m[k],I=w-m[C];w=Dx(E,w,I)}const N=u.fn({...e,[y]:v,[g]:w});return{...N,data:{x:N.x-n,y:N.y-r,enabled:{[y]:o,[g]:c}}}}}},kF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:a,rects:i,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Ma(t,e),f={x:n,y:r},m=Ws(a),g=ey(m);let y=f[g],v=f[m];const w=Ma(c,e),N=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const E=g==="y"?"height":"width",I=i.reference[g]-i.floating[E]+N.mainAxis,P=i.reference[g]+i.reference[E]-N.mainAxis;yP&&(y=P)}if(h){var k,C;const E=g==="y"?"width":"height",I=WC.has(Aa(a)),P=i.reference[m]-i.floating[E]+(I&&((k=o.offset)==null?void 0:k[m])||0)+(I?0:N.crossAxis),B=i.reference[m]+i.reference[E]+(I?0:((C=o.offset)==null?void 0:C[m])||0)-(I?N.crossAxis:0);vB&&(v=B)}return{[g]:y,[m]:v}}}},SF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:a,rects:i,platform:o,elements:c}=e,{apply:u=()=>{},...h}=Ma(t,e),f=await o.detectOverflow(e,h),m=Aa(a),g=Zl(a),y=Ws(a)==="y",{width:v,height:w}=i.floating;let N,k;m==="top"||m==="bottom"?(N=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,N=g==="end"?"top":"bottom");const C=w-f.top-f.bottom,E=v-f.left-f.right,I=Ii(w-f[N],C),P=Ii(v-f[k],E),B=!e.middlewareData.shift;let L=I,R=P;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=C),B&&!g){const _=Lr(f.left,0),te=Lr(f.right,0),K=Lr(f.top,0),he=Lr(f.bottom,0);y?R=v-2*(_!==0||te!==0?_+te:Lr(f.left,f.right)):L=w-2*(K!==0||he!==0?K+he:Lr(f.top,f.bottom))}await u({...e,availableWidth:R,availableHeight:L});const D=await o.getDimensions(c.floating);return v!==D.width||w!==D.height?{reset:{rects:!0}}:{}}}};function Wf(){return typeof window<"u"}function ec(t){return UC(t)?(t.nodeName||"").toLowerCase():"#document"}function Br(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ys(t){var e;return(e=(UC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function UC(t){return Wf()?t instanceof Node||t instanceof Br(t).Node:!1}function js(t){return Wf()?t instanceof Element||t instanceof Br(t).Element:!1}function Gs(t){return Wf()?t instanceof HTMLElement||t instanceof Br(t).HTMLElement:!1}function mw(t){return!Wf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Br(t).ShadowRoot}const CF=new Set(["inline","contents"]);function Pd(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=ks(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!CF.has(a)}const EF=new Set(["table","td","th"]);function TF(t){return EF.has(ec(t))}const MF=[":popover-open",":modal"];function Uf(t){return MF.some(e=>{try{return t.matches(e)}catch{return!1}})}const AF=["transform","translate","scale","rotate","perspective"],IF=["transform","translate","scale","rotate","perspective","filter"],RF=["paint","layout","strict","content"];function ry(t){const e=sy(),n=js(t)?ks(t):t;return AF.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||IF.some(r=>(n.willChange||"").includes(r))||RF.some(r=>(n.contain||"").includes(r))}function PF(t){let e=Ri(t);for(;Gs(e)&&!Wl(e);){if(ry(e))return e;if(Uf(e))return null;e=Ri(e)}return null}function sy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const OF=new Set(["html","body","#document"]);function Wl(t){return OF.has(ec(t))}function ks(t){return Br(t).getComputedStyle(t)}function Kf(t){return js(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ri(t){if(ec(t)==="html")return t;const e=t.assignedSlot||t.parentNode||mw(t)&&t.host||Ys(t);return mw(e)?e.host:e}function KC(t){const e=Ri(t);return Wl(e)?t.ownerDocument?t.ownerDocument.body:t.body:Gs(e)&&Pd(e)?e:KC(e)}function wd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=KC(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Br(a);if(i){const c=_x(o);return e.concat(o,o.visualViewport||[],Pd(a)?a:[],c&&n?wd(c):[])}return e.concat(a,wd(a,[],n))}function _x(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function qC(t){const e=ks(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Gs(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=ff(n)!==i||ff(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function ay(t){return js(t)?t:t.contextElement}function Pl(t){const e=ay(t);if(!Gs(e))return Us(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=qC(e);let o=(i?ff(n.width):n.width)/r,c=(i?ff(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const DF=Us(0);function GC(t){const e=Br(t);return!sy()||!e.visualViewport?DF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function LF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Br(t)?!1:e}function Lo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=ay(t);let o=Us(1);e&&(r?js(r)&&(o=Pl(r)):o=Pl(t));const c=LF(i,n,r)?GC(i):Us(0);let u=(a.left+c.x)/o.x,h=(a.top+c.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=Br(i),y=r&&js(r)?Br(r):r;let v=g,w=_x(v);for(;w&&r&&y!==v;){const N=Pl(w),k=w.getBoundingClientRect(),C=ks(w),E=k.left+(w.clientLeft+parseFloat(C.paddingLeft))*N.x,I=k.top+(w.clientTop+parseFloat(C.paddingTop))*N.y;u*=N.x,h*=N.y,f*=N.x,m*=N.y,u+=E,h+=I,v=Br(w),w=_x(v)}}return mf({width:f,height:m,x:u,y:h})}function qf(t,e){const n=Kf(t).scrollLeft;return e?e.left+n:Lo(Ys(t)).left+n}function JC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-qf(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function _F(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Ys(r),c=e?Uf(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Us(1);const f=Us(0),m=Gs(r);if((m||!m&&!i)&&((ec(r)!=="body"||Pd(o))&&(u=Kf(r)),Gs(r))){const y=Lo(r);h=Pl(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!i?JC(o,u):Us(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function zF(t){return Array.from(t.getClientRects())}function $F(t){const e=Ys(t),n=Kf(t),r=t.ownerDocument.body,a=Lr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Lr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+qf(t);const c=-n.scrollTop;return ks(r).direction==="rtl"&&(o+=Lr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const gw=25;function FF(t,e){const n=Br(t),r=Ys(t),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,c=0,u=0;if(a){i=a.width,o=a.height;const f=sy();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=qf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-y);v<=gw&&(i-=v)}else h<=gw&&(i+=h);return{width:i,height:o,x:c,y:u}}const BF=new Set(["absolute","fixed"]);function VF(t,e){const n=Lo(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Gs(t)?Pl(t):Us(1),o=t.clientWidth*i.x,c=t.clientHeight*i.y,u=a*i.x,h=r*i.y;return{width:o,height:c,x:u,y:h}}function xw(t,e,n){let r;if(e==="viewport")r=FF(t,n);else if(e==="document")r=$F(Ys(t));else if(js(e))r=VF(e,n);else{const a=GC(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return mf(r)}function YC(t,e){const n=Ri(t);return n===e||!js(n)||Wl(n)?!1:ks(n).position==="fixed"||YC(n,e)}function HF(t,e){const n=e.get(t);if(n)return n;let r=wd(t,[],!1).filter(c=>js(c)&&ec(c)!=="body"),a=null;const i=ks(t).position==="fixed";let o=i?Ri(t):t;for(;js(o)&&!Wl(o);){const c=ks(o),u=ry(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&BF.has(a.position)||Pd(o)&&!u&&YC(t,o))?r=r.filter(f=>f!==o):a=c,o=Ri(o)}return e.set(t,r),r}function WF(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Uf(e)?[]:HF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=xw(e,f,a);return h.top=Lr(m.top,h.top),h.right=Ii(m.right,h.right),h.bottom=Ii(m.bottom,h.bottom),h.left=Lr(m.left,h.left),h},xw(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function UF(t){const{width:e,height:n}=qC(t);return{width:e,height:n}}function KF(t,e,n){const r=Gs(e),a=Ys(e),i=n==="fixed",o=Lo(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Us(0);function h(){u.x=qf(a)}if(r||!r&&!i)if((ec(e)!=="body"||Pd(a))&&(c=Kf(e)),r){const y=Lo(e,!0,i,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else a&&h();i&&!r&&a&&h();const f=a&&!r&&!i?JC(a,c):Us(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function Sg(t){return ks(t).position==="static"}function yw(t,e){if(!Gs(t)||ks(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ys(t)===n&&(n=n.ownerDocument.body),n}function QC(t,e){const n=Br(t);if(Uf(t))return n;if(!Gs(t)){let a=Ri(t);for(;a&&!Wl(a);){if(js(a)&&!Sg(a))return a;a=Ri(a)}return n}let r=yw(t,e);for(;r&&TF(r)&&Sg(r);)r=yw(r,e);return r&&Wl(r)&&Sg(r)&&!ry(r)?n:r||PF(t)||n}const qF=async function(t){const e=this.getOffsetParent||QC,n=this.getDimensions,r=await n(t.floating);return{reference:KF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function GF(t){return ks(t).direction==="rtl"}const JF={convertOffsetParentRelativeRectToViewportRelativeRect:_F,getDocumentElement:Ys,getClippingRect:WF,getOffsetParent:QC,getElementRects:qF,getClientRects:zF,getDimensions:UF,getScale:Pl,isElement:js,isRTL:GF};function XC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function YF(t,e){let n=null,r;const a=Ys(t);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const v=sh(m),w=sh(a.clientWidth-(f+g)),N=sh(a.clientHeight-(m+y)),k=sh(f),E={rootMargin:-v+"px "+-w+"px "+-N+"px "+-k+"px",threshold:Lr(0,Ii(1,u))||1};let I=!0;function P(B){const L=B[0].intersectionRatio;if(L!==u){if(!I)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!XC(h,t.getBoundingClientRect())&&o(),I=!1}try{n=new IntersectionObserver(P,{...E,root:a.ownerDocument})}catch{n=new IntersectionObserver(P,E)}n.observe(t)}return o(!0),i}function QF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=ay(t),f=a||i?[...h?wd(h):[],...wd(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?YF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[C]=k;C&&C.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let v,w=u?Lo(t):null;u&&N();function N(){const k=Lo(t);w&&!XC(w,k)&&n(),w=k,v=requestAnimationFrame(N)}return n(),()=>{var k;f.forEach(C=>{a&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const XF=wF,ZF=jF,eB=bF,tB=SF,nB=vF,bw=yF,rB=kF,sB=(t,e,n)=>{const r=new Map,a={platform:JF,...n},i={...a.platform,_c:r};return xF(t,e,{...a,platform:i})};var aB=typeof document<"u",iB=function(){},ph=aB?b.useLayoutEffect:iB;function gf(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!gf(t[r],e[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&t.$$typeof)&&!gf(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function ZC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function vw(t,e){const n=ZC(t);return Math.round(e*n)/n}function Cg(t){const e=b.useRef(t);return ph(()=>{e.current=t}),e}function oB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);gf(g,r)||y(r);const[v,w]=b.useState(null),[N,k]=b.useState(null),C=b.useCallback(M=>{M!==B.current&&(B.current=M,w(M))},[]),E=b.useCallback(M=>{M!==L.current&&(L.current=M,k(M))},[]),I=i||v,P=o||N,B=b.useRef(null),L=b.useRef(null),R=b.useRef(f),D=u!=null,_=Cg(u),te=Cg(a),K=Cg(h),he=b.useCallback(()=>{if(!B.current||!L.current)return;const M={placement:e,strategy:n,middleware:g};te.current&&(M.platform=te.current),sB(B.current,L.current,M).then(q=>{const F={...q,isPositioned:K.current!==!1};ge.current&&!gf(R.current,F)&&(R.current=F,kd.flushSync(()=>{m(F)}))})},[g,e,n,te,K]);ph(()=>{h===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,m(M=>({...M,isPositioned:!1})))},[h]);const ge=b.useRef(!1);ph(()=>(ge.current=!0,()=>{ge.current=!1}),[]),ph(()=>{if(I&&(B.current=I),P&&(L.current=P),I&&P){if(_.current)return _.current(I,P,he);he()}},[I,P,he,_,D]);const z=b.useMemo(()=>({reference:B,floating:L,setReference:C,setFloating:E}),[C,E]),V=b.useMemo(()=>({reference:I,floating:P}),[I,P]),U=b.useMemo(()=>{const M={position:n,left:0,top:0};if(!V.floating)return M;const q=vw(V.floating,f.x),F=vw(V.floating,f.y);return c?{...M,transform:"translate("+q+"px, "+F+"px)",...ZC(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:F}},[n,c,V.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:he,refs:z,elements:V,floatingStyles:U}),[f,he,z,V,U])}const lB=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:a}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?bw({element:r.current,padding:a}).fn(n):{}:r?bw({element:r,padding:a}).fn(n):{}}}},cB=(t,e)=>({...XF(t),options:[t,e]}),dB=(t,e)=>({...ZF(t),options:[t,e]}),uB=(t,e)=>({...rB(t),options:[t,e]}),hB=(t,e)=>({...eB(t),options:[t,e]}),fB=(t,e)=>({...tB(t),options:[t,e]}),pB=(t,e)=>({...nB(t),options:[t,e]}),mB=(t,e)=>({...lB(t),options:[t,e]});var gB="Arrow",e4=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(ht.svg,{...i,ref:e,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});e4.displayName=gB;var xB=e4,iy="Popper",[t4,n4]=Li(iy),[yB,r4]=t4(iy),s4=t=>{const{__scopePopper:e,children:n}=t,[r,a]=b.useState(null);return s.jsx(yB,{scope:e,anchor:r,onAnchorChange:a,children:n})};s4.displayName=iy;var a4="PopperAnchor",i4=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=r4(a4,n),o=b.useRef(null),c=Ct(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(ht.div,{...a,ref:c})});i4.displayName=a4;var oy="PopperContent",[bB,vB]=t4(oy),o4=b.forwardRef((t,e)=>{var se,de,ce,ye,ze,Oe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:v,...w}=t,N=r4(oy,n),[k,C]=b.useState(null),E=Ct(e,ct=>C(ct)),[I,P]=b.useState(null),B=o0(I),L=(B==null?void 0:B.width)??0,R=(B==null?void 0:B.height)??0,D=r+(i!=="center"?"-"+i:""),_=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},te=Array.isArray(h)?h:[h],K=te.length>0,he={padding:_,boundary:te.filter(wB),altBoundary:K},{refs:ge,floatingStyles:z,placement:V,isPositioned:U,middlewareData:M}=oB({strategy:"fixed",placement:D,whileElementsMounted:(...ct)=>QF(...ct,{animationFrame:y==="always"}),elements:{reference:N.anchor},middleware:[cB({mainAxis:a+R,alignmentAxis:o}),u&&dB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?uB():void 0,...he}),u&&hB({...he}),fB({...he,apply:({elements:ct,rects:Lt,availableWidth:jn,availableHeight:it})=>{const{width:Mt,height:ne}=Lt.reference,Pe=ct.floating.style;Pe.setProperty("--radix-popper-available-width",`${jn}px`),Pe.setProperty("--radix-popper-available-height",`${it}px`),Pe.setProperty("--radix-popper-anchor-width",`${Mt}px`),Pe.setProperty("--radix-popper-anchor-height",`${ne}px`)}}),I&&mB({element:I,padding:c}),jB({arrowWidth:L,arrowHeight:R}),g&&pB({strategy:"referenceHidden",...he})]}),[q,F]=d4(V),O=Ti(v);rr(()=>{U&&(O==null||O())},[U,O]);const W=(se=M.arrow)==null?void 0:se.x,ie=(de=M.arrow)==null?void 0:de.y,J=((ce=M.arrow)==null?void 0:ce.centerOffset)!==0,[X,G]=b.useState();return rr(()=>{k&&G(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:ge.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:U?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(ye=M.transformOrigin)==null?void 0:ye.x,(ze=M.transformOrigin)==null?void 0:ze.y].join(" "),...((Oe=M.hide)==null?void 0:Oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(bB,{scope:n,placedSide:q,onArrowChange:P,arrowX:W,arrowY:ie,shouldHideArrow:J,children:s.jsx(ht.div,{"data-side":q,"data-align":F,...w,ref:E,style:{...w.style,animation:U?void 0:"none"}})})})});o4.displayName=oy;var l4="PopperArrow",NB={top:"bottom",right:"left",bottom:"top",left:"right"},c4=b.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=vB(l4,r),o=NB[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(xB,{...a,ref:n,style:{...a.style,display:"block"}})})});c4.displayName=l4;function wB(t){return t!==null}var jB=t=>({name:"transformOrigin",options:t,fn(e){var N,k,C;const{placement:n,rects:r,middlewareData:a}=e,o=((N=a.arrow)==null?void 0:N.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=d4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,y=(((C=a.arrow)==null?void 0:C.y)??0)+u/2;let v="",w="";return h==="bottom"?(v=o?m:`${g}px`,w=`${-u}px`):h==="top"?(v=o?m:`${g}px`,w=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,w=o?m:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,w=o?m:`${y}px`),{data:{x:v,y:w}}}});function d4(t){const[e,n="center"]=t.split("-");return[e,n]}var kB=s4,SB=i4,CB=o4,EB=c4,u4=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),TB="VisuallyHidden",MB=b.forwardRef((t,e)=>s.jsx(ht.span,{...t,ref:e,style:{...u4,...t.style}}));MB.displayName=TB;var AB=[" ","Enter","ArrowUp","ArrowDown"],IB=[" ","Enter"],_o="Select",[Gf,Jf,RB]=s0(_o),[tc]=Li(_o,[RB,n4]),Yf=n4(),[PB,Fi]=tc(_o),[OB,DB]=tc(_o),h4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:v}=t,w=Yf(e),[N,k]=b.useState(null),[C,E]=b.useState(null),[I,P]=b.useState(!1),B=kf(h),[L,R]=Eo({prop:r,defaultProp:a??!1,onChange:i,caller:_o}),[D,_]=Eo({prop:o,defaultProp:c,onChange:u,caller:_o}),te=b.useRef(null),K=N?v||!!N.closest("form"):!0,[he,ge]=b.useState(new Set),z=Array.from(he).map(V=>V.props.value).join(";");return s.jsx(kB,{...w,children:s.jsxs(PB,{required:y,scope:e,trigger:N,onTriggerChange:k,valueNode:C,onValueNodeChange:E,valueNodeHasChildren:I,onValueNodeHasChildrenChange:P,contentId:ji(),value:D,onValueChange:_,open:L,onOpenChange:R,dir:B,triggerPointerDownPosRef:te,disabled:g,children:[s.jsx(Gf.Provider,{scope:e,children:s.jsx(OB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(V=>{ge(U=>new Set(U).add(V))},[]),onNativeOptionRemove:b.useCallback(V=>{ge(U=>{const M=new Set(U);return M.delete(V),M})},[]),children:n})}),K?s.jsxs(O4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:D,onChange:V=>_(V.target.value),disabled:g,form:v,children:[D===void 0?s.jsx("option",{value:""}):null,Array.from(he)]},z):null]})})};h4.displayName=_o;var f4="SelectTrigger",p4=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Yf(n),o=Fi(f4,n),c=o.disabled||r,u=Ct(e,o.onTriggerChange),h=Jf(n),f=b.useRef("touch"),[m,g,y]=L4(w=>{const N=h().filter(E=>!E.disabled),k=N.find(E=>E.value===o.value),C=_4(N,w,k);C!==void 0&&o.onValueChange(C.value)}),v=w=>{c||(o.onOpenChange(!0),y()),w&&(o.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return s.jsx(SB,{asChild:!0,...i,children:s.jsx(ht.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":D4(o.value)?"":void 0,...a,ref:u,onClick:at(a.onClick,w=>{w.currentTarget.focus(),f.current!=="mouse"&&v(w)}),onPointerDown:at(a.onPointerDown,w=>{f.current=w.pointerType;const N=w.target;N.hasPointerCapture(w.pointerId)&&N.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(v(w),w.preventDefault())}),onKeyDown:at(a.onKeyDown,w=>{const N=m.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&g(w.key),!(N&&w.key===" ")&&AB.includes(w.key)&&(v(),w.preventDefault())})})})});p4.displayName=f4;var m4="SelectValue",g4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Fi(m4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Ct(e,u.onValueNodeChange);return rr(()=>{h(f)},[h,f]),s.jsx(ht.span,{...c,ref:m,style:{pointerEvents:"none"},children:D4(u.value)?s.jsx(s.Fragment,{children:o}):i})});g4.displayName=m4;var LB="SelectIcon",x4=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(ht.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});x4.displayName=LB;var _B="SelectPortal",y4=t=>s.jsx(Zx,{asChild:!0,...t});y4.displayName=_B;var zo="SelectContent",b4=b.forwardRef((t,e)=>{const n=Fi(zo,t.__scopeSelect),[r,a]=b.useState();if(rr(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?kd.createPortal(s.jsx(v4,{scope:t.__scopeSelect,children:s.jsx(Gf.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(N4,{...t,ref:e})});b4.displayName=zo;var ys=10,[v4,Bi]=tc(zo),zB="SelectContentImpl",$B=cd("SelectContent.RemoveScroll"),N4=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:w,avoidCollisions:N,...k}=t,C=Fi(zo,n),[E,I]=b.useState(null),[P,B]=b.useState(null),L=Ct(e,se=>I(se)),[R,D]=b.useState(null),[_,te]=b.useState(null),K=Jf(n),[he,ge]=b.useState(!1),z=b.useRef(!1);b.useEffect(()=>{if(E)return Oj(E)},[E]),Sj();const V=b.useCallback(se=>{const[de,...ce]=K().map(Oe=>Oe.ref.current),[ye]=ce.slice(-1),ze=document.activeElement;for(const Oe of se)if(Oe===ze||(Oe==null||Oe.scrollIntoView({block:"nearest"}),Oe===de&&P&&(P.scrollTop=0),Oe===ye&&P&&(P.scrollTop=P.scrollHeight),Oe==null||Oe.focus(),document.activeElement!==ze))return},[K,P]),U=b.useCallback(()=>V([R,E]),[V,R,E]);b.useEffect(()=>{he&&U()},[he,U]);const{onOpenChange:M,triggerPointerDownPosRef:q}=C;b.useEffect(()=>{if(E){let se={x:0,y:0};const de=ye=>{var ze,Oe;se={x:Math.abs(Math.round(ye.pageX)-(((ze=q.current)==null?void 0:ze.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((Oe=q.current)==null?void 0:Oe.y)??0))}},ce=ye=>{se.x<=10&&se.y<=10?ye.preventDefault():E.contains(ye.target)||M(!1),document.removeEventListener("pointermove",de),q.current=null};return q.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",ce,{capture:!0})}}},[E,M,q]),b.useEffect(()=>{const se=()=>M(!1);return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[M]);const[F,O]=L4(se=>{const de=K().filter(ze=>!ze.disabled),ce=de.find(ze=>ze.ref.current===document.activeElement),ye=_4(de,se,ce);ye&&setTimeout(()=>ye.ref.current.focus())}),W=b.useCallback((se,de,ce)=>{const ye=!z.current&&!ce;(C.value!==void 0&&C.value===de||ye)&&(D(se),ye&&(z.current=!0))},[C.value]),ie=b.useCallback(()=>E==null?void 0:E.focus(),[E]),J=b.useCallback((se,de,ce)=>{const ye=!z.current&&!ce;(C.value!==void 0&&C.value===de||ye)&&te(se)},[C.value]),X=r==="popper"?zx:w4,G=X===zx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:w,avoidCollisions:N}:{};return s.jsx(v4,{scope:n,content:E,viewport:P,onViewportChange:B,itemRefCallback:W,selectedItem:R,onItemLeave:ie,itemTextRefCallback:J,focusSelectedItem:U,selectedItemText:_,position:r,isPositioned:he,searchRef:F,children:s.jsx(e0,{as:$B,allowPinchZoom:!0,children:s.jsx(Xx,{asChild:!0,trapped:C.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:at(a,se=>{var de;(de=C.trigger)==null||de.focus({preventScroll:!0}),se.preventDefault()}),children:s.jsx(Qx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:s.jsx(X,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:se=>se.preventDefault(),...k,...G,onPlaced:()=>ge(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:at(k.onKeyDown,se=>{const de=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!de&&se.key.length===1&&O(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.key)){let ye=K().filter(ze=>!ze.disabled).map(ze=>ze.ref.current);if(["ArrowUp","End"].includes(se.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const ze=se.target,Oe=ye.indexOf(ze);ye=ye.slice(Oe+1)}setTimeout(()=>V(ye)),se.preventDefault()}})})})})})})});N4.displayName=zB;var FB="SelectItemAlignedPosition",w4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Fi(zo,n),o=Bi(zo,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=Ct(e,L=>f(L)),g=Jf(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:w,selectedItem:N,selectedItemText:k,focusSelectedItem:C}=o,E=b.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&w&&N&&k){const L=i.trigger.getBoundingClientRect(),R=h.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),_=k.getBoundingClientRect();if(i.dir!=="rtl"){const ze=_.left-R.left,Oe=D.left-ze,ct=L.left-Oe,Lt=L.width+ct,jn=Math.max(Lt,R.width),it=window.innerWidth-ys,Mt=Nh(Oe,[ys,Math.max(ys,it-jn)]);c.style.minWidth=Lt+"px",c.style.left=Mt+"px"}else{const ze=R.right-_.right,Oe=window.innerWidth-D.right-ze,ct=window.innerWidth-L.right-Oe,Lt=L.width+ct,jn=Math.max(Lt,R.width),it=window.innerWidth-ys,Mt=Nh(Oe,[ys,Math.max(ys,it-jn)]);c.style.minWidth=Lt+"px",c.style.right=Mt+"px"}const te=g(),K=window.innerHeight-ys*2,he=w.scrollHeight,ge=window.getComputedStyle(h),z=parseInt(ge.borderTopWidth,10),V=parseInt(ge.paddingTop,10),U=parseInt(ge.borderBottomWidth,10),M=parseInt(ge.paddingBottom,10),q=z+V+he+M+U,F=Math.min(N.offsetHeight*5,q),O=window.getComputedStyle(w),W=parseInt(O.paddingTop,10),ie=parseInt(O.paddingBottom,10),J=L.top+L.height/2-ys,X=K-J,G=N.offsetHeight/2,se=N.offsetTop+G,de=z+V+se,ce=q-de;if(de<=J){const ze=te.length>0&&N===te[te.length-1].ref.current;c.style.bottom="0px";const Oe=h.clientHeight-w.offsetTop-w.offsetHeight,ct=Math.max(X,G+(ze?ie:0)+Oe+U),Lt=de+ct;c.style.height=Lt+"px"}else{const ze=te.length>0&&N===te[0].ref.current;c.style.top="0px";const ct=Math.max(J,z+w.offsetTop+(ze?W:0)+G)+ce;c.style.height=ct+"px",w.scrollTop=de-J+w.offsetTop}c.style.margin=`${ys}px 0`,c.style.minHeight=F+"px",c.style.maxHeight=K+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,i.trigger,i.valueNode,c,h,w,N,k,i.dir,r]);rr(()=>E(),[E]);const[I,P]=b.useState();rr(()=>{h&&P(window.getComputedStyle(h).zIndex)},[h]);const B=b.useCallback(L=>{L&&v.current===!0&&(E(),C==null||C(),v.current=!1)},[E,C]);return s.jsx(VB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:B,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:I},children:s.jsx(ht.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});w4.displayName=FB;var BB="SelectPopperPosition",zx=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ys,...i}=t,o=Yf(n);return s.jsx(CB,{...o,...i,ref:e,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});zx.displayName=BB;var[VB,ly]=tc(zo,{}),$x="SelectViewport",j4=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Bi($x,n),o=ly($x,n),c=Ct(e,i.onViewportChange),u=b.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(Gf.Slot,{scope:n,children:s.jsx(ht.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:at(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const v=window.innerHeight-ys*2,w=parseFloat(m.style.minHeight),N=parseFloat(m.style.height),k=Math.max(w,N);if(k0?I:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});j4.displayName=$x;var k4="SelectGroup",[HB,WB]=tc(k4),UB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=ji();return s.jsx(HB,{scope:n,id:a,children:s.jsx(ht.div,{role:"group","aria-labelledby":a,...r,ref:e})})});UB.displayName=k4;var S4="SelectLabel",KB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=WB(S4,n);return s.jsx(ht.div,{id:a.id,...r,ref:e})});KB.displayName=S4;var xf="SelectItem",[qB,C4]=tc(xf),E4=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Fi(xf,n),u=Bi(xf,n),h=c.value===r,[f,m]=b.useState(i??""),[g,y]=b.useState(!1),v=Ct(e,C=>{var E;return(E=u.itemRefCallback)==null?void 0:E.call(u,C,r,a)}),w=ji(),N=b.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(qB,{scope:n,value:r,disabled:a,textId:w,isSelected:h,onItemTextChange:b.useCallback(C=>{m(E=>E||((C==null?void 0:C.textContent)??"").trim())},[]),children:s.jsx(Gf.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(ht.div,{role:"option","aria-labelledby":w,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:v,onFocus:at(o.onFocus,()=>y(!0)),onBlur:at(o.onBlur,()=>y(!1)),onClick:at(o.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:at(o.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:at(o.onPointerDown,C=>{N.current=C.pointerType}),onPointerMove:at(o.onPointerMove,C=>{var E;N.current=C.pointerType,a?(E=u.onItemLeave)==null||E.call(u):N.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:at(o.onPointerLeave,C=>{var E;C.currentTarget===document.activeElement&&((E=u.onItemLeave)==null||E.call(u))}),onKeyDown:at(o.onKeyDown,C=>{var I;((I=u.searchRef)==null?void 0:I.current)!==""&&C.key===" "||(IB.includes(C.key)&&k(),C.key===" "&&C.preventDefault())})})})})});E4.displayName=xf;var Uc="SelectItemText",T4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Fi(Uc,n),c=Bi(Uc,n),u=C4(Uc,n),h=DB(Uc,n),[f,m]=b.useState(null),g=Ct(e,k=>m(k),u.onItemTextChange,k=>{var C;return(C=c.itemTextRefCallback)==null?void 0:C.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,v=b.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:N}=h;return rr(()=>(w(v),()=>N(v)),[w,N,v]),s.jsxs(s.Fragment,{children:[s.jsx(ht.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?kd.createPortal(i.children,o.valueNode):null]})});T4.displayName=Uc;var M4="SelectItemIndicator",A4=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return C4(M4,n).isSelected?s.jsx(ht.span,{"aria-hidden":!0,...r,ref:e}):null});A4.displayName=M4;var Fx="SelectScrollUpButton",I4=b.forwardRef((t,e)=>{const n=Bi(Fx,t.__scopeSelect),r=ly(Fx,t.__scopeSelect),[a,i]=b.useState(!1),o=Ct(e,r.onScrollButtonChange);return rr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;i(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(P4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});I4.displayName=Fx;var Bx="SelectScrollDownButton",R4=b.forwardRef((t,e)=>{const n=Bi(Bx,t.__scopeSelect),r=ly(Bx,t.__scopeSelect),[a,i]=b.useState(!1),o=Ct(e,r.onScrollButtonChange);return rr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(P4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});R4.displayName=Bx;var P4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Bi("SelectScrollButton",n),o=b.useRef(null),c=Jf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),rr(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),s.jsx(ht.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:at(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:at(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:at(a.onPointerLeave,()=>{u()})})}),GB="SelectSeparator",JB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(ht.div,{"aria-hidden":!0,...r,ref:e})});JB.displayName=GB;var Vx="SelectArrow",YB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Yf(n),i=Fi(Vx,n),o=Bi(Vx,n);return i.open&&o.position==="popper"?s.jsx(EB,{...a,...r,ref:e}):null});YB.displayName=Vx;var QB="SelectBubbleInput",O4=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=b.useRef(null),i=Ct(r,a),o=i0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(ht.select,{...n,style:{...u4,...n.style},ref:i,defaultValue:e})});O4.displayName=QB;function D4(t){return t===""||t===void 0}function L4(t){const e=Ti(t),n=b.useRef(""),r=b.useRef(0),a=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),i=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function _4(t,e,n){const a=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=XB(t,Math.max(i,0));a.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function XB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var ZB=h4,z4=p4,eV=g4,tV=x4,nV=y4,$4=b4,rV=j4,F4=E4,sV=T4,aV=A4,iV=I4,oV=R4;const Sl=ZB,Cl=eV,fo=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(z4,{ref:r,className:Et("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,s.jsx(tV,{asChild:!0,children:s.jsx(ld,{className:"h-4 w-4 opacity-50"})})]}));fo.displayName=z4.displayName;const po=b.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(nV,{children:s.jsxs($4,{ref:a,className:Et("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[s.jsx(iV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Jw,{className:"h-4 w-4"})}),s.jsx(rV,{className:"p-1",children:e}),s.jsx(oV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(ld,{className:"h-4 w-4"})})]})}));po.displayName=$4.displayName;const Dr=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(F4,{ref:r,className:Et("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(aV,{children:s.jsx(vf,{className:"h-4 w-4"})})}),s.jsx(sV,{children:e})]}));Dr.displayName=F4.displayName;const lV=["一","二","三","四","五","六","七","八","九","十"];function Eg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function cV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:a,onDeleteSection:i,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:v,pinnedSectionIds:w=[]}){const[N,k]=b.useState(null),[C,E]=b.useState(null),I=(_,te)=>(N==null?void 0:N.type)===_&&(N==null?void 0:N.id)===te,P=(_,te)=>(C==null?void 0:C.type)===_&&(C==null?void 0:C.id)===te,B=b.useCallback(()=>{const _=[];for(const te of t)for(const K of te.chapters)for(const he of K.sections)_.push({id:he.id,partId:te.id,partTitle:te.title,chapterId:K.id,chapterTitle:K.title});return _},[t]),L=b.useCallback(async(_,te,K,he)=>{var M;_.preventDefault(),_.stopPropagation();const ge=_.dataTransfer.getData("text/plain"),z=Eg(ge);if(!z||z.type===te&&z.id===K)return;const V=B(),U=new Map(V.map(q=>[q.id,q]));if(z.type==="part"&&te==="part"){const q=t.map(J=>J.id),F=q.indexOf(z.id),O=q.indexOf(K);if(F===-1||O===-1)return;const W=[...q];W.splice(F,1),W.splice(FG.id===J);if(X)for(const G of X.chapters)for(const se of G.sections){const de=U.get(se.id);de&&ie.push(de)}}await r(ie);return}if(z.type==="chapter"&&(te==="chapter"||te==="section"||te==="part")){const q=t.find(de=>de.chapters.some(ce=>ce.id===z.id)),F=q==null?void 0:q.chapters.find(de=>de.id===z.id);if(!q||!F)return;let O,W,ie=null;if(te==="section"){const de=U.get(K);if(!de)return;O=de.partId,W=de.partTitle,ie=K}else if(te==="chapter"){const de=t.find(ze=>ze.chapters.some(Oe=>Oe.id===K)),ce=de==null?void 0:de.chapters.find(ze=>ze.id===K);if(!de||!ce)return;O=de.id,W=de.title;const ye=V.filter(ze=>ze.chapterId===K).pop();ie=(ye==null?void 0:ye.id)??null}else{const de=t.find(ye=>ye.id===K);if(!de||!de.chapters[0])return;O=de.id,W=de.title;const ce=V.filter(ye=>ye.partId===de.id&&ye.chapterId===de.chapters[0].id);ie=((M=ce[ce.length-1])==null?void 0:M.id)??null}const J=F.sections.map(de=>de.id),X=V.filter(de=>!J.includes(de.id));let G=X.length;if(ie){const de=X.findIndex(ce=>ce.id===ie);de>=0&&(G=de+1)}const se=J.map(de=>({...U.get(de),partId:O,partTitle:W,chapterId:F.id,chapterTitle:F.title}));await r([...X.slice(0,G),...se,...X.slice(G)]);return}if(z.type==="section"&&(te==="section"||te==="chapter"||te==="part")){if(!he)return;const{partId:q,partTitle:F,chapterId:O,chapterTitle:W}=he;let ie;if(te==="section")ie=V.findIndex(ce=>ce.id===K);else if(te==="chapter"){const ce=V.filter(ye=>ye.chapterId===K).pop();ie=ce?V.findIndex(ye=>ye.id===ce.id)+1:V.length}else{const ce=t.find(Oe=>Oe.id===K);if(!(ce!=null&&ce.chapters[0]))return;const ye=V.filter(Oe=>Oe.partId===ce.id&&Oe.chapterId===ce.chapters[0].id),ze=ye[ye.length-1];ie=ze?V.findIndex(Oe=>Oe.id===ze.id)+1:0}const J=V.findIndex(ce=>ce.id===z.id);if(J===-1)return;const X=V.filter(ce=>ce.id!==z.id),G=J({onDragEnter:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",E({type:_,id:te})},onDragOver:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",E({type:_,id:te})},onDragLeave:()=>E(null),onDrop:he=>{E(null);const ge=Eg(he.dataTransfer.getData("text/plain"));if(ge&&!(_==="section"&&ge.type==="section"&&ge.id===te))if(_==="part")if(ge.type==="part")L(he,"part",te);else{const z=t.find(U=>U.id===te);(z==null?void 0:z.chapters[0])&&K&&L(he,"part",te,K)}else _==="chapter"&&K?(ge.type==="section"||ge.type==="chapter")&&L(he,"chapter",te,K):_==="section"&&K&&L(he,"section",te,K)}}),D=_=>lV[_]??String(_+1);return s.jsx("div",{className:"space-y-3",children:t.map((_,te)=>{var F,O,W,ie;const K=_.title==="序言"||_.title.includes("序言"),he=_.title==="尾声"||_.title.includes("尾声"),ge=_.title==="附录"||_.title.includes("附录"),z=P("part",_.id),V=e.includes(_.id),U=_.chapters.length,M=_.chapters.reduce((J,X)=>J+X.sections.length,0);if(K&&_.chapters.length===1&&_.chapters[0].sections.length===1){const J=_.chapters[0].sections[0],X=P("section",J.id),G={partId:_.id,partTitle:_.title,chapterId:_.chapters[0].id,chapterTitle:_.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+J.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:J.id})},onDragEnd:()=>{k(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${X?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${I("section",J.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",J.id,G),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ha,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(J.id),onChange:()=>y(J.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx($r,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[_.chapters[0].title," | ",J.title]}),w.includes(J.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:se=>se.stopPropagation(),onClick:se=>se.stopPropagation(),children:[J.price===0||J.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",J.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",J.clickCount??0," · 付款 ",J.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(J.hotScore??0).toFixed(1)," · 第",J.hotRank&&J.hotRank>0?J.hotRank:"-","名"]}),v&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(J),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(J),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(J),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},_.id)}if(_.title==="2026每日派对干货"||_.title.includes("2026每日派对干货")){const J=P("part",_.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${J?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...R("part",_.id,{partId:_.id,partTitle:_.title,chapterId:((F=_.chapters[0])==null?void 0:F.id)??"",chapterTitle:((O=_.chapters[0])==null?void 0:O.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:X=>{X.stopPropagation(),X.dataTransfer.setData("text/plain","part:"+_.id),X.dataTransfer.effectAllowed="move",k({type:"part",id:_.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${I("part",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(_.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ha,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:_.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",M," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:X=>X.stopPropagation(),onClick:X=>X.stopPropagation(),children:[o&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),f&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(_),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(er,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[U,"章"]}),V?s.jsx(ld,{className:"w-5 h-5 text-gray-500"}):s.jsx(mo,{className:"w-5 h-5 text-gray-500"})]})]}),V&&_.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:_.chapters.map(X=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:X.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:G=>G.stopPropagation(),children:[m&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>m(_,X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),c&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>u(_,X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:X.sections.map(G=>{const se=P("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+G.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},onClick:()=>a(G),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${se?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${I("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",G.id,{partId:_.id,partTitle:_.title,chapterId:X.id,chapterTitle:X.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ha,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[G.id," ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onClick:de=>de.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]},G.id)})})]},X.id))})]},_.id)}if(ge)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:_.chapters.map((J,X)=>J.sections.length>0?J.sections.map(G=>{const se=P("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+G.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${se?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${I("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",G.id,{partId:_.id,partTitle:_.title,chapterId:J.id,chapterTitle:J.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ha,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",X+1," | ",J.title," | ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(mo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},G.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",X+1," | ",J.title,"(空)"]}),s.jsx(mo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},J.id))})]},_.id);if(he&&_.chapters.length===1&&_.chapters[0].sections.length===1){const J=_.chapters[0].sections[0],X=P("section",J.id),G={partId:_.id,partTitle:_.title,chapterId:_.chapters[0].id,chapterTitle:_.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+J.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:J.id})},onDragEnd:()=>{k(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${X?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${I("section",J.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",J.id,G),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ha,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(J.id),onChange:()=>y(J.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx($r,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[_.chapters[0].title," | ",J.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:se=>se.stopPropagation(),onClick:se=>se.stopPropagation(),children:[J.price===0||J.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",J.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",J.clickCount??0," · 付款 ",J.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(J.hotScore??0).toFixed(1)," · 第",J.hotRank&&J.hotRank>0?J.hotRank:"-","名"]}),v&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(J),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(J),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(J),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},_.id)}return he?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:_.chapters.map(J=>J.sections.map(X=>{const G=P("section",X.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+X.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:X.id})},onDragEnd:()=>{k(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${G?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${I("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",X.id,{partId:_.id,partTitle:_.title,chapterId:J.id,chapterTitle:J.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ha,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(X.id),onChange:()=>y(X.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[J.title," | ",X.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),v&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(X),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},X.id)}))})]},_.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${z?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...R("part",_.id,{partId:_.id,partTitle:_.title,chapterId:((W=_.chapters[0])==null?void 0:W.id)??"",chapterTitle:((ie=_.chapters[0])==null?void 0:ie.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:J=>{J.stopPropagation(),J.dataTransfer.setData("text/plain","part:"+_.id),J.dataTransfer.effectAllowed="move",k({type:"part",id:_.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${I("part",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(_.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ha,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:D(te)}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:_.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",M," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:J=>J.stopPropagation(),onClick:J=>J.stopPropagation(),children:[o&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),f&&s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(_),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(er,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[U,"章"]}),V?s.jsx(ld,{className:"w-5 h-5 text-gray-500"}):s.jsx(mo,{className:"w-5 h-5 text-gray-500"})]})]}),V&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:_.chapters.map(J=>{const X=P("chapter",J.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:G=>{G.stopPropagation(),G.dataTransfer.setData("text/plain","chapter:"+J.id),G.dataTransfer.effectAllowed="move",k({type:"chapter",id:J.id})},onDragEnd:()=>{k(null),E(null)},onDragEnter:G=>{G.preventDefault(),G.stopPropagation(),G.dataTransfer.dropEffect="move",E({type:"chapter",id:J.id})},onDragOver:G=>{G.preventDefault(),G.stopPropagation(),G.dataTransfer.dropEffect="move",E({type:"chapter",id:J.id})},onDragLeave:()=>E(null),onDrop:G=>{E(null);const se=Eg(G.dataTransfer.getData("text/plain"));if(!se)return;const de={partId:_.id,partTitle:_.title,chapterId:J.id,chapterTitle:J.title};(se.type==="section"||se.type==="chapter")&&L(G,"chapter",J.id,de)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${X?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${I("chapter",J.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(ha,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:J.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:G=>G.stopPropagation(),children:[m&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>m(_,J),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),c&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>u(_,J),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:J.sections.map(G=>{const se=P("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+G.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${se?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${I("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...R("section",G.id,{partId:_.id,partTitle:_.title,chapterId:J.id,chapterTitle:J.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(ha,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${G.price===0||G.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[G.id," ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[G.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),G.price===0||G.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",G.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Ft,{className:"w-3.5 h-3.5"})}),s.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},G.id)})})]},J.id)})})]},_.id)})})}function dV(t){var a;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(a=t==null?void 0:t.keyword)!=null&&a.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString(),r=n?`/api/admin/ckb/devices?${n}`:"/api/admin/ckb/devices";return Le(r)}function uV(t){return Le(`/api/db/person?personId=${encodeURIComponent(t)}`)}function hV(t){var r;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(r=t==null?void 0:t.keyword)!=null&&r.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString();return Le(n?`/api/admin/ckb/plans?${n}`:"/api/admin/ckb/plans")}const B4=11,Nw={personId:"",name:"",aliases:"",label:"",sceneId:B4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"09:00",endTime:"18:00",deviceGroups:""};function fV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var V;const a=!!n,[i,o]=b.useState(Nw),[c,u]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState([]),[y,v]=b.useState(!1),[w,N]=b.useState(""),[k,C]=b.useState([]),[E,I]=b.useState(!1),[P,B]=b.useState(""),[L,R]=b.useState(!1),[D,_]=b.useState({});b.useEffect(()=>{t&&(N(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",aliases:n.aliases??"",label:n.label??"",sceneId:B4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"09:00",endTime:n.endTime??"18:00",deviceGroups:n.deviceGroups??""}:{...Nw}),_({}),m.length===0&&te(""),k.length===0&&K(""))},[t,n]);const te=async U=>{v(!0);try{const M=await dV({page:1,limit:50,keyword:U});M!=null&&M.success&&Array.isArray(M.devices)?g(M.devices):M!=null&&M.error&&oe.error(M.error)}catch(M){oe.error(M instanceof Error?M.message:"加载设备列表失败")}finally{v(!1)}},K=async U=>{I(!0);try{const M=await hV({page:1,limit:100,keyword:U});M!=null&&M.success&&Array.isArray(M.plans)?C(M.plans):M!=null&&M.error&&oe.error(M.error)}catch{oe.error("加载计划列表失败")}finally{I(!1)}},he=U=>{const M=Array.isArray(U.deviceGroups)?U.deviceGroups.map(String).join(","):"";o(q=>({...q,ckbApiKey:U.apiKey||"",greeting:U.greeting||q.greeting,tips:U.tips||q.tips,remarkType:U.remarkType||q.remarkType,remarkFormat:U.remarkFormat||q.remarkFormat,addFriendInterval:U.addInterval||q.addFriendInterval,startTime:U.startTime||q.startTime,endTime:U.endTime||q.endTime,deviceGroups:M||q.deviceGroups})),R(!1),oe.success(`已选择计划「${U.name}」,参数已覆盖`)},ge=P.trim()?k.filter(U=>(U.name||"").includes(P.trim())||String(U.id).includes(P.trim())):k,z=async()=>{var F;const U={};(!i.name||!String(i.name).trim())&&(U.name="请填写名称");const M=i.addFriendInterval;if((typeof M!="number"||M<1)&&(U.addFriendInterval="添加间隔至少为 1 分钟"),(((F=i.deviceGroups)==null?void 0:F.split(",").map(O=>O.trim()).filter(Boolean))??[]).length===0&&(U.deviceGroups="请至少选择 1 台设备"),_(U),Object.keys(U).length>0){oe.error(U.name||U.addFriendInterval||U.deviceGroups||"请完善必填项");return}u(!0);try{await r(i),e(!1)}catch(O){oe.error(O instanceof Error?O.message:"保存失败")}finally{u(!1)}};return s.jsx(Bt,{open:t,onOpenChange:e,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Vt,{children:[s.jsx(Ht,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(Qj,{className:"text-gray-400 text-sm",children:a?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(ee,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(le,{className:`bg-[#0a1628] text-white ${D.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:i.name,onChange:U=>{o(M=>({...M,name:U.target.value})),D.name&&_(M=>({...M,name:void 0}))}}),D.name&&s.jsx("p",{className:"text-xs text-red-400",children:D.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:i.personId,onChange:U=>o(M=>({...M,personId:U.target.value})),disabled:a})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:i.label,onChange:U=>o(M=>({...M,label:U.target.value}))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 卡卡, 若若",value:i.aliases,onChange:U=>o(M=>({...M,aliases:U.target.value}))})]})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-4",children:"存客宝 API 获客配置"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5 relative",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"选择存客宝获客计划"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1 flex items-center bg-[#0a1628] border border-gray-700 rounded-md px-3 py-2 cursor-pointer hover:border-[#38bdac]/60 text-sm",onClick:()=>R(!L),children:i.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((V=k.find(U=>U.apiKey===i.ckbApiKey))==null?void 0:V.name)||`密钥: ${i.ckbApiKey.slice(0,20)}...`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(re,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{K(P),R(!0)},disabled:E,children:E?"加载...":"刷新"})]}),L&&s.jsxs("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-[#0b1828] border border-gray-700 rounded-lg shadow-xl max-h-64 flex flex-col",children:[s.jsx("div",{className:"p-2 border-b border-gray-700/60",children:s.jsx(le,{className:"bg-[#050c18] border-gray-700 text-white h-8 text-xs",placeholder:"搜索计划名称...",value:P,onChange:U=>B(U.target.value),onKeyDown:U=>{U.key==="Enter"&&K(P)},autoFocus:!0})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:ge.length===0?s.jsx("div",{className:"text-center py-4 text-gray-500 text-xs",children:E?"加载中...":"暂无计划"}):ge.map(U=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${i.ckbApiKey===U.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>he(U),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:U.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(U.id)]})]}),U.enabled?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 rounded shrink-0 ml-2",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 rounded shrink-0 ml-2",children:"停用"})]},String(U.id)))}),s.jsx("div",{className:"p-2 border-t border-gray-700/60 flex justify-end",children:s.jsx(re,{type:"button",size:"sm",variant:"ghost",className:"text-gray-400 h-7 text-xs",onClick:()=>R(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(ee,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${D.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(le,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:i.deviceGroups?`已选择 ${i.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(re,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),D.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:D.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(Sl,{value:i.remarkType,onValueChange:U=>o(M=>({...M,remarkType:U})),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择备注类型"})}),s.jsxs(po,{children:[s.jsx(Dr,{value:"phone",children:"手机号"}),s.jsx(Dr,{value:"nickname",children:"昵称"}),s.jsx(Dr,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"备注格式"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 手机号+SOUL链接人与事-{名称},留空用默认",value:i.remarkFormat,onChange:U=>o(M=>({...M,remarkFormat:U.target.value}))})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:i.greeting,onChange:U=>o(M=>({...M,greeting:U.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(le,{type:"number",min:1,className:`bg-[#0a1628] text-white ${D.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:i.addFriendInterval,onChange:U=>{o(M=>({...M,addFriendInterval:Number(U.target.value)||1})),D.addFriendInterval&&_(M=>({...M,addFriendInterval:void 0}))}}),D.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:D.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.startTime,onChange:U=>o(M=>({...M,startTime:U.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(le,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.endTime,onChange:U=>o(M=>({...M,endTime:U.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:i.tips,onChange:U=>o(M=>({...M,tips:U.target.value}))})]})]})]})]})]}),s.jsxs(ln,{className:"gap-3 pt-2",children:[s.jsx(re,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(re,{onClick:z,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:c?"保存中...":a?"保存":"添加"})]}),h&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:w,onChange:U=>N(U.target.value),onKeyDown:U=>{U.key==="Enter"&&te(w)}}),s.jsx(re,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>te(w),disabled:y,children:"刷新"}),s.jsx(re,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>f(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:y?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):m.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:m.map(U=>{const M=String(U.id??""),q=i.deviceGroups?i.deviceGroups.split(",").map(W=>W.trim()).filter(Boolean):[],F=q.includes(M),O=()=>{let W;F?W=q.filter(ie=>ie!==M):W=[...q,M],o(ie=>({...ie,deviceGroups:W.join(",")})),W.length>0&&_(ie=>({...ie,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:F,onChange:O}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:U.memo||U.wechatId||`设备 ${M}`}),U.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),U.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",M]}),U.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",U.wechatId]}),typeof U.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",U.totalFriend]})]})]})]},M)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",i.deviceGroups?i.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(re,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(re,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}function ww(t,e,n){if(!t||!t.includes("@")&&!t.includes("@")&&!t.includes("#")||typeof document>"u")return t;const r=document.createElement("div");r.innerHTML=t;const a=h=>h.trim().toLowerCase(),i=new Map;for(const h of e){const f=[h.name,...h.aliases?h.aliases.split(","):[]].map(m=>a(m)).filter(Boolean);for(const m of f)i.has(m)||i.set(m,h)}const o=new Map;for(const h of n){const f=[h.label,...h.aliases?h.aliases.split(","):[]].map(m=>a(m)).filter(Boolean);for(const m of f)o.has(m)||o.set(m,h)}const c=h=>{const f=h.textContent||"";if(!f||!f.includes("@")&&!f.includes("@")&&!f.includes("#"))return;const m=h.parentNode;if(!m)return;const g=document.createDocumentFragment(),y=/([@@][^\s@#@#]+|#[^\s@#@#]+)/g;let v=0,w;for(;w=y.exec(f);){const[N]=w,k=w.index;if(k>v&&g.appendChild(document.createTextNode(f.slice(v,k))),N.startsWith("@")||N.startsWith("@")){const C=i.get(a(N.slice(1)));if(C){const E=document.createElement("span");E.setAttribute("data-type","mention"),E.setAttribute("data-id",C.id),E.setAttribute("data-label",C.name),E.className="mention-tag",E.textContent=`@${C.name}`,g.appendChild(E)}else g.appendChild(document.createTextNode(N))}else if(N.startsWith("#")){const C=o.get(a(N.slice(1)));if(C){const E=document.createElement("span");E.setAttribute("data-type","linkTag"),E.setAttribute("data-url",C.url||""),E.setAttribute("data-tag-type",C.type||"url"),E.setAttribute("data-tag-id",C.id||""),E.setAttribute("data-page-path",C.pagePath||""),E.setAttribute("data-app-id",C.appId||""),C.type==="miniprogram"&&C.appId&&E.setAttribute("data-mp-key",C.appId),E.className="link-tag-node",E.textContent=`#${C.label}`,g.appendChild(E)}else g.appendChild(document.createTextNode(N))}else g.appendChild(document.createTextNode(N));v=k+N.length}v{if(h.nodeType===Node.ELEMENT_NODE){const m=h.getAttribute("data-type");if(m==="mention"||m==="linkTag")return;h.childNodes.forEach(g=>u(g));return}h.nodeType===Node.TEXT_NODE&&c(h)};return r.childNodes.forEach(h=>u(h)),r.innerHTML}function pV(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const i=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return i.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function mV(){var cs,ds,us;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,w]=b.useState(""),[N,k]=b.useState([]),[C,E]=b.useState(!1),[I,P]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[B,L]=b.useState(null),[R,D]=b.useState(!1),[_,te]=b.useState(!1),[K,he]=b.useState(null),[ge,z]=b.useState(!1),[V,U]=b.useState([]),[M,q]=b.useState(!1),[F,O]=b.useState(""),[W,ie]=b.useState(""),[J,X]=b.useState(!1),[G,se]=b.useState(""),[de,ce]=b.useState(!1),[ye,ze]=b.useState(null),[Oe,ct]=b.useState(!1),[Lt,jn]=b.useState(!1),[it,Mt]=b.useState({readWeight:50,recencyWeight:30,payWeight:20}),[ne,Pe]=b.useState(!1),[et,xt]=b.useState(!1),[pt,mt]=b.useState(1),[wt,Qt]=b.useState([]),[_t,Mn]=b.useState(!1),[At,Kn]=b.useState([]),[ns,or]=b.useState(!1),[xe,we]=b.useState(20),[qn,Es]=b.useState(!1),[Ts,Pa]=b.useState(!1),[br,Vi]=b.useState([]),[vr,lr]=b.useState([]),[Ms,Oa]=b.useState(!1),[Hi,Qs]=b.useState(null),[Nt,Gn]=b.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""}),[Da,As]=b.useState(null),Nr=b.useRef(null),[Wi,Xs]=b.useState({}),[nc,Jn]=b.useState(!1),[Zs,rs]=b.useState(""),[Ar,La]=b.useState(""),[ea,Ui]=b.useState([]),[cr,Ki]=b.useState(0),[ss,rc]=b.useState(1),[Vo,qi]=b.useState(!1),un=pV(t),as=t.length,Is=10,_a=Math.max(1,Math.ceil(wt.length/Is)),It=wt.slice((pt-1)*Is,pt*Is),zn=async()=>{r(!0);try{const T=await Le("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(T==null?void 0:T.sections)?T.sections:[])}catch(T){console.error(T),e([])}finally{r(!1)}},Vr=async()=>{Mn(!0);try{const T=await Le("/api/db/book?action=ranking",{cache:"no-store"}),Y=Array.isArray(T==null?void 0:T.sections)?T.sections:[];Qt(Y);const fe=Y.filter(pe=>pe.isPinned).map(pe=>pe.id);Kn(fe)}catch(T){console.error(T),Qt([])}finally{Mn(!1)}};b.useEffect(()=>{zn(),Vr()},[]);const Ho=T=>{i(Y=>Y.includes(T)?Y.filter(fe=>fe!==T):[...Y,T])},za=b.useCallback(T=>{const Y=t,fe=T.flatMap(pe=>{const nt=Y.find(yt=>yt.id===pe.id);return nt?[{...nt,partId:pe.partId,partTitle:pe.partTitle,chapterId:pe.chapterId,chapterTitle:pe.chapterTitle}]:[]});return e(fe),Tt("/api/db/book",{action:"reorder",items:T}).then(pe=>{pe&&pe.success===!1&&(e(Y),oe.error("排序失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误")))}).catch(pe=>{e(Y),console.error("排序失败:",pe),oe.error("排序失败: "+(pe instanceof Error?pe.message:"网络或服务异常"))}),Promise.resolve()},[t]),sc=async T=>{if(confirm(`确定要删除章节「${T.title}」吗?此操作不可恢复。`))try{const Y=await Na(`/api/db/book?id=${encodeURIComponent(T.id)}`);Y&&Y.success!==!1?(oe.success("已删除"),zn(),Vr()):oe.error("删除失败: "+(Y&&typeof Y=="object"&&"error"in Y?Y.error:"未知错误"))}catch(Y){console.error(Y),oe.error("删除失败")}},Gi=b.useCallback(async()=>{Pe(!0);try{const T=await Le("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),Y=T&&T.data;Y&&typeof Y.readWeight=="number"&&typeof Y.recencyWeight=="number"&&typeof Y.payWeight=="number"&&Mt({readWeight:Math.round(Y.readWeight*100),recencyWeight:Math.round(Y.recencyWeight*100),payWeight:Math.round(Y.payWeight*100)})}catch{}finally{Pe(!1)}},[]);b.useEffect(()=>{Lt&&Gi()},[Lt,Gi]);const $a=async()=>{const{readWeight:T,recencyWeight:Y,payWeight:fe}=it,pe=T+Y+fe;if(Math.abs(pe-100)>1){oe.error("三个权重之和必须等于 100%");return}xt(!0);try{const nt=await vt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:T/100,recencyWeight:Y/100,payWeight:fe/100},description:"文章排名算法权重"});nt&&nt.success!==!1?(oe.success("排名权重已保存,排行榜已刷新"),zn(),Vr()):oe.error("保存失败: "+(nt&&typeof nt=="object"&&"error"in nt?nt.error:""))}catch(nt){console.error(nt),oe.error("保存失败")}finally{xt(!1)}},dr=b.useCallback(async()=>{or(!0);try{const T=await Le("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),Y=T&&T.data;Array.isArray(Y)&&Kn(Y)}catch{}finally{or(!1)}},[]),is=b.useCallback(async()=>{try{const T=await Le("/api/db/persons");T!=null&&T.success&&T.persons&&Vi(T.persons.map(Y=>{const fe=Y.deviceGroups,pe=Array.isArray(fe)?fe.join(","):fe??"";return{id:Y.token??Y.personId??"",personId:Y.personId,name:Y.name,aliases:Y.aliases??"",label:Y.label??"",ckbApiKey:Y.ckbApiKey??"",ckbPlanId:Y.ckbPlanId,remarkType:Y.remarkType,remarkFormat:Y.remarkFormat,addFriendInterval:Y.addFriendInterval,startTime:Y.startTime,endTime:Y.endTime,deviceGroups:pe}}))}catch{}},[]),$n=b.useCallback(async T=>{const Y=T==null?void 0:T.trim();if(!Y)return null;try{const fe=await vt("/api/db/persons",{name:Y});if(!(fe!=null&&fe.success)||!fe.person)return null;const pe=fe.person;return is(),{id:pe.token??pe.personId??"",personId:pe.personId,name:pe.name??Y,label:pe.label??""}}catch{return oe.error("创建人物失败"),null}},[is]),Wo=b.useCallback(async()=>{try{const T=await Le("/api/db/ckb-person-leads");if(T!=null&&T.success&&T.byPerson){const Y={};for(const fe of T.byPerson)Y[fe.token]=fe.total;Xs(Y)}}catch{}},[]),Fa=b.useCallback(async(T,Y,fe=1)=>{rs(T),La(Y),Jn(!0),rc(fe),qi(!0);try{const pe=await Le(`/api/db/ckb-person-leads?token=${encodeURIComponent(T)}&page=${fe}&pageSize=20`);pe!=null&&pe.success&&(Ui(pe.records||[]),Ki(pe.total||0),pe.personName&&La(pe.personName))}catch{}finally{qi(!1)}},[]),ta=b.useCallback(async()=>{try{const T=await Le("/api/db/link-tags");T!=null&&T.success&&T.linkTags&&lr(T.linkTags.map(Y=>({id:Y.tagId,label:Y.label,aliases:Y.aliases??"",url:Y.url,type:Y.type||"url",appId:Y.appId||"",pagePath:Y.pagePath||""})))}catch{}},[]),Rs=async T=>{const Y=At.includes(T)?At.filter(fe=>fe!==T):[...At,T];Kn(Y);try{await vt("/api/db/config",{key:"pinned_section_ids",value:Y,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),Vr()}catch{Kn(At)}},Ps=b.useCallback(async()=>{Es(!0);try{const T=await Le("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),Y=T&&T.data;typeof Y=="number"&&Y>0&&Y<=100&&we(Y)}catch{}finally{Es(!1)}},[]),Os=async()=>{if(xe<1||xe>100){oe.error("预览比例需在 1~100 之间");return}Pa(!0);try{const T=await vt("/api/db/config",{key:"unpaid_preview_percent",value:xe,description:"小程序未付费内容默认预览比例(%)"});T&&T.success!==!1?oe.success("预览比例已保存"):oe.error("保存失败: "+(T.error||""))}catch{oe.error("保存失败")}finally{Pa(!1)}};b.useEffect(()=>{dr(),Ps(),is(),ta(),Wo()},[dr,Ps,is,ta,Wo]);const Ds=async T=>{ze({section:T,orders:[]}),ct(!0);try{const Y=await Le(`/api/db/book?action=section-orders&id=${encodeURIComponent(T.id)}`),fe=Y!=null&&Y.success&&Array.isArray(Y.orders)?Y.orders:[];ze(pe=>pe?{...pe,orders:fe}:null)}catch(Y){console.error(Y),ze(fe=>fe?{...fe,orders:[]}:null)}finally{ct(!1)}},$=async T=>{m(!0);try{const Y=await Le(`/api/db/book?action=read&id=${encodeURIComponent(T.id)}`);if(Y!=null&&Y.success&&Y.section){const fe=Y.section,pe=fe.editionPremium===!0;c({id:T.id,originalId:T.id,title:Y.section.title??T.title,price:Y.section.price??T.price,content:Y.section.content??"",filePath:T.filePath,isFree:T.isFree||T.price===0,isNew:fe.isNew??T.isNew,isPinned:At.includes(T.id),hotScore:T.hotScore??0,editionStandard:pe?!1:fe.editionStandard??!0,editionPremium:pe,previewPercent:fe.previewPercent??null})}else c({id:T.id,originalId:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree,isNew:T.isNew,isPinned:At.includes(T.id),hotScore:T.hotScore??0,editionStandard:!0,editionPremium:!1,previewPercent:null}),Y&&!Y.success&&oe.error("无法读取文件内容: "+(Y.error||"未知错误"))}catch(Y){console.error(Y),c({id:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree})}finally{m(!1)}},Te=async()=>{var T;if(o){y(!0);try{let Y=o.content||"";Y=ww(Y,br,vr);const fe=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(T=o.title)==null?void 0:T.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Ls of fe)Y=Y.replace(Ls,"");Y=Y.replace(/^\s*\n+/,"").trim();const pe=o.originalId||o.id,nt=o.id!==pe,yt=o.previewPercent,An=yt!=null&&yt!==0&&Number(yt)>=1&&Number(yt)<=100,hn=await Tt("/api/db/book",{id:pe,...nt?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:Y,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,editionStandard:o.editionPremium?!1:o.editionStandard??!0,editionPremium:o.editionPremium??!1,...An?{previewPercent:Number(yt)}:{clearPreviewPercent:!0},saveToFile:!0}),ra=nt?o.id:pe;o.isPinned!==At.includes(ra)&&await Rs(ra),hn&&hn.success!==!1?(oe.success(`已保存:${o.title}`),c(null),zn()):oe.error("保存失败: "+(hn&&typeof hn=="object"&&"error"in hn?hn.error:"未知错误"))}catch(Y){console.error(Y),oe.error("保存失败")}finally{y(!1)}}},Ge=async()=>{if(!I.id||!I.title){oe.error("请填写章节ID和标题");return}y(!0);try{const T=un.find(pe=>pe.id===I.partId),Y=T==null?void 0:T.chapters.find(pe=>pe.id===I.chapterId),fe=await Tt("/api/db/book",{id:I.id,title:I.title,price:I.isFree?0:I.price,content:ww(I.content||"",br,vr),partId:I.partId,partTitle:(T==null?void 0:T.title)??"",chapterId:I.chapterId,chapterTitle:(Y==null?void 0:Y.title)??"",isFree:I.isFree,isNew:I.isNew,editionStandard:I.editionPremium?!1:I.editionStandard??!0,editionPremium:I.editionPremium??!1,hotScore:I.hotScore??0,saveToFile:!1});if(fe&&fe.success!==!1){if(I.isPinned){const pe=[...At,I.id];Kn(pe);try{await vt("/api/db/config",{key:"pinned_section_ids",value:pe,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}oe.success(`章节创建成功:${I.title}`),h(!1),P({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),zn()}else oe.error("创建失败: "+(fe&&typeof fe=="object"&&"error"in fe?fe.error:"未知错误"))}catch(T){console.error(T),oe.error("创建失败")}finally{y(!1)}},dt=T=>{P(Y=>{var fe;return{...Y,partId:T.id,chapterId:((fe=T.chapters[0])==null?void 0:fe.id)??"chapter-1"}}),h(!0)},xn=T=>{L({id:T.id,title:T.title})},kn=async()=>{var T;if((T=B==null?void 0:B.title)!=null&&T.trim()){D(!0);try{const Y=t.map(pe=>({id:pe.id,partId:pe.partId||"part-1",partTitle:pe.partId===B.id?B.title.trim():pe.partTitle||"",chapterId:pe.chapterId||"chapter-1",chapterTitle:pe.chapterTitle||""})),fe=await Tt("/api/db/book",{action:"reorder",items:Y});if(fe&&fe.success!==!1){const pe=B.title.trim();e(nt=>nt.map(yt=>yt.partId===B.id?{...yt,partTitle:pe}:yt)),L(null),zn()}else oe.error("更新篇名失败: "+(fe&&typeof fe=="object"&&"error"in fe?fe.error:"未知错误"))}catch(Y){console.error(Y),oe.error("更新篇名失败")}finally{D(!1)}}},Uo=T=>{const Y=T.chapters.length+1,fe=`chapter-${T.id}-${Y}-${Date.now()}`;P({id:`${Y}.1`,title:"新章节",price:1,partId:T.id,chapterId:fe,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},Xt=(T,Y)=>{he({part:T,chapter:Y,title:Y.title})},st=async()=>{var T;if((T=K==null?void 0:K.title)!=null&&T.trim()){z(!0);try{const Y=t.map(pe=>({id:pe.id,partId:pe.partId||K.part.id,partTitle:pe.partId===K.part.id?K.part.title:pe.partTitle||"",chapterId:pe.chapterId||K.chapter.id,chapterTitle:pe.partId===K.part.id&&pe.chapterId===K.chapter.id?K.title.trim():pe.chapterTitle||""})),fe=await Tt("/api/db/book",{action:"reorder",items:Y});if(fe&&fe.success!==!1){const pe=K.title.trim(),nt=K.part.id,yt=K.chapter.id;e(An=>An.map(hn=>hn.partId===nt&&hn.chapterId===yt?{...hn,chapterTitle:pe}:hn)),he(null),zn()}else oe.error("保存失败: "+(fe&&typeof fe=="object"&&"error"in fe?fe.error:"未知错误"))}catch(Y){console.error(Y),oe.error("保存失败")}finally{z(!1)}}},Ba=async(T,Y)=>{const fe=Y.sections.map(pe=>pe.id);if(fe.length===0){oe.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${T.chapters.indexOf(Y)+1}章 | ${Y.title}」吗?将删除共 ${fe.length} 节,此操作不可恢复。`))try{for(const pe of fe)await Na(`/api/db/book?id=${encodeURIComponent(pe)}`);zn()}catch(pe){console.error(pe),oe.error("删除失败")}},Va=async()=>{if(!G.trim()){oe.error("请输入篇名");return}ce(!0);try{const T=`part-new-${Date.now()}`,Y="chapter-1",fe=`part-placeholder-${Date.now()}`,pe=await Tt("/api/db/book",{id:fe,title:"占位节(可编辑)",price:0,content:"",partId:T,partTitle:G.trim(),chapterId:Y,chapterTitle:"第1章 | 待编辑",saveToFile:!1});pe&&pe.success!==!1?(oe.success(`篇「${G}」创建成功`),te(!1),se(""),zn()):oe.error("创建失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(T){console.error(T),oe.error("创建失败")}finally{ce(!1)}},ls=async()=>{if(V.length===0){oe.error("请先勾选要移动的章节");return}const T=un.find(fe=>fe.id===F),Y=T==null?void 0:T.chapters.find(fe=>fe.id===W);if(!T||!Y||!F||!W){oe.error("请选择目标篇和章");return}X(!0);try{const fe=()=>{const An=new Set(V),hn=t.map(rn=>({id:rn.id,partId:rn.partId||"",partTitle:rn.partTitle||"",chapterId:rn.chapterId||"",chapterTitle:rn.chapterTitle||""})),ra=hn.filter(rn=>An.has(rn.id)).map(rn=>({...rn,partId:F,partTitle:T.title||F,chapterId:W,chapterTitle:Y.title||W})),Ls=hn.filter(rn=>!An.has(rn.id));let ac=Ls.length;for(let rn=Ls.length-1;rn>=0;rn-=1){const Ha=Ls[rn];if(Ha.partId===F&&Ha.chapterId===W){ac=rn+1;break}}return[...Ls.slice(0,ac),...ra,...Ls.slice(ac)]},pe=async()=>{const An=fe(),hn=await Tt("/api/db/book",{action:"reorder",items:An});return hn&&hn.success!==!1?(oe.success(`已移动 ${V.length} 节到「${T.title}」-「${Y.title}」`),q(!1),U([]),await zn(),!0):!1},nt={action:"move-sections",sectionIds:V,targetPartId:F,targetChapterId:W,targetPartTitle:T.title||F,targetChapterTitle:Y.title||W},yt=await Tt("/api/db/book",nt);if(yt&&yt.success!==!1)oe.success(`已移动 ${yt.count??V.length} 节到「${T.title}」-「${Y.title}」`),q(!1),U([]),await zn();else{const An=yt&&typeof yt=="object"&&"error"in yt?yt.error||"":"未知错误";if((An.includes("缺少 id")||An.includes("无效的 action"))&&await pe())return;oe.error("移动失败: "+An)}}catch(fe){console.error(fe),oe.error("移动失败: "+(fe instanceof Error?fe.message:"网络或服务异常"))}finally{X(!1)}},Ko=T=>{U(Y=>Y.includes(T)?Y.filter(fe=>fe!==T):[...Y,T])},qo=async T=>{const Y=t.filter(fe=>fe.partId===T.id).map(fe=>fe.id);if(Y.length===0){oe.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${T.title}」整篇吗?将删除共 ${Y.length} 节内容,此操作不可恢复。`))try{for(const fe of Y)await Na(`/api/db/book?id=${encodeURIComponent(fe)}`);zn()}catch(fe){console.error(fe),oe.error("删除失败")}},na=async()=>{var T;if(v.trim()){E(!0);try{const Y=await Le(`/api/search?q=${encodeURIComponent(v)}`);Y!=null&&Y.success&&((T=Y.data)!=null&&T.results)?k(Y.data.results):(k([]),Y&&!Y.success&&oe.error("搜索失败: "+Y.error))}catch(Y){console.error(Y),k([]),oe.error("搜索失败")}finally{E(!1)}}},Ji=un.find(T=>T.id===I.partId),Yi=(Ji==null?void 0:Ji.chapters)??[];return 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.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",un.length," 篇 · ",as," 节内容"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(re,{onClick:()=>jn(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Pu,{className:"w-4 h-4 mr-2"}),"排名算法"]}),s.jsxs(re,{onClick:()=>{const T=typeof window<"u"?`${window.location.origin}/api-doc`:"";T&&window.open(T,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),s.jsx(Bt,{open:u,onOpenChange:h,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Vt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"章节ID *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:I.id,onChange:T=>P({...I,id:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:I.isFree?0:I.price,onChange:T=>P({...I,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:I.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:I.isFree,onChange:T=>P({...I,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:I.isNew,onChange:T=>P({...I,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:I.isPinned,onChange:T=>P({...I,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:I.editionPremium!==!0,onChange:()=>P({...I,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:I.editionPremium===!0,onChange:()=>P({...I,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"热度分"}),s.jsx(le,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:I.hotScore??0,onChange:T=>P({...I,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:I.title,onChange:T=>P({...I,title:T.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"所属篇"}),s.jsxs(Sl,{value:I.partId,onValueChange:T=>{var fe;const Y=un.find(pe=>pe.id===T);P({...I,partId:T,chapterId:((fe=Y==null?void 0:Y.chapters[0])==null?void 0:fe.id)??"chapter-1"})},children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{})}),s.jsxs(po,{className:"bg-[#0f2137] border-gray-700",children:[un.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),un.length===0&&s.jsx(Dr,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"所属章"}),s.jsxs(Sl,{value:I.chapterId,onValueChange:T=>P({...I,chapterId:T}),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{})}),s.jsxs(po,{className:"bg-[#0f2137] border-gray-700",children:[Yi.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),Yi.length===0&&s.jsx(Dr,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(Ox,{content:I.content||"",onChange:T=>P({...I,content:T}),onImageUpload:async T=>{var nt;const Y=new FormData;Y.append("file",T),Y.append("folder","book-images");const pe=await(await fetch(wa("/api/upload"),{method:"POST",body:Y,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=pe==null?void 0:pe.data)==null?void 0:nt.url)||(pe==null?void 0:pe.url)||""},onVideoUpload:async T=>{var nt;const Y=new FormData;Y.append("file",T),Y.append("folder","book-videos");const pe=await(await fetch(wa("/api/upload/video"),{method:"POST",body:Y,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=pe==null?void 0:pe.data)==null?void 0:nt.url)||(pe==null?void 0:pe.url)||""},persons:br,linkTags:vr,onPersonCreate:$n,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(ln,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(re,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(re,{onClick:Ge,disabled:g||!I.id||!I.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Bt,{open:!!B,onOpenChange:T=>!T&&L(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),B&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"篇名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:B.title,onChange:T=>L({...B,title:T.target.value}),placeholder:"输入篇名"})]})}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",onClick:()=>L(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(re,{onClick:kn,disabled:R||!((cs=B==null?void 0:B.title)!=null&&cs.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:R?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Bt,{open:!!K,onOpenChange:T=>!T&&he(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),K&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:K.title,onChange:T=>he({...K,title:T.target.value}),placeholder:"输入章节名称"})]})}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",onClick:()=>he(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(re,{onClick:st,disabled:ge||!((ds=K==null?void 0:K.title)!=null&&ds.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ge?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Bt,{open:M,onOpenChange:T=>{var Y;if(q(T),T&&un.length>0){const fe=un[0];O(fe.id),ie(((Y=fe.chapters[0])==null?void 0:Y.id)??"")}},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:V.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"目标篇"}),s.jsxs(Sl,{value:F,onValueChange:T=>{var fe;O(T);const Y=un.find(pe=>pe.id===T);ie(((fe=Y==null?void 0:Y.chapters[0])==null?void 0:fe.id)??"")},children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择篇"})}),s.jsx(po,{className:"bg-[#0f2137] border-gray-700",children:un.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"目标章"}),s.jsxs(Sl,{value:W,onValueChange:ie,children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择章"})}),s.jsx(po,{className:"bg-[#0f2137] border-gray-700",children:(((us=un.find(T=>T.id===F))==null?void 0:us.chapters)??[]).map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]})]}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",onClick:()=>q(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(re,{onClick:ls,disabled:J||V.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:J?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Bt,{open:!!ye,onOpenChange:T=>!T&&ze(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white",children:["付款记录 — ",(ye==null?void 0:ye.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Oe?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):ye&&ye.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):ye?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"py-2 pr-2",children:"订单号"}),s.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),s.jsx("th",{className:"py-2 pr-2",children:"金额"}),s.jsx("th",{className:"py-2 pr-2",children:"状态"}),s.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),s.jsx("tbody",{children:ye.orders.map(T=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${T.orderSn}`,onClick:()=>window.open(`/orders?search=${T.orderSn??T.id??""}`,"_blank"),children:T.orderSn?T.orderSn.length>16?T.orderSn.slice(0,8)+"..."+T.orderSn.slice(-6):T.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${T.userId??T.openId??""}`,onClick:()=>window.open(`/users?search=${T.userId??T.openId??""}`,"_blank"),children:(()=>{const Y=T.userId??T.openId??"-";return Y.length>12?Y.slice(0,6)+"..."+Y.slice(-4):Y})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",T.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:T.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:T.payTime??T.createdAt??"-"})]},T.id??T.orderSn??""))})]}):null})]})}),s.jsx(Bt,{open:Lt,onOpenChange:jn,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Pu,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsx("p",{className:"text-sm text-gray-400",children:"排名积分制:三个维度各取前20名(第1名=20分,第20名=1分),乘以权重后求和(三权重之和须为 100%)"}),ne?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"阅读权重 (%)"}),s.jsx(le,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.readWeight,onChange:T=>Mt(Y=>({...Y,readWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"新度权重 (%)"}),s.jsx(le,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.recencyWeight,onChange:T=>Mt(Y=>({...Y,recencyWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"付款权重 (%)"}),s.jsx(le,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.payWeight,onChange:T=>Mt(Y=>({...Y,payWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]})]}),s.jsxs("p",{className:`text-xs ${Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1?"text-red-400":"text-green-400"}`,children:["当前之和: ",it.readWeight+it.recencyWeight+it.payWeight,"%",Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1?"(须为 100%)":" ✓"]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量排名前20:第1名=20分 → 第20名=1分,其余0分"}),s.jsx("li",{children:"新度排名前20(按最近更新):同理20→1分"}),s.jsx("li",{children:"付款量排名前20:同理20→1分"}),s.jsx("li",{children:"热度 = 阅读排名分 × 阅读权重% + 新度排名分 × 新度权重% + 付款排名分 × 付款权重%"})]}),s.jsx(re,{onClick:$a,disabled:et||Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:et?"保存中...":"保存权重"})]})]})]})}),s.jsx(Bt,{open:_,onOpenChange:te,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(pn,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:G,onChange:T=>se(T.target.value),placeholder:"输入篇名"})]})}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",onClick:()=>{te(!1),se("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(re,{onClick:Va,disabled:de||!G.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:de?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Bt,{open:!!o,onOpenChange:()=>c(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Vt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"章节ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:T=>c({...o,id:T.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:T=>c({...o,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:o.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:T=>c({...o,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:T=>c({...o,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:T=>c({...o,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium!==!0,onChange:()=>c({...o,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium===!0,onChange:()=>c({...o,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"热度分"}),s.jsx(le,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:T=>c({...o,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"预览比例 (%)"}),s.jsx(le,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"默认使用全局设置",value:o.previewPercent!=null&&o.previewPercent>=1&&o.previewPercent<=100?String(o.previewPercent):"",onChange:T=>{const Y=T.target.value.trim(),fe=Y===""?null:parseInt(Y,10);c({...o,previewPercent:Y!==""&&fe!==null&&!isNaN(fe)&&fe>=1&&fe<=100?fe:null})}}),s.jsx("span",{className:"text-xs text-gray-500",children:"未付费用户可见前 N% 内容,留空使用全局设置"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"章节标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:T=>c({...o,title:T.target.value})})]}),o.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"文件路径"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(Ox,{ref:Nr,content:o.content||"",onChange:T=>c({...o,content:T}),onImageUpload:async T=>{var nt;const Y=new FormData;Y.append("file",T),Y.append("folder","book-images");const pe=await(await fetch(wa("/api/upload"),{method:"POST",body:Y,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=pe==null?void 0:pe.data)==null?void 0:nt.url)||(pe==null?void 0:pe.url)||""},onVideoUpload:async T=>{var nt;const Y=new FormData;Y.append("file",T),Y.append("folder","book-videos");const pe=await(await fetch(wa("/api/upload/video"),{method:"POST",body:Y,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=pe==null?void 0:pe.data)==null?void 0:nt.url)||(pe==null?void 0:pe.url)||""},persons:br,linkTags:vr,onPersonCreate:$n,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(ln,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&s.jsxs(re,{variant:"outline",onClick:()=>Ds({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(re,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(re,{onClick:Te,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Td,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Jl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(tn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Vg,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(tn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(ka,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(tn,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(tn,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Uv,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(nn,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx($r,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),s.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),s.jsxs("div",{className:"text-center shrink-0",children:[s.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:as}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(re,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(re,{onClick:()=>te(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(re,{variant:"outline",onClick:()=>q(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",V.length," 节)"]})]}),n?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(cV,{parts:un,expandedParts:a,onTogglePart:Ho,onReorder:za,onReadSection:$,onDeleteSection:sc,onAddSectionInPart:dt,onAddChapterInPart:Uo,onDeleteChapter:Ba,onEditPart:xn,onDeletePart:qo,onEditChapter:Xt,selectedSectionIds:V,onToggleSectionSelect:Ko,onShowSectionOrders:Ds,pinnedSectionIds:At})]}),s.jsx(nn,{value:"search",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"内容搜索"})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:v,onChange:T=>w(T.target.value),onKeyDown:T=>T.key==="Enter"&&na()}),s.jsx(re,{onClick:na,disabled:C||!v.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Ue,{className:"w-4 h-4 animate-spin"}):s.jsx(ka,{className:"w-4 h-4"})})]}),N.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",N.length," 个结果"]}),N.filter(T=>T.matchType==="title").length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-amber-400 text-sm font-medium mb-2",children:"标题匹配"}),N.filter(T=>T.matchType==="title").slice(0,3).map(T=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors mb-2",onClick:()=>$({id:T.id,title:T.title,price:T.price??1,filePath:""}),children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:T.id}),s.jsx("span",{className:"text-white",children:T.title}),At.includes(T.id)&&s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]})}),(T.partTitle||T.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[T.partTitle," · ",T.chapterTitle]})]},T.id))]}),N.filter(T=>T.matchType==="content").length>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("p",{className:"text-gray-400 text-sm font-medium mb-2",children:"内容匹配"}),N.filter(T=>T.matchType==="content").map(T=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors mb-2",onClick:()=>$({id:T.id,title:T.title,price:T.price??1,filePath:""}),children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:T.id}),s.jsx("span",{className:"text-white",children:T.title}),At.includes(T.id)&&s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]})}),T.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:T.snippet}),(T.partTitle||T.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[T.partTitle," · ",T.chapterTitle]})]},T.id))]})]})]})]})}),s.jsxs(nn,{value:"ranking",className:"space-y-4",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Pu,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(Ie,{children:s.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ee,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(le,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:xe,onChange:T=>we(Math.max(1,Math.min(100,Number(T.target.value)||20))),disabled:qn}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(re,{size:"sm",onClick:Os,disabled:Ts,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Ts?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",xe,"% 内容"]})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Vg,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",wt.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Vr(),disabled:_t,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Ue,{className:`w-4 h-4 ${_t?"animate-spin":""}`})}),s.jsx(re,{variant:"ghost",size:"sm",disabled:pt<=1||_t,onClick:()=>mt(T=>Math.max(1,T-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(QT,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[pt," / ",_a]}),s.jsx(re,{variant:"ghost",size:"sm",disabled:pt>=_a||_t,onClick:()=>mt(T=>Math.min(_a,T+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(mo,{className:"w-4 h-4"})})]})]})}),s.jsx(Ie,{children:s.jsxs("div",{className:"space-y-0",children:[s.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"排名"}),s.jsx("span",{children:"置顶"}),s.jsx("span",{children:"标题"}),s.jsx("span",{className:"text-right",children:"点击量"}),s.jsx("span",{className:"text-right",children:"付款数"}),s.jsx("span",{className:"text-right",children:"热度"}),s.jsx("span",{className:"text-right",children:"编辑"})]}),It.map((T,Y)=>{const fe=(pt-1)*Is+Y+1,pe=T.isPinned??At.includes(T.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${pe?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${fe<=3?"text-amber-400":"text-gray-500"}`,children:fe<=3?["🥇","🥈","🥉"][fe-1]:`#${fe}`}),s.jsx(re,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${pe?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Rs(T.id),disabled:ns,title:pe?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:pe?s.jsx(xi,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(jA,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:T.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[T.partTitle," · ",T.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:T.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:T.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(T.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(re,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>$({id:T.id,title:T.title,price:T.price,filePath:""}),title:"编辑文章",children:s.jsx(Ft,{className:"w-3 h-3"})})})]},T.id)}),It.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(nn,{value:"link-person",className:"space-y-4",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{className:"pb-3",children:[s.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"添加时自动生成 32 位 token,文章 @ 时存 token;小程序点击 @ 时用 token 兑换真实密钥后加好友"})]}),s.jsxs(Ie,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"添加人物时同步创建存客宝场景获客计划,配置与存客宝 API 获客一致"}),s.jsxs(re,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Qs(null),Oa(!0)},children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[br.length>0&&s.jsxs("div",{className:"flex items-center gap-4 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{className:"w-[200px] shrink-0",children:"token"}),s.jsx("span",{className:"w-24 shrink-0",children:"@的人"}),s.jsx("span",{className:"w-28 shrink-0",children:"别名"}),s.jsx("span",{className:"w-16 shrink-0 text-center",children:"获客数"}),s.jsx("span",{children:"获客计划活动名"})]}),br.map(T=>{const Y=Wi[T.id]||0;return s.jsxs("div",{className:"bg-[#0a1628] rounded px-3 py-2 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-4 text-sm min-w-0",children:[s.jsx("span",{className:"text-gray-400 text-xs font-mono shrink-0 w-[200px] truncate",title:T.id,children:T.id}),s.jsx("span",{className:"text-amber-400 shrink-0 w-24 truncate",title:"@的人",children:T.name}),s.jsx("span",{className:"text-gray-500 shrink-0 w-28 truncate text-xs",title:"别名",children:T.aliases||"-"}),s.jsx("span",{className:`shrink-0 w-16 text-center text-xs font-bold ${Y>0?"text-green-400":"text-gray-600"}`,title:"获客数",children:Y}),s.jsxs("span",{className:"text-white truncate",title:"获客计划活动名",children:["SOUL链接人与事-",T.name]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(re,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const fe=await uV(T.personId||"");if(fe!=null&&fe.success&&fe.person){const pe=fe.person;Qs({id:pe.token??pe.personId,personId:pe.personId,name:pe.name,aliases:pe.aliases??"",label:pe.label??"",ckbApiKey:pe.ckbApiKey??"",remarkType:pe.remarkType,remarkFormat:pe.remarkFormat,addFriendInterval:pe.addFriendInterval,startTime:pe.startTime,endTime:pe.endTime,deviceGroups:pe.deviceGroups})}else Qs(T),fe!=null&&fe.error&&oe.error(fe.error)}catch(fe){console.error(fe),Qs(T),oe.error(fe instanceof Error?fe.message:"加载人物详情失败")}Oa(!0)},children:s.jsx(xA,{className:"w-3 h-3"})}),s.jsx(re,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-green-400 h-6 px-2",title:"查看获客详情",onClick:()=>Fa(T.id,T.name),children:s.jsx(Dn,{className:"w-3 h-3"})}),s.jsx(re,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-amber-400 h-6 px-2",title:"编辑计划(跳转存客宝)",onClick:()=>{const fe=T.ckbPlanId;fe?window.open(`https://h5.ckb.quwanzhi.com/#/scenarios/edit/${fe}`,"_blank"):oe.info("该人物尚未同步存客宝计划,请先保存后等待同步完成")},children:s.jsx(Ta,{className:"w-3 h-3"})}),s.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:"删除(同时删除存客宝对应获客计划)",onClick:async()=>{confirm(`确定删除「SOUL链接人与事-${T.name}」?将同时删除存客宝对应获客计划。`)&&(await Na(`/api/db/persons?personId=${T.personId}`),is())},children:s.jsx(nr,{className:"w-3 h-3"})})]})]},T.id)}),br.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{className:"pb-3",children:[s.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Pu,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(Ie,{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往"," ",s.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]}),s.jsx(nn,{value:"link-tag",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{className:"pb-3",children:[s.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Uv,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(Ie,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"标签ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:Nt.tagId,onChange:T=>Gn({...Nt,tagId:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"显示文字"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:Nt.label,onChange:T=>Gn({...Nt,label:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"别名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"逗号分隔",value:Nt.aliases,onChange:T=>Gn({...Nt,aliases:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"类型"}),s.jsxs(Sl,{value:Nt.type,onValueChange:T=>Gn({...Nt,type:T}),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:s.jsx(Cl,{})}),s.jsxs(po,{children:[s.jsx(Dr,{value:"url",children:"网页链接"}),s.jsx(Dr,{value:"miniprogram",children:"小程序"}),s.jsx(Dr,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:Nt.type==="url"?"URL地址":Nt.type==="ckb"?"存客宝计划URL":"AppID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:Nt.type==="url"?"https://...":Nt.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"wx...",value:Nt.type==="url"||Nt.type==="ckb"?Nt.url:Nt.appId,onChange:T=>{Nt.type==="url"||Nt.type==="ckb"?Gn({...Nt,url:T.target.value}):Gn({...Nt,appId:T.target.value})}})]}),Nt.type==="miniprogram"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"页面路径"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:Nt.pagePath,onChange:T=>Gn({...Nt,pagePath:T.target.value})})]}),s.jsxs(re,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!Nt.tagId||!Nt.label){oe.error("标签ID和显示文字必填");return}const T={...Nt};T.type==="miniprogram"&&(T.url=""),await vt("/api/db/link-tags",T),Gn({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""}),As(null),ta()},children:[s.jsx(pn,{className:"w-3 h-3 mr-1"}),Da?"保存":"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[vr.map(T=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[s.jsxs("button",{type:"button",className:"text-amber-400 font-bold text-base hover:underline",onClick:()=>{Gn({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",pagePath:T.pagePath??""}),As(T.id)},children:["#",T.label]}),s.jsx(Ke,{variant:"secondary",className:`text-[10px] ${T.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:T.type==="url"?"网页":T.type==="ckb"?"存客宝":"小程序"}),T.type==="miniprogram"?s.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[T.appId," ",T.pagePath?`· ${T.pagePath}`:""]}):T.url?s.jsxs("a",{href:T.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[T.url," ",s.jsx(Ta,{className:"w-3 h-3 shrink-0"})]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(re,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-6 px-2",onClick:()=>{Gn({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",pagePath:T.pagePath??""}),As(T.id)},children:"编辑"}),s.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Na(`/api/db/link-tags?tagId=${T.id}`),Da===T.id&&(As(null),Gn({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""})),ta()},children:s.jsx(nr,{className:"w-3 h-3"})})]})]},T.id)),vr.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]})})]}),s.jsx(fV,{open:Ms,onOpenChange:Oa,editingPerson:Hi,onSubmit:async T=>{var pe;const Y={personId:T.personId||T.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:T.name,aliases:T.aliases||void 0,label:T.label,ckbApiKey:T.ckbApiKey||void 0,greeting:T.greeting||void 0,tips:T.tips||void 0,remarkType:T.remarkType||void 0,remarkFormat:T.remarkFormat||void 0,addFriendInterval:T.addFriendInterval,startTime:T.startTime||void 0,endTime:T.endTime||void 0,deviceGroups:(pe=T.deviceGroups)!=null&&pe.trim()?T.deviceGroups.split(",").map(nt=>parseInt(nt.trim(),10)).filter(nt=>!Number.isNaN(nt)):void 0},fe=await vt("/api/db/persons",Y);if(fe&&fe.success===!1){const nt=fe;nt.ckbResponse&&console.log("存客宝返回",nt.ckbResponse);const yt=nt.error||"操作失败";throw new Error(yt)}if(is(),oe.success(Hi?"已保存":"已添加"),fe!=null&&fe.ckbCreateResult&&Object.keys(fe.ckbCreateResult).length>0){const nt=fe.ckbCreateResult;console.log("存客宝创建结果",nt);const yt=nt.planId??nt.id,An=yt!=null?[`planId: ${yt}`]:[];nt.apiKey!=null&&An.push("apiKey: ***"),oe.info(An.length?`存客宝创建结果:${An.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Bt,{open:nc,onOpenChange:Jn,children:s.jsxs(Rt,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-5 h-5 text-green-400"}),Ar," — 获客详情(共 ",cr," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:Vo?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):ea.length===0?s.jsx("div",{className:"text-gray-500 text-sm py-8 text-center",children:"暂无获客记录"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-[60px_1fr_100px_100px_80px_120px] gap-2 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"#"}),s.jsx("span",{children:"昵称/姓名"}),s.jsx("span",{children:"手机"}),s.jsx("span",{children:"微信"}),s.jsx("span",{children:"来源"}),s.jsx("span",{children:"时间"})]}),ea.map((T,Y)=>s.jsxs("div",{className:"grid grid-cols-[60px_1fr_100px_100px_80px_120px] gap-2 px-3 py-2 bg-[#0a1628] rounded text-sm",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:(ss-1)*20+Y+1}),s.jsx("span",{className:"text-white truncate",children:T.nickname||T.name||T.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:T.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:T.wechatId||"-"}),s.jsx("span",{className:"text-gray-500 text-xs",children:T.source==="article_mention"?"文章@":T.source==="index_lead"?"首页":T.source||"-"}),s.jsx("span",{className:"text-gray-500 text-xs",children:T.createdAt?new Date(T.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},T.id))]})}),cr>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(re,{size:"sm",variant:"outline",disabled:ss<=1,onClick:()=>Fa(Zs,Ar,ss-1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"上一页"}),s.jsxs("span",{className:"text-gray-400 text-xs",children:[ss," / ",Math.ceil(cr/20)]}),s.jsx(re,{size:"sm",variant:"outline",disabled:ss>=Math.ceil(cr/20),onClick:()=>Fa(Zs,Ar,ss+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const va={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function jw(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):va.stats}function kw(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):va.highlights}function gV(){const[t,e]=b.useState(va),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Le("/api/admin/author-settings").then(k=>{const C=k==null?void 0:k.data;C&&typeof C=="object"&&e({name:String(C.name??va.name),avatar:String(C.avatar??va.avatar),avatarImg:String(C.avatarImg??""),title:String(C.title??va.title),bio:String(C.bio??va.bio),stats:jw(C.stats).length?jw(C.stats):va.stats,highlights:kw(C.highlights).length?kw(C.highlights):va.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{i(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(I=>I.label||I.value),highlights:t.highlights.filter(Boolean)},C=await vt("/api/admin/author-settings",k);if(!C||C.success===!1){oe.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:""));return}i(!1);const E=document.createElement("div");E.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",E.textContent="作者设置已保存",document.body.appendChild(E),setTimeout(()=>E.remove(),2e3)}catch(k){console.error(k),oe.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var E;const C=(E=k.target.files)==null?void 0:E[0];if(C){c(!0);try{const I=new FormData;I.append("file",C),I.append("folder","avatars");const P=Sd(),B={};P&&(B.Authorization=`Bearer ${P}`);const R=await(await fetch(wa("/api/upload"),{method:"POST",body:I,credentials:"include",headers:B})).json();R!=null&&R.success&&(R!=null&&R.url)?e(D=>({...D,avatarImg:R.url})):oe.error("上传失败: "+((R==null?void 0:R.error)||"未知错误"))}catch(I){console.error(I),oe.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(C=>({...C,stats:C.stats.filter((E,I)=>I!==k)})),y=(k,C,E)=>e(I=>({...I,stats:I.stats.map((P,B)=>B===k?{...P,[C]:E}:P)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),w=k=>e(C=>({...C,highlights:C.highlights.filter((E,I)=>I!==k)})),N=(k,C)=>e(E=>({...E,highlights:E.highlights.map((I,P)=>P===k?C:I)}));return n?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(No,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(re,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"flex items-center gap-2 text-white",children:[s.jsx(No,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Ot,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(Ie,{className:"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(ee,{className:"text-gray-300",children:"姓名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(C=>({...C,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(C=>({...C,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ej,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(C=>({...C,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(re,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[s.jsx(xh,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ts(t.avatarImg.startsWith("http")?t.avatarImg:wa(t.avatarImg)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"头衔"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(C=>({...C,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"个人简介"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(C=>({...C,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsx(Ze,{className:"text-white",children:"统计数据"}),s.jsx(Ot,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(Ie,{className:"space-y-3",children:[t.stats.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:E=>y(C,"label",E.target.value),placeholder:"标签"}),s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:E=>y(C,"value",E.target.value),placeholder:"数值"}),s.jsx(re,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(C),children:s.jsx(nr,{className:"w-4 h-4"})})]},C)),s.jsxs(re,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsx(Ze,{className:"text-white",children:"亮点标签"}),s.jsx(Ot,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(Ie,{className:"space-y-3",children:[t.highlights.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:E=>N(C,E.target.value),placeholder:"5年私域运营经验"}),s.jsx(re,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>w(C),children:s.jsx(nr,{className:"w-4 h-4"})})]},C)),s.jsxs(re,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function xV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=c0(h,300),[g,y]=b.useState(!0),[v,w]=b.useState(null),[N,k]=b.useState(!1),[C,E]=b.useState(null),[I,P]=b.useState(""),[B,L]=b.useState(""),[R,D]=b.useState(""),[_,te]=b.useState("admin"),[K,he]=b.useState("active"),[ge,z]=b.useState(!1);async function V(){var W;y(!0),w(null);try{const ie=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&ie.set("search",m.trim());const J=await Le(`/api/admin/admin-users?${ie}`);J!=null&&J.success?(e(J.records||[]),r(J.total??0),u(J.totalPages??0)):w(J.error||"加载失败")}catch(ie){const J=ie;w(J.status===403?"无权限访问":((W=J==null?void 0:J.data)==null?void 0:W.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{V()},[a,o,m]);const U=()=>{E(null),P(""),L(""),D(""),te("admin"),he("active"),k(!0)},M=W=>{E(W),P(W.username),L(""),D(W.name||""),te(W.role==="super_admin"?"super_admin":"admin"),he(W.status==="disabled"?"disabled":"active"),k(!0)},q=async()=>{var W;if(!I.trim()){w("用户名不能为空");return}if(!C&&!B){w("新建时密码必填,至少 6 位");return}if(B&&B.length<6){w("密码至少 6 位");return}w(null),z(!0);try{if(C){const ie=await Tt("/api/admin/admin-users",{id:C.id,password:B||void 0,name:R.trim(),role:_,status:K});ie!=null&&ie.success?(k(!1),V()):w((ie==null?void 0:ie.error)||"保存失败")}else{const ie=await vt("/api/admin/admin-users",{username:I.trim(),password:B,name:R.trim(),role:_});ie!=null&&ie.success?(k(!1),V()):w((ie==null?void 0:ie.error)||"保存失败")}}catch(ie){const J=ie;w(((W=J==null?void 0:J.data)==null?void 0:W.error)||"保存失败")}finally{z(!1)}},F=async W=>{var ie;if(confirm("确定删除该管理员?"))try{const J=await Na(`/api/admin/admin-users?id=${W}`);J!=null&&J.success?V():w((J==null?void 0:J.error)||"删除失败")}catch(J){const X=J;w(((ie=X==null?void 0:X.data)==null?void 0:ie.error)||"删除失败")}},O=W=>{if(!W)return"-";try{const ie=new Date(W);return isNaN(ie.getTime())?W:ie.toLocaleString("zh-CN")}catch{return W}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(qc,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{placeholder:"搜索用户名/昵称",value:h,onChange:W=>f(W.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(re,{variant:"outline",size:"sm",onClick:V,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(Ue,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(re,{onClick:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),v&&s.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[s.jsx("span",{children:v}),s.jsx("button",{type:"button",onClick:()=>w(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"ID"}),s.jsx(Ce,{className:"text-gray-400",children:"用户名"}),s.jsx(Ce,{className:"text-gray-400",children:"昵称"}),s.jsx(Ce,{className:"text-gray-400",children:"角色"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-gray-400",children:"创建时间"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(W=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(ve,{className:"text-gray-300",children:W.id}),s.jsx(ve,{className:"text-white font-medium",children:W.username}),s.jsx(ve,{className:"text-gray-400",children:W.name||"-"}),s.jsx(ve,{children:s.jsx(Ke,{variant:"outline",className:W.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:W.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(ve,{children:s.jsx(Ke,{variant:"outline",className:W.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:W.status==="active"?"正常":"已禁用"})}),s.jsx(ve,{className:"text-gray-500 text-sm",children:O(W.createdAt)}),s.jsxs(ve,{className:"text-right",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>M(W),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>F(W.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(er,{className:"w-4 h-4"})})]})]},W.id)),t.length===0&&!g&&s.jsx(lt,{children:s.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:v==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(ws,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Bt,{open:N,onOpenChange:k,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:C?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"用户名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:I,onChange:W=>P(W.target.value),disabled:!!C}),C&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:C?"新密码(留空不改)":"密码"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:C?"留空表示不修改":"至少 6 位",value:B,onChange:W=>L(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"昵称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:R,onChange:W=>D(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:_,onChange:W=>te(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),C&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:K,onChange:W=>he(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(ln,{children:[s.jsxs(re,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(re,{onClick:q,disabled:ge,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),ge?"保存中...":"保存"]})]})]})})]})}function bn({method:t,url:e,desc:n,headers:r,body:a,response:i}){const o=t==="GET"?"text-emerald-400":t==="POST"?"text-amber-400":t==="PUT"?"text-blue-400":t==="DELETE"?"text-rose-400":"text-gray-400";return s.jsxs("div",{className:"rounded-lg bg-[#0a1628]/60 border border-gray-700/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:`font-mono font-semibold ${o}`,children:t}),s.jsx("code",{className:"text-sm text-[#38bdac] break-all",children:e})]}),n&&s.jsx("p",{className:"text-gray-400 text-sm",children:n}),r&&r.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Headers"}),s.jsx("pre",{className:"text-xs text-gray-300 font-mono overflow-x-auto p-2 rounded bg-black/30",children:r.join(` -`)})]}),a&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Request Body (JSON)"}),s.jsx("pre",{className:"text-xs text-green-400/90 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:a})]}),i&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Response Example"}),s.jsx("pre",{className:"text-xs text-amber-200/80 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:i})]})]})}function V4(){const t=["Authorization: Bearer {token}","Content-Type: application/json"];return s.jsxs("div",{className:"p-8 w-full bg-[#0a1628] text-white",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"内容管理相关接口 · RESTful · 基础路径 /api · 管理端需 Bearer Token"})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(tj,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(Ie,{className:"space-y-4",children:s.jsx(bn,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ - "username": "admin", - "password": "your_password" -}`,response:`{ - "success": true, - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", - "expires_at": "2026-03-16T12:00:00Z" -}`})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx($r,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsx(bn,{method:"GET",url:"/api/db/book?action=chapters",desc:"获取章节树",headers:t,response:`{ - "success": true, - "data": [ - { "id": "part-1", "title": "第一篇", "children": [...] }, - { "id": "section-1", "title": "第1节", "price": 1.0, "isFree": false } - ] -}`}),s.jsx(bn,{method:"GET",url:"/api/db/book?action=section&id={id}",desc:"获取单篇内容",headers:t,response:`{ - "success": true, - "data": { - "id": "section-1", - "title": "标题", - "content": "正文...", - "price": 1.0, - "isFree": false, - "partId": "part-1", - "chapterId": "ch-1" - } -}`}),s.jsx(bn,{method:"POST",url:"/api/db/book",desc:"新建章节 (action=create-section)",headers:t,body:`{ - "action": "create-section", - "title": "新章节标题", - "content": "正文内容", - "price": 0, - "isFree": true, - "partId": "part-1", - "chapterId": "ch-1", - "partTitle": "第一篇", - "chapterTitle": "第1章" -}`,response:`{ - "success": true, - "data": { "id": "section-new-id", "title": "新章节标题", ... } -}`}),s.jsx(bn,{method:"POST",url:"/api/db/book",desc:"更新章节内容 (action=update-section)",headers:t,body:`{ - "action": "update-section", - "id": "section-1", - "title": "更新后的标题", - "content": "更新后的正文", - "price": 1.0, - "isFree": false -}`,response:`{ - "success": true, - "data": { "id": "section-1", "title": "更新后的标题", ... } -}`}),s.jsx(bn,{method:"POST",url:"/api/db/book",desc:"删除章节 (action=delete-section)",headers:t,body:`{ - "action": "delete-section", - "id": "section-1" -}`,response:`{ - "success": true, - "message": "已删除" -}`}),s.jsx(bn,{method:"POST",url:"/api/admin/content/upload",desc:"上传图片(管理端)",headers:t,body:"FormData: file (binary)",response:`{ - "success": true, - "url": "/uploads/images/xxx.jpg", - "data": { "url", "fileName", "size", "type" } -}`})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(No,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsx(bn,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ - "success": true, - "data": [ - { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } - ] -}`}),s.jsx(bn,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ - "success": true, - "data": { - "personId": "p1", - "label": "张三", - "aliases": ["老张"], - "description": "..." - } -}`}),s.jsx(bn,{method:"POST",url:"/api/db/persons",desc:"新增/更新人物(含 aliases 字段)",headers:t,body:`{ - "personId": "p1", - "label": "张三", - "aliases": ["老张", "张三丰"], - "description": "可选描述" -}`,response:`{ - "success": true, - "data": { "personId": "p1", "label": "张三", ... } -}`}),s.jsx(bn,{method:"DELETE",url:"/api/db/persons?personId={id}",desc:"删除人物",headers:t,response:`{ - "success": true, - "message": "已删除" -}`})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Gc,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsx(bn,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ - "success": true, - "data": [ - { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } - ] -}`}),s.jsx(bn,{method:"POST",url:"/api/db/link-tags",desc:"新增/更新标签(含 aliases, type: url/miniprogram/ckb)",headers:t,body:`{ - "tagId": "t1", - "label": "官网", - "aliases": ["官方网站"], - "type": "url", - "url": "https://example.com" -} - -// type 可选: url | miniprogram | ckb`,response:`{ - "success": true, - "data": { "tagId": "t1", "label": "官网", "type": "url", ... } -}`}),s.jsx(bn,{method:"DELETE",url:"/api/db/link-tags?tagId={id}",desc:"删除标签",headers:t,response:`{ - "success": true, - "message": "已删除" -}`})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(ka,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(Ie,{className:"space-y-4",children:s.jsx(bn,{method:"GET",url:"/api/search?q={keyword}",desc:"搜索(标题优先 3 条 + 内容匹配)",headers:t,response:`{ - "success": true, - "data": { - "titleMatches": [{ "id": "s1", "title": "...", "snippet": "..." }], - "contentMatches": [{ "id": "s2", "title": "...", "snippet": "..." }] - } -}`})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Vg,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(Ie,{className:"space-y-4",children:s.jsx(bn,{method:"GET",url:"/api/db/book?action=ranking",desc:"排行榜数据",headers:t,response:`{ - "success": true, - "data": [ - { "id": "s1", "title": "...", "clickCount": 100, "payCount": 50, "hotScore": 120, "hotRank": 1 } - ] -}`})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{className:"pb-3",children:s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Ol,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsx(bn,{method:"GET",url:"/api/miniprogram/book/all-chapters",desc:"全部章节(小程序用)",headers:["Content-Type: application/json"],response:`{ - "success": true, - "data": [ { "id": "s1", "title": "...", "price": 1.0, "isFree": false }, ... ] -}`}),s.jsx(bn,{method:"GET",url:"/api/miniprogram/balance?userId={id}",desc:"查余额",headers:["Content-Type: application/json"],response:`{ - "success": true, - "data": { "balance": 100.50, "userId": "xxx" } -}`}),s.jsx(bn,{method:"POST",url:"/api/miniprogram/balance/gift",desc:"代付",headers:["Content-Type: application/json"],body:`{ - "userId": "xxx", - "amount": 10.00, - "remark": "可选备注" -}`,response:`{ - "success": true, - "data": { "balance": 110.50 } -}`}),s.jsx(bn,{method:"POST",url:"/api/miniprogram/balance/gift/redeem",desc:"领取代付",headers:["Content-Type: application/json"],body:`{ - "code": "GIFT_XXXX" -}`,response:`{ - "success": true, - "data": { "amount": 10.00, "balance": 120.50 } -}`})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-6",children:"管理端仅使用 /api/admin/*、/api/db/*;小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const yV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},bV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},vV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...bV},ckbLeadApiKey:""},NV={endpoint:"",accessKeyId:"",accessKeySecret:"",bucket:"",region:""},wV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},jV=["system","author","admin","api-docs"];function kV(){const[t,e]=qw(),n=t.get("tab")??"system",r=jV.includes(n)?n:"system",[a,i]=b.useState(vV),[o,c]=b.useState(wV),[u,h]=b.useState(yV),[f,m]=b.useState(NV),[g,y]=b.useState(!1),[v,w]=b.useState(!0),[N,k]=b.useState(!1),[C,E]=b.useState(""),[I,P]=b.useState(""),[B,L]=b.useState(!1),[R,D]=b.useState(!1),_=(M,q,F=!1)=>{E(M),P(q),L(F),k(!0)};b.useEffect(()=>{(async()=>{try{const q=await Le("/api/admin/settings");if(!q||q.success===!1)return;if(q.featureConfig&&Object.keys(q.featureConfig).length&&c(F=>({...F,...q.featureConfig})),q.mpConfig&&typeof q.mpConfig=="object"&&h(F=>({...F,...q.mpConfig})),q.ossConfig&&typeof q.ossConfig=="object"&&m(F=>({...F,...q.ossConfig})),q.siteSettings&&typeof q.siteSettings=="object"){const F=q.siteSettings;i(O=>({...O,...typeof F.sectionPrice=="number"&&{sectionPrice:F.sectionPrice},...typeof F.baseBookPrice=="number"&&{baseBookPrice:F.baseBookPrice},...typeof F.distributorShare=="number"&&{distributorShare:F.distributorShare},...F.authorInfo&&typeof F.authorInfo=="object"&&{authorInfo:{...O.authorInfo,...F.authorInfo}},...typeof F.ckbLeadApiKey=="string"&&{ckbLeadApiKey:F.ckbLeadApiKey}}))}}catch(q){console.error("Load settings error:",q)}finally{w(!1)}})()},[]);const te=async(M,q)=>{D(!0);try{const F=await vt("/api/admin/settings",{featureConfig:M});if(!F||F.success===!1){q(),_("保存失败",(F==null?void 0:F.error)??"未知错误",!0);return}_("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(F){console.error("Save feature config error:",F),q(),_("保存失败",F instanceof Error?F.message:String(F),!0)}finally{D(!1)}},K=(M,q)=>{const F=o,O={...F,[M]:q};c(O),te(O,()=>c(F))},[he,ge]=b.useState(!1),z=async M=>{const q=u,F={...q,auditMode:M};h(F),ge(!0);try{const O=await vt("/api/admin/settings",{mp_config:F});if(!O||O.success===!1){h(q),_("保存失败",(O==null?void 0:O.error)??"未知错误",!0);return}_("已保存",M?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(O){h(q),_("保存失败",O instanceof Error?O.message:String(O),!0)}finally{ge(!1)}},V=async()=>{y(!0);try{const M=await vt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:a.sectionPrice,baseBookPrice:a.baseBookPrice,distributorShare:a.distributorShare,authorInfo:a.authorInfo,ckbLeadApiKey:a.ckbLeadApiKey||void 0},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10},ossConfig:{endpoint:f.endpoint||"",accessKeyId:f.accessKeyId||"",accessKeySecret:f.accessKeySecret||"",bucket:f.bucket||"",region:f.region||""}});if(!M||M.success===!1){_("保存失败",(M==null?void 0:M.error)??"未知错误",!0);return}_("已保存","设置已保存成功。")}catch(M){console.error("Save settings error:",M),_("保存失败",M instanceof Error?M.message:String(M),!0)}finally{y(!1)}},U=M=>{e(M==="system"?{}:{tab:M})};return v?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-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&s.jsxs(re,{onClick:V,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存设置"]})]}),s.jsxs(Td,{value:r,onValueChange:U,className:"w-full",children:[s.jsxs(Jl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(vo,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(tn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Pm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(tn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(qc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(tn,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"API 文档"]})]}),s.jsx(nn,{value:"system",className:"mt-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Pm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Ot,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Pm,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(le,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.name??"",onChange:M=>i(q=>({...q,authorInfo:{...q.authorInfo,name:M.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Og,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(le,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:a.authorInfo.startDate??"",onChange:M=>i(q=>({...q,authorInfo:{...q.authorInfo,startDate:M.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Og,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(le,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:a.authorInfo.liveTime??"",onChange:M=>i(q=>({...q,authorInfo:{...q.authorInfo,liveTime:M.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(nj,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(le,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:a.authorInfo.platform??"",onChange:M=>i(q=>({...q,authorInfo:{...q.authorInfo,platform:M.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx($r,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(le,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.description??"",onChange:M=>i(q=>({...q,authorInfo:{...q.authorInfo,description:M.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(Yl,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:a.authorInfo.bio??"",onChange:M=>i(q=>({...q,authorInfo:{...q.authorInfo,bio:M.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ns,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(le,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:a.ckbLeadApiKey??"",onChange:M=>i(q=>({...q,ckbLeadApiKey:M.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(a.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:a.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:a.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",a.authorInfo.liveTime," · ",a.authorInfo.platform]})]})]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(gh,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(Ie,{className:"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(ee,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.sectionPrice,onChange:M=>i(q=>({...q,sectionPrice:Number.parseFloat(M.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.baseBookPrice,onChange:M=>i(q=>({...q,baseBookPrice:Number.parseFloat(M.target.value)||9.9}))})]})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Ol,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Ot,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsx(Ie,{className:"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(ee,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:M=>h(q=>({...q,appId:M.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:M=>h(q=>({...q,withdrawSubscribeTmplId:M.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:M=>h(q=>({...q,mchId:M.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:M=>h(q=>({...q,minWithdraw:Number.parseFloat(M.target.value)||10}))})]})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(cM,{className:"w-5 h-5 text-[#38bdac]"}),"阿里云 OSS 配置"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置阿里云对象存储,用于图片和视频的云端存储(配置后将替代本地存储)"})]}),s.jsxs(Ie,{className:"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(ee,{className:"text-gray-300",children:"Endpoint"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:f.endpoint??"",onChange:M=>m(q=>({...q,endpoint:M.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"Region"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:f.region??"",onChange:M=>m(q=>({...q,region:M.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"LTAI5t...",value:f.accessKeyId??"",onChange:M=>m(q=>({...q,accessKeyId:M.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"********",value:f.accessKeySecret??"",onChange:M=>m(q=>({...q,accessKeySecret:M.target.value}))})]}),s.jsxs("div",{className:"space-y-2 col-span-2",children:[s.jsx(ee,{className:"text-gray-300",children:"Bucket 名称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"my-soul-bucket",value:f.bucket??"",onChange:M=>m(q=>({...q,bucket:M.target.value}))})]})]}),s.jsx("div",{className:`p-3 rounded-lg ${f.endpoint&&f.bucket&&f.accessKeyId?"bg-green-500/10 border border-green-500/30":"bg-amber-500/10 border border-amber-500/30"}`,children:s.jsx("p",{className:`text-xs ${f.endpoint&&f.bucket&&f.accessKeyId?"text-green-300":"text-amber-300"}`,children:f.endpoint&&f.bucket&&f.accessKeyId?`✅ OSS 已配置(${f.bucket}.${f.endpoint}),上传将自动使用云端存储`:"⚠ 未配置 OSS,当前上传存储在本地服务器。填写以上信息并保存后自动启用云端存储"})})]})]}),s.jsxs(Ae,{className:`bg-[#0f2137] shadow-xl ${u.auditMode?"border-amber-500/50 border-2":"border-gray-700/50"}`,children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(qc,{className:"w-5 h-5 text-amber-400"}),"小程序审核模式"]}),s.jsx(Ot,{className:"text-gray-400",children:"提交微信审核前开启,审核通过后关闭即可恢复支付功能"})]}),s.jsx(Ie,{children:s.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg border ${u.auditMode?"bg-amber-500/10 border-amber-500/30":"bg-[#0a1628] border-gray-700/50"}`,children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qc,{className:`w-4 h-4 ${u.auditMode?"text-amber-400":"text-gray-400"}`}),s.jsx(ee,{htmlFor:"audit-mode",className:"text-white font-medium cursor-pointer",children:u.auditMode?"审核模式(已开启)":"审核模式(已关闭)"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:u.auditMode?"当前已隐藏所有支付、VIP、充值、收益等入口,审核员看不到任何付费内容":"关闭状态,小程序正常显示所有功能(含支付、VIP 等)"})]}),s.jsx(kt,{id:"audit-mode",checked:u.auditMode??!1,disabled:he,onCheckedChange:z})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(vo,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Ot,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Dn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ee,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(kt,{id:"match-enabled",checked:o.matchEnabled,disabled:R,onCheckedChange:M=>K("matchEnabled",M)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(kM,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ee,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),s.jsx(kt,{id:"referral-enabled",checked:o.referralEnabled,disabled:R,onCheckedChange:M=>K("referralEnabled",M)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($r,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ee,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),s.jsx(kt,{id:"search-enabled",checked:o.searchEnabled,disabled:R,onCheckedChange:M=>K("searchEnabled",M)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(vo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ee,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(kt,{id:"about-enabled",checked:o.aboutEnabled,disabled:R,onCheckedChange:M=>K("aboutEnabled",M)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),s.jsx(nn,{value:"author",className:"mt-0",children:s.jsx(gV,{})}),s.jsx(nn,{value:"admin",className:"mt-0",children:s.jsx(xV,{})}),s.jsx(nn,{value:"api-docs",className:"mt-0",children:s.jsx(V4,{})})]}),s.jsx(Bt,{open:N,onOpenChange:k,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Vt,{children:[s.jsx(Ht,{className:B?"text-red-400":"text-[#38bdac]",children:C}),s.jsx(Qj,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:I})]}),s.jsx(ln,{className:"mt-4",children:s.jsx(re,{onClick:()=>k(!1),className:B?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Sw={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function SV(){const[t,e]=b.useState(!1),[n,r]=b.useState(Sw),[a,i]=b.useState(""),o=async()=>{e(!0);try{const k=await Le("/api/config");k!=null&&k.paymentMethods&&r({...Sw,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await vt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),oe.success("配置已保存!")}catch(k){console.error("保存失败:",k),oe.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,C)=>{navigator.clipboard.writeText(k),i(C),setTimeout(()=>i(""),2e3)},h=(k,C)=>{r(E=>({...E,wechat:{...E.wechat,[k]:C}}))},f=(k,C)=>{r(E=>({...E,alipay:{...E.alipay,[k]:C}}))},m=(k,C)=>{r(E=>({...E,usdt:{...E.usdt,[k]:C}}))},g=(k,C)=>{r(E=>({...E,paypal:{...E.paypal,[k]:C}}))},y=n.wechat,v=n.alipay,w=n.usdt,N=n.paypal;return 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.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(re,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(re,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Yw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),s.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[s.jsx("li",{children:"打开微信,进入目标微信群"}),s.jsx("li",{children:'点击右上角"..." → "群二维码"'}),s.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),s.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),s.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),s.jsxs(Td,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Jl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(tn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(Ol,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(tn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(Wv,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(tn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(Vv,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(tn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx($g,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(nn,{value:"wechat",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ze,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Ol,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(kt,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(Ie,{className:"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(ee,{className:"text-gray-300",children:"网站AppID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"商户号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ta,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),s.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[s.jsx(ee,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(le,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(nn,{value:"alipay",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ze,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(Wv,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Ot,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(kt,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(Ie,{className:"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(ee,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(re,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:a==="pid"?s.jsx(vf,{className:"w-4 h-4 text-green-500"}):s.jsx(Xw,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ta,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(nn,{value:"usdt",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ze,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(Vv,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(kt,{checked:!!w.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(w.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"收款地址"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(w.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(nn,{value:"paypal",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ze,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx($g,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(kt,{checked:!!N.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(N.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const CV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},EV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},TV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function MV(){const[t,e]=b.useState({siteConfig:{...CV},menuConfig:{...EV},pageConfig:{...TV}}),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{Le("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{i(!0);try{await vt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await vt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await vt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),oe.success("配置已保存")}catch(f){console.error(f),oe.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{i(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return 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.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(re,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx($g,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(Ie,{className:"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(ee,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(le,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(le,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(le,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(le,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(le,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(pA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(Ie,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(ee,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(le,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),s.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(oA,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Ot,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(Ie,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(kt,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(NM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(Ie,{className:"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(ee,{className:"text-gray-300",children:"首页标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"首页副标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"目录页标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"我的页标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function AV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[a,i]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,w,N;try{const k=await Le("/api/config"),C=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(C)&&e(C.join(` -`));const E=(N=(w=k==null?void 0:k.paymentMethods)==null?void 0:w.wechat)==null?void 0:N.groupQrCode;E&&r(E),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,v)=>{navigator.clipboard.writeText(y),i(v),setTimeout(()=>i(""),2e3)},f=async()=>{try{const y=t.split(` -`).map(w=>w.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await vt("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),oe.success("群活码配置已保存!"),await u()}catch(y){console.error(y),oe.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await vt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),oe.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),oe.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},g=()=>{n?window.open(n,"_blank"):oe.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Yw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Kv,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Ot,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Fg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(le,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:y=>r(y.target.value)}),s.jsx(re,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(vf,{className:"w-4 h-4 text-green-500"}):s.jsx(Xw,{className:"w-4 h-4 text-gray-400"})})]}),s.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[s.jsx(Ta,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(re,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(xh,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(re,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(Ta,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Kv,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Fg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(Yl,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` -`).filter(Boolean).length," 个"]})]}),s.jsxs(re,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xh,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),s.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[s.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),s.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),s.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const Cw={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},IV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function RV(){const[t,e]=b.useState(Cw),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const E=await Le("/api/db/config/full?key=match_config"),I=(E==null?void 0:E.data)??(E==null?void 0:E.config);I&&e({...Cw,...I})}catch(E){console.error("加载匹配配置失败:",E)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{i(!0);try{const E=await vt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});E&&E.success!==!1?oe.success("配置保存成功!"):oe.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:"未知错误"))}catch(E){console.error("保存配置失败:",E),oe.error("保存失败")}finally{i(!1)}},v=E=>{h(E),m({id:E.id,label:E.label,matchLabel:E.matchLabel,icon:E.icon,matchFromDB:E.matchFromDB,showJoinAfterMatch:E.showJoinAfterMatch,price:E.price,enabled:E.enabled}),c(!0)},w=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},N=()=>{if(!f.id||!f.label){oe.error("请填写类型ID和名称");return}const E=[...t.matchTypes];if(u){const I=E.findIndex(P=>P.id===u.id);I!==-1&&(E[I]={...f})}else{if(E.some(I=>I.id===f.id)){oe.error("类型ID已存在");return}E.push({...f})}e({...t,matchTypes:E}),c(!1)},k=E=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(I=>I.id!==E)})},C=E=>{e({...t,matchTypes:t.matchTypes.map(I=>I.id===E?{...I,enabled:!I.enabled}:I)})};return s.jsxs("div",{className:"p-8 w-full space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(vo,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(re,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(re,{onClick:y,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ie,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(le,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:E=>e({...t,freeMatchLimit:parseInt(E.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(le,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:E=>e({...t,matchPrice:parseFloat(E.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(le,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:E=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(E.target.value,10)||10}})}),s.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:t.settings.enableFreeMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enableFreeMatches:E}})}),s.jsx(ee,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:t.settings.enablePaidMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enablePaidMatches:E}})}),s.jsx(ee,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(re,{onClick:w,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(Ie,{children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"图标"}),s.jsx(Ce,{className:"text-gray-400",children:"类型ID"}),s.jsx(Ce,{className:"text-gray-400",children:"显示名称"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Ce,{className:"text-gray-400",children:"价格"}),s.jsx(Ce,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(gr,{children:t.matchTypes.map(E=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ve,{children:s.jsx("span",{className:"text-2xl",children:E.icon})}),s.jsx(ve,{className:"font-mono text-gray-300",children:E.id}),s.jsx(ve,{className:"text-white font-medium",children:E.label}),s.jsx(ve,{className:"text-gray-300",children:E.matchLabel}),s.jsx(ve,{children:s.jsxs(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",E.price]})}),s.jsx(ve,{children:E.matchFromDB?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(ve,{children:s.jsx(kt,{checked:E.enabled,onCheckedChange:()=>C(E.id)})}),s.jsx(ve,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(E),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>k(E.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},E.id))})]})})]}),s.jsx(Bt,{open:o,onOpenChange:c,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[u?s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:E=>m({...f,id:E.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:IV.map(E=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===E?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:E}),children:E},E))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"显示名称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:E=>m({...f,label:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"匹配标签"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:E=>m({...f,matchLabel:E.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(le,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:E=>m({...f,price:parseFloat(E.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:f.matchFromDB,onCheckedChange:E=>m({...f,matchFromDB:E})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:f.showJoinAfterMatch,onCheckedChange:E=>m({...f,showJoinAfterMatch:E})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:f.enabled,onCheckedChange:E=>m({...f,enabled:E})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(re,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Ew={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function PV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function v(){m(!0),y(null);try{const N=new URLSearchParams({page:String(a),pageSize:String(o)});u&&N.set("matchType",u);const k=await Le(`/api/db/match-records?${N}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(N){console.error("加载匹配记录失败",N),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[a,u]);const w=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&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:g}),s.jsx("button",{type:"button",onClick:()=>y(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:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:N=>{h(N.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Ew).map(([N,k])=>s.jsx("option",{value:N,children:k},N))]}),s.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"发起人"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(gr,{children:[t.map(N=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ve,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[N.userAvatar?s.jsx("img",{src:ts(N.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:N.userAvatar?"hidden":"",children:(N.userNickname||N.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:N.userNickname||N.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.userId.slice(0,16),"..."]})]})]})}),s.jsx(ve,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[N.matchedUserAvatar?s.jsx("img",{src:ts(N.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:N.matchedUserAvatar?"hidden":"",children:(N.matchedNickname||N.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:N.matchedNickname||N.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(ve,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Ew[N.matchType]||N.matchType})}),s.jsxs(ve,{className:"text-gray-400 text-sm",children:[N.phone&&s.jsxs("div",{children:["📱 ",N.phone]}),N.wechatId&&s.jsxs("div",{children:["💬 ",N.wechatId]}),!N.phone&&!N.wechatId&&"-"]}),s.jsx(ve,{className:"text-gray-400",children:N.createdAt?new Date(N.createdAt).toLocaleString():"-"})]},N.id)),t.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(ws,{page:a,totalPages:w,total:n,pageSize:o,onPageChange:i,onPageSizeChange:N=>{c(N),i(1)}})]})})})]})}function OV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0);async function a(){r(!0);try{const i=await Le("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),oe.error("加载 VIP 成员失败")}finally{r(!1)}}return b.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("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(Ml,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(Ce,{className:"text-gray-400",children:"成员"}),s.jsx(Ce,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(Ce,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(gr,{children:[t.map((i,o)=>{var c;return s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(ve,{className:"text-gray-300",children:o+1}),s.jsx(ve,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:ts(i.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:((c=i.name)==null?void 0:c[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:i.name})})]})}),s.jsx(ve,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(ve,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function H4(t){const[e,n]=b.useState([]),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,v]=b.useState(!1),w=b.useRef(null),N=async R=>{var _;const D=(_=R.target.files)==null?void 0:_[0];if(D){v(!0);try{const te=new FormData;te.append("file",D),te.append("folder","mentors");const K=Sd(),he={};K&&(he.Authorization=`Bearer ${K}`);const z=await(await fetch(wa("/api/upload"),{method:"POST",body:te,credentials:"include",headers:he})).json();z!=null&&z.success&&(z!=null&&z.url)?f(V=>({...V,avatar:z.url})):oe.error("上传失败: "+((z==null?void 0:z.error)||"未知错误"))}catch(te){console.error(te),oe.error("上传失败")}finally{v(!1),w.current&&(w.current.value="")}}};async function k(){a(!0);try{const R=await Le("/api/db/mentors");R!=null&&R.success&&R.data&&n(R.data)}catch(R){console.error("Load mentors error:",R)}finally{a(!1)}}b.useEffect(()=>{k()},[]);const C=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(R=>R.sort))+1:0,enabled:!0})},E=()=>{u(null),C(),o(!0)},I=R=>{u(R),f({name:R.name,avatar:R.avatar||"",intro:R.intro||"",tags:R.tags||"",priceSingle:R.priceSingle!=null?String(R.priceSingle):"",priceHalfYear:R.priceHalfYear!=null?String(R.priceHalfYear):"",priceYear:R.priceYear!=null?String(R.priceYear):"",quote:R.quote||"",whyFind:R.whyFind||"",offering:R.offering||"",judgmentStyle:R.judgmentStyle||"",sort:R.sort,enabled:R.enabled??!0}),o(!0)},P=async()=>{if(!h.name.trim()){oe.error("导师姓名不能为空");return}g(!0);try{const R=_=>_===""?void 0:parseFloat(_),D={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:R(h.priceSingle),priceHalfYear:R(h.priceHalfYear),priceYear:R(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const _=await Tt("/api/db/mentors",{id:c.id,...D});_!=null&&_.success?(o(!1),k()):oe.error("更新失败: "+(_==null?void 0:_.error))}else{const _=await vt("/api/db/mentors",D);_!=null&&_.success?(o(!1),k()):oe.error("新增失败: "+(_==null?void 0:_.error))}}catch(R){console.error("Save error:",R),oe.error("保存失败")}finally{g(!1)}},B=async R=>{if(confirm("确定删除该导师?"))try{const D=await Na(`/api/db/mentors?id=${R}`);D!=null&&D.success?k():oe.error("删除失败: "+(D==null?void 0:D.error))}catch(D){console.error("Delete error:",D),oe.error("删除失败")}},L=R=>R!=null?`¥${R}`:"-";return 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(Dn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(re,{onClick:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:r?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"ID"}),s.jsx(Ce,{className:"text-gray-400",children:"姓名"}),s.jsx(Ce,{className:"text-gray-400",children:"简介"}),s.jsx(Ce,{className:"text-gray-400",children:"单次"}),s.jsx(Ce,{className:"text-gray-400",children:"半年"}),s.jsx(Ce,{className:"text-gray-400",children:"年度"}),s.jsx(Ce,{className:"text-gray-400",children:"排序"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[e.map(R=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(ve,{className:"text-gray-300",children:R.id}),s.jsx(ve,{className:"text-white",children:R.name}),s.jsx(ve,{className:"text-gray-400 max-w-[200px] truncate",children:R.intro||"-"}),s.jsx(ve,{className:"text-gray-400",children:L(R.priceSingle)}),s.jsx(ve,{className:"text-gray-400",children:L(R.priceHalfYear)}),s.jsx(ve,{className:"text-gray-400",children:L(R.priceYear)}),s.jsx(ve,{className:"text-gray-400",children:R.sort}),s.jsxs(ve,{className:"text-right",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>I(R),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>B(R.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(er,{className:"w-4 h-4"})})]})]},R.id)),e.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Bt,{open:i,onOpenChange:o,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:c?"编辑导师":"新增导师"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"姓名 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:R=>f(D=>({...D,name:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"排序"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:R=>f(D=>({...D,sort:parseInt(R.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:R=>f(D=>({...D,avatar:R.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:w,type:"file",accept:"image/*",className:"hidden",onChange:N}),s.jsxs(re,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var R;return(R=w.current)==null?void 0:R.click()},children:[s.jsx(xh,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ts(h.avatar.startsWith("http")?h.avatar:wa(h.avatar)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"简介"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:R=>f(D=>({...D,intro:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:R=>f(D=>({...D,tags:R.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(ee,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(le,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:R=>f(D=>({...D,priceSingle:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(le,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:R=>f(D=>({...D,priceHalfYear:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(le,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:R=>f(D=>({...D,priceYear:R.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"引言"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:R=>f(D=>({...D,quote:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:R=>f(D=>({...D,whyFind:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:R=>f(D=>({...D,offering:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:R=>f(D=>({...D,judgmentStyle:R.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:R=>f(D=>({...D,enabled:R.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(ee,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(ln,{children:[s.jsxs(re,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(re,{onClick:P,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function DV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const h=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",f=await Le(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[a]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return 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(Og,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:h=>i(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>s.jsx("option",{value:h,children:f},h))]}),s.jsxs(re,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"ID"}),s.jsx(Ce,{className:"text-gray-400",children:"用户ID"}),s.jsx(Ce,{className:"text-gray-400",children:"导师ID"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"金额"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(gr,{children:[t.map(h=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(ve,{className:"text-gray-300",children:h.id}),s.jsx(ve,{className:"text-gray-400",children:h.userId}),s.jsx(ve,{className:"text-gray-400",children:h.mentorId}),s.jsx(ve,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(ve,{className:"text-white",children:["¥",h.amount]}),s.jsx(ve,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(ve,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Kc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},Tw={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:Kc},LV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function _V(){const t=Di(),[e,n]=b.useState(Tw),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,v]=b.useState(null),[w,N]=b.useState(!1),k=async()=>{N(!0);try{const D=await Le("/api/db/match-pool-counts");D!=null&&D.success&&D.data&&v(D.data)}catch(D){console.error("加载池子人数失败:",D)}finally{N(!1)}},C=async()=>{a(!0);try{const D=await Le("/api/db/config/full?key=match_config"),_=(D==null?void 0:D.data)??(D==null?void 0:D.config);if(_){let te=_.poolSettings??Kc;te.poolSource&&!Array.isArray(te.poolSource)&&(te={...te,poolSource:[te.poolSource]}),n({...Tw,..._,poolSettings:te})}}catch(D){console.error("加载匹配配置失败:",D)}finally{a(!1)}};b.useEffect(()=>{C(),k()},[]);const E=async()=>{o(!0);try{const D=await vt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});oe.error((D==null?void 0:D.success)!==!1?"配置保存成功!":"保存失败: "+((D==null?void 0:D.error)||"未知错误"))}catch(D){console.error(D),oe.error("保存失败")}finally{o(!1)}},I=D=>{f(D),g({...D}),u(!0)},P=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},B=()=>{if(!m.id||!m.label){oe.error("请填写类型ID和名称");return}const D=[...e.matchTypes];if(h){const _=D.findIndex(te=>te.id===h.id);_!==-1&&(D[_]={...m})}else{if(D.some(_=>_.id===m.id)){oe.error("类型ID已存在");return}D.push({...m})}n({...e,matchTypes:D}),u(!1)},L=D=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(_=>_.id!==D)})},R=D=>{n({...e,matchTypes:e.matchTypes.map(_=>_.id===D?{..._,enabled:!_.enabled}:_)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(re,{variant:"outline",onClick:C,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(re,{onClick:E,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Zw,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Ot,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(Ie,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(ee,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(D=>{const _=e.poolSettings??Kc,K=(Array.isArray(_.poolSource)?_.poolSource:[_.poolSource]).includes(D.value),he=y==null?void 0:y[D.countKey],ge=()=>{const z=Array.isArray(_.poolSource)?[..._.poolSource]:[_.poolSource],V=K?z.filter(U=>U!==D.value):[...z,D.value];V.length===0&&V.push(D.value),n({...e,poolSettings:{..._,poolSource:V}})};return s.jsxs("button",{type:"button",onClick:ge,className:`p-4 rounded-lg border text-left transition-all ${K?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${K?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:K&&"✓"}),s.jsx("span",{className:"text-xl",children:D.icon}),s.jsx("span",{className:`text-sm font-medium ${K?"text-[#38bdac]":"text-gray-300"}`,children:D.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[w?"...":he??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:D.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:z=>{z.stopPropagation(),t(`/users?pool=${D.value}`)},onKeyDown:z=>{z.key==="Enter"&&(z.stopPropagation(),t(`/users?pool=${D.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},D.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(ee,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(D=>{const te=(e.poolSettings??Kc)[D.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(kt,{checked:te,onCheckedChange:K=>n({...e,poolSettings:{...e.poolSettings??Kc,[D.key]:K}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:D.icon}),s.jsx(ee,{className:"text-gray-300 text-sm",children:D.label})]})]},D.key)})})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Xe,{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ie,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(le,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:D=>n({...e,freeMatchLimit:parseInt(D.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(le,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:D=>n({...e,matchPrice:parseFloat(D.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(le,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:D=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(D.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:e.settings.enableFreeMatches,onCheckedChange:D=>n({...e,settings:{...e.settings,enableFreeMatches:D}})}),s.jsx(ee,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:e.settings.enablePaidMatches,onCheckedChange:D=>n({...e,settings:{...e.settings,enablePaidMatches:D}})}),s.jsx(ee,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Ot,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(re,{onClick:P,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(Ie,{children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"图标"}),s.jsx(Ce,{className:"text-gray-400",children:"类型ID"}),s.jsx(Ce,{className:"text-gray-400",children:"显示名称"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Ce,{className:"text-gray-400",children:"价格"}),s.jsx(Ce,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(gr,{children:e.matchTypes.map(D=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ve,{children:s.jsx("span",{className:"text-2xl",children:D.icon})}),s.jsx(ve,{className:"font-mono text-gray-300",children:D.id}),s.jsx(ve,{className:"text-white font-medium",children:D.label}),s.jsx(ve,{className:"text-gray-300",children:D.matchLabel}),s.jsx(ve,{children:s.jsxs(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",D.price]})}),s.jsx(ve,{children:D.matchFromDB?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(ve,{children:s.jsx(kt,{checked:D.enabled,onCheckedChange:()=>R(D.id)})}),s.jsx(ve,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>I(D),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Ft,{className:"w-4 h-4"})}),s.jsx(re,{variant:"ghost",size:"sm",onClick:()=>L(D.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},D.id))})]})})]}),s.jsx(Bt,{open:c,onOpenChange:u,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[h?s.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:D=>g({...m,id:D.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:LV.map(D=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===D?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:D}),children:D},D))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"显示名称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:D=>g({...m,label:D.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"匹配标签"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:D=>g({...m,matchLabel:D.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(le,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:D=>g({...m,price:parseFloat(D.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:m.matchFromDB,onCheckedChange:D=>g({...m,matchFromDB:D})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:m.showJoinAfterMatch,onCheckedChange:D=>g({...m,showJoinAfterMatch:D})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:m.enabled,onCheckedChange:D=>g({...m,enabled:D})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(ln,{children:[s.jsx(re,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(re,{onClick:B,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Mw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function zV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[v,w]=b.useState(null);async function N(){m(!0),y(null);try{const E=new URLSearchParams({page:String(a),pageSize:String(o)});u&&E.set("matchType",u);const I=await Le(`/api/db/match-records?${E}`);I!=null&&I.success?(e(I.records||[]),r(I.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{N()},[a,u]);const k=Math.ceil(n/o)||1,C=({userId:E,nickname:I,avatar:P})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>w(E),children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[P?s.jsx("img",{src:ts(P),alt:"",className:"w-full h-full object-cover",onError:B=>{B.currentTarget.style.display="none"}}):null,s.jsx("span",{className:P?"hidden":"",children:(I||E||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:I||E}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[E==null?void 0:E.slice(0,16),(E==null?void 0:E.length)>16?"...":""]})]})]});return s.jsxs("div",{children:[g&&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:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:E=>{h(E.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Mw).map(([E,I])=>s.jsx("option",{value:E,children:I},E))]}),s.jsxs("button",{type:"button",onClick:N,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"发起人"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(gr,{children:[t.map(E=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ve,{children:s.jsx(C,{userId:E.userId,nickname:E.userNickname,avatar:E.userAvatar})}),s.jsx(ve,{children:E.matchedUserId?s.jsx(C,{userId:E.matchedUserId,nickname:E.matchedNickname,avatar:E.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(ve,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Mw[E.matchType]||E.matchType})}),s.jsxs(ve,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"-"})]}),s.jsx(ve,{className:"text-gray-400",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"})]},E.id)),t.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(ws,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:E=>{c(E),i(1)}})]})})}),s.jsx(l0,{open:!!v,onClose:()=>w(null),userId:v,onUserUpdated:N})]})}function $V(){const[t,e]=b.useState("records");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),s.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&s.jsx(zV,{}),t==="pool"&&s.jsx(_V,{})]})}const Aw={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function FV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function v(){h(!0);try{const C=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),E=await Le(`/api/db/match-records?${C}`);E!=null&&E.success&&(e(E.records||[]),r(E.total??0))}catch(C){console.error(C)}finally{h(!1)}}b.useEffect(()=>{v()},[a,f]);const w=async C=>{if(!C.phone&&!C.wechatId){oe.info("该记录无联系方式,无法推送到存客宝");return}y(C.id);try{const E=await vt("/api/ckb/join",{type:C.matchType||"investor",phone:C.phone||"",wechat:C.wechatId||"",userId:C.userId,name:C.userNickname||""});oe.error((E==null?void 0:E.message)||(E!=null&&E.success?"推送成功":"推送失败"))}catch(E){oe.error("推送失败: "+(E instanceof Error?E.message:"网络错误"))}finally{y(null)}},N=Math.ceil(n/o)||1,k=C=>!!(C.phone||C.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:C=>{m(C.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Aw).map(([C,E])=>s.jsx("option",{value:C,children:E},C))}),s.jsxs(re,{onClick:v,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"发起人"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ce,{className:"text-gray-400",children:"时间"}),s.jsx(Ce,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(C=>{var E,I;return s.jsxs(lt,{className:`border-gray-700/50 ${k(C)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(ve,{className:"text-white",children:C.userNickname||((E=C.userId)==null?void 0:E.slice(0,12))}),s.jsx(ve,{className:"text-white",children:C.matchedNickname||((I=C.matchedUserId)==null?void 0:I.slice(0,12))}),s.jsx(ve,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Aw[C.matchType]||C.matchType})}),s.jsxs(ve,{className:"text-sm",children:[C.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(ve,{className:"text-gray-400 text-sm",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"}),s.jsx(ve,{className:"text-right",children:k(C)?s.jsxs(re,{size:"sm",onClick:()=>w(C),disabled:g===C.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(OA,{className:"w-3 h-3 mr-1"}),g===C.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},C.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(ws,{page:a,totalPages:N,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})})]})}const Iw={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},BV={single:"单次",half_year:"半年",year:"年度"};function VV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const c=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",u=await Le(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[a]),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:c=>i(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(Iw).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(re,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"ID"}),s.jsx(Ce,{className:"text-gray-400",children:"用户ID"}),s.jsx(Ce,{className:"text-gray-400",children:"导师ID"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"金额"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(gr,{children:[t.map(c=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(ve,{className:"text-gray-300",children:c.id}),s.jsx(ve,{className:"text-gray-400",children:c.userId}),s.jsx(ve,{className:"text-gray-400",children:c.mentorId}),s.jsx(ve,{className:"text-gray-400",children:BV[c.consultationType]||c.consultationType}),s.jsxs(ve,{className:"text-white",children:["¥",c.amount]}),s.jsx(ve,{className:"text-gray-400",children:Iw[c.status]||c.status}),s.jsx(ve,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function HV(){const[t,e]=b.useState("booking");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),s.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&s.jsx(VV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(H4,{embedded:!0})})]})}function WV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),y=await Le(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"发起人"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ce,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ce,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(gr,{children:[t.map(g=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ve,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(ve,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(ve,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(ve,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(lt,{children:s.jsx(ve,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(ws,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const Rw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募",join:"加入",match:"匹配"},Pw={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮",join:"📋",match:"🔗"};function UV({onSwitchTab:t,onOpenCKB:e}={}){const n=Di(),[r,a]=b.useState(null),[i,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var g,y;u(!0);try{const[v,w]=await Promise.allSettled([Le("/api/db/match-records?stats=true"),Le("/api/db/ckb-plan-stats")]);if(v.status==="fulfilled"&&((g=v.value)!=null&&g.success)&&v.value.data){let N=v.value.data;if(N.totalMatches>0&&(!N.uniqueUsers||N.uniqueUsers===0))try{const k=await Le("/api/db/match-records?page=1&pageSize=200");if(k!=null&&k.success&&k.records){const C=new Set(k.records.map(E=>E.userId).filter(Boolean));N={...N,uniqueUsers:C.size}}}catch{}a(N)}w.status==="fulfilled"&&((y=w.value)!=null&&y.success)&&w.value.data&&o(w.value.data)}catch(v){console.error("加载统计失败:",v)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=g=>c?"—":String(g??0),m=r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0";return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-5 gap-3",children:[s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.totalMatches)}),s.jsxs("p",{className:"text-[#38bdac] text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(Ta,{className:"w-2.5 h-2.5"})," 查看记录"]})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"今日"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.todayMatches)}),s.jsxs("p",{className:"text-yellow-400/60 text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(yi,{className:"w-2.5 h-2.5"})," 实时"]})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"用户数"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.uniqueUsers)}),s.jsxs("p",{className:"text-blue-400/60 text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(Dn,{className:"w-2.5 h-2.5"})," 查看用户"]})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"人均匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c?"—":m})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"付费匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.paidMatchCount)})]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("h4",{className:"text-sm font-medium text-white mb-3",children:"匹配类型分布"}),r!=null&&r.byType&&r.byType.length>0?s.jsx("div",{className:"space-y-2",children:r.byType.map(g=>{const y=r.totalMatches>0?g.count/r.totalMatches*100:0;return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-lg shrink-0",children:Pw[g.matchType]||"📊"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex justify-between text-xs mb-0.5",children:[s.jsx("span",{className:"text-gray-300",children:Rw[g.matchType]||g.matchType}),s.jsxs("span",{className:"text-gray-500",children:[g.count," (",y.toFixed(0),"%)"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-gray-700/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${Math.min(y,100)}%`}})})]})]},g.matchType)})}):s.jsx("p",{className:"text-gray-500 text-xs",children:"暂无数据"})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/20",children:s.jsxs(Ie,{className:"p-4",children:[s.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-1.5",children:[s.jsx(Ns,{className:"w-4 h-4 text-orange-400"})," AI 获客"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 cursor-pointer hover:border-orange-500/50 border border-transparent transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"已提交线索"}),s.jsx("p",{className:"text-xl font-bold text-white",children:c?"—":(i==null?void 0:i.ckbTotal)??0})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 cursor-pointer hover:border-orange-500/50 border border-transparent transition-colors",onClick:()=>e==null?void 0:e("contact"),children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"有联系方式"}),s.jsx("p",{className:"text-xl font-bold text-white",children:c?"—":(i==null?void 0:i.withContact)??0})]})]}),(i==null?void 0:i.byType)&&i.byType.length>0&&s.jsx("div",{className:"space-y-1.5",children:i.byType.map(g=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{children:Pw[g.matchType]||"📋"}),s.jsx("span",{className:"text-gray-400",children:Rw[g.matchType]||g.matchType}),s.jsx("span",{className:"ml-auto text-white font-medium",children:g.total})]},g.matchType))}),s.jsx("button",{type:"button",onClick:()=>e==null?void 0:e("test"),className:"mt-3 w-full text-xs text-orange-400 hover:text-orange-300 text-center py-1.5 bg-orange-500/10 rounded",children:"查看 AI 添加进度 →"})]})})]})]})}const KV=["partner","investor","mentor","team"],Tg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],Ow=`# 场景获客接口摘要 -- 地址:POST /v1/api/scenarios -- 必填:apiKey、sign、timestamp -- 主标识:phone 或 wechatId 至少一项 -- 可选:name、source、remark、tags、siteTags、portrait -- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function qV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,a]=b.useState("13800000000"),[i,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(Ow),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[w,N]=b.useState([]),[k,C]=b.useState([]),[E,I]=b.useState({}),[P,B]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),L=b.useMemo(()=>{const z={};return Tg.forEach(V=>{z[V.key]=E[V.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),z},[E]),R=z=>{const V=r.trim(),U=i.trim();return z<=3?{type:KV[z],phone:V||void 0,wechat:U||void 0,userId:"admin_test",name:"后台测试"}:z===4?{matchType:"partner",phone:V||void 0,wechat:U||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:z===5?{phone:V||void 0,wechatId:U||void 0,userId:"admin_test",name:"后台测试"}:{}};async function D(){v(!0);try{const[z,V,U]=await Promise.all([Le("/api/db/config/full?key=ckb_config"),Le("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Le("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),M=z==null?void 0:z.data;M!=null&&M.routes&&I(M.routes),M!=null&&M.docNotes&&u(M.docNotes),M!=null&&M.docContent&&f(M.docContent),V!=null&&V.success&&N(V.records||[]),U!=null&&U.success&&C(U.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{D()},[]);async function _(){g(!0);try{const z=await vt("/api/db/config",{key:"ckb_config",value:{routes:L,docNotes:c,docContent:h},description:"存客宝接口配置"});oe.error((z==null?void 0:z.success)!==!1?"存客宝配置已保存":`保存失败: ${(z==null?void 0:z.error)||"未知错误"}`)}catch(z){oe.error(`保存失败: ${z instanceof Error?z.message:"网络错误"}`)}finally{g(!1)}}const te=(z,V)=>{I(U=>({...U,[z]:{...L[z],...V}}))},K=async z=>{const V=P[z];if(V.method==="POST"&&!r.trim()&&!i.trim()){oe.error("请填写测试手机号");return}const U=[...P];U[z]={...V,status:"testing",message:void 0,responseTime:void 0},B(U);const M=performance.now();try{const q=V.method==="GET"?await Le(V.endpoint):await vt(V.endpoint,R(z)),F=Math.round(performance.now()-M),O=(q==null?void 0:q.message)||"",W=(q==null?void 0:q.success)===!0||O.includes("已存在")||O.includes("已加入")||O.includes("已提交"),ie=[...P];ie[z]={...V,status:W?"success":"error",message:O||(W?"正常":"异常"),responseTime:F},B(ie),await D()}catch(q){const F=Math.round(performance.now()-M),O=[...P];O[z]={...V,status:"error",message:q instanceof Error?q.message:"失败",responseTime:F},B(O)}},he=async()=>{if(!r.trim()&&!i.trim()){oe.error("请填写测试手机号");return}for(let z=0;zs.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:z.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:V})}):z.map(U=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:U.userNickname||U.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:U.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:U.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:U.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:U.createdAt?new Date(U.createdAt).toLocaleString():"—"})]},U.id))})]})});return s.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(Ie,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(Ta,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(re,{onClick:()=>D(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(re,{onClick:_,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([z,V])=>s.jsx("button",{type:"button",onClick:()=>n(z),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===z?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:V},z))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:w.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:Tg.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&ge(w,"暂无已提交线索"),e==="contact"&&ge(k,"暂无有联系方式线索"),e==="config"&&s.jsx("div",{className:"space-y-4",children:Tg.map(z=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white font-medium",children:z.label}),s.jsx(Ke,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:z.key})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[z.key].apiUrl,onChange:V=>te(z.key,{apiUrl:V.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[z.key].apiKey,onChange:V=>te(z.key,{apiKey:V.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[z.key].source,onChange:V=>te(z.key,{source:V.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[z.key].tags,onChange:V=>te(z.key,{tags:V.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[z.key].siteTags,onChange:V=>te(z.key,{siteTags:V.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:L[z.key].notes,onChange:V=>te(z.key,{notes:V.target.value})})]})]})]},z.key))}),e==="test"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx(Ol,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:z=>a(z.target.value)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:z=>o(z.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(re,{onClick:he,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(yi,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:P.map((z,V)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[z.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),z.status==="testing"&&s.jsx(Ue,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),z.status==="success"&&s.jsx(Lg,{className:"w-3 h-3 text-green-400 shrink-0"}),z.status==="error"&&s.jsx(Qw,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:z.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[z.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[z.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>K(V),disabled:z.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${z.endpoint}-${V}`))})]}),e==="doc"&&s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),s.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[s.jsx(Ta,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||Ow})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),s.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:z=>u(z.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const GV=[{id:"stats",label:"数据统计",icon:Dg},{id:"partner",label:"找伙伴",icon:Dn},{id:"resource",label:"资源对接",icon:RM},{id:"mentor",label:"导师预约",icon:MM},{id:"team",label:"团队招募",icon:Hg}];function JV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[a,i]=b.useState("overview");return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),s.jsxs(re,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&s.jsx(qV,{initialTab:a}),s.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:GV.map(o=>{const c=t===o.id;return s.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[s.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&s.jsx(UV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx($V,{}),t==="resource"&&s.jsx(FV,{}),t==="mentor"&&s.jsx(HV,{}),t==="team"&&s.jsx(WV,{})]})}function YV(){return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[s.jsx(Ns,{className:"w-8 h-8 text-[#38bdac]"}),s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),s.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"1. 接口总览"})}),s.jsxs(Ie,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),s.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[s.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),s.jsx("li",{children:"/api/miniprogram/upload — 小程序上传(图片/视频、图片压缩)"}),s.jsx("li",{children:"/api/admin/content/upload — 管理端内容导入"}),s.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),s.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),s.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),s.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),s.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),s.jsx("li",{children:"/api/config — 配置系统"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),s.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),s.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"2. 书籍内容"})}),s.jsxs(Ie,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),s.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),s.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"2.1 小程序上传接口"})}),s.jsxs(Ie,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-1",children:"POST /api/miniprogram/upload/image — 图片上传(支持压缩)"}),s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"表单:file(必填)、folder(可选,默认 images)、quality(可选 1-100,默认 85)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"支持 jpeg/png/gif,单张最大 5MB。JPEG 按 quality 压缩。"}),s.jsx("pre",{className:"mt-2 p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:'响应示例: { "success": true, "url": "/uploads/images/xxx.jpg", "data": { "url", "fileName", "size", "type", "quality" } }'})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-1",children:"POST /api/miniprogram/upload/video — 视频上传"}),s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"表单:file(必填)、folder(可选,默认 videos)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"支持 mp4/mov/avi,单个最大 100MB。"}),s.jsx("pre",{className:"mt-2 p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:'响应示例: { "success": true, "url": "/uploads/videos/xxx.mp4", "data": { "url", "fileName", "size", "type", "folder" } }'})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"2.2 管理端内容上传"})}),s.jsxs(Ie,{className:"space-y-3 text-sm",children:[s.jsx("p",{className:"text-gray-400",children:"POST /api/admin/content/upload — 内容导入(需 AdminAuth)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"通过 API 批量导入章节到内容管理,不直接操作数据库。"}),s.jsx("pre",{className:"p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:`请求体: { - "action": "import", - "data": [{ - "id": "ch-001", - "title": "章节标题", - "content": "正文内容", - "price": 1.0, - "isFree": false, - "partId": "part-1", - "partTitle": "第一篇", - "chapterId": "chapter-1", - "chapterTitle": "第1章" - }] -}`}),s.jsxs("p",{className:"text-gray-500 text-xs",children:["响应:",'{ "success": true, "message": "导入完成", "imported": N, "failed": M }']})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"3. 支付"})}),s.jsxs(Ie,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),s.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),s.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"4. 分销与用户"})}),s.jsxs(Ie,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),s.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),s.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Xe,{children:s.jsx(Ze,{className:"text-white",children:"5. 管理后台"})}),s.jsxs(Ie,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),s.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),s.jsx("p",{children:"GET /api/admin/orders — 订单列表"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function QV(){const t=Oi();return s.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:s.jsx(tM,{className:"w-10 h-10"})}),s.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),s.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),s.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),s.jsx(re,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(Pg,{to:"/",children:[s.jsx(BM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function XV(){return s.jsxs(wT,{children:[s.jsx($t,{path:"/login",element:s.jsx(cI,{})}),s.jsxs($t,{path:"/",element:s.jsx(h5,{}),children:[s.jsx($t,{index:!0,element:s.jsx(Im,{to:"/dashboard",replace:!0})}),s.jsx($t,{path:"dashboard",element:s.jsx(bP,{})}),s.jsx($t,{path:"orders",element:s.jsx(vP,{})}),s.jsx($t,{path:"users",element:s.jsx(NP,{})}),s.jsx($t,{path:"distribution",element:s.jsx(HP,{})}),s.jsx($t,{path:"withdrawals",element:s.jsx(WP,{})}),s.jsx($t,{path:"content",element:s.jsx(mV,{})}),s.jsx($t,{path:"referral-settings",element:s.jsx($k,{})}),s.jsx($t,{path:"author-settings",element:s.jsx(Im,{to:"/settings?tab=author",replace:!0})}),s.jsx($t,{path:"vip-roles",element:s.jsx(OV,{})}),s.jsx($t,{path:"mentors",element:s.jsx(H4,{})}),s.jsx($t,{path:"mentor-consultations",element:s.jsx(DV,{})}),s.jsx($t,{path:"admin-users",element:s.jsx(Im,{to:"/settings?tab=admin",replace:!0})}),s.jsx($t,{path:"settings",element:s.jsx(kV,{})}),s.jsx($t,{path:"payment",element:s.jsx(SV,{})}),s.jsx($t,{path:"site",element:s.jsx(MV,{})}),s.jsx($t,{path:"qrcodes",element:s.jsx(AV,{})}),s.jsx($t,{path:"find-partner",element:s.jsx(JV,{})}),s.jsx($t,{path:"match",element:s.jsx(RV,{})}),s.jsx($t,{path:"match-records",element:s.jsx(PV,{})}),s.jsx($t,{path:"api-doc",element:s.jsx(YV,{})}),s.jsx($t,{path:"api-docs",element:s.jsx(V4,{})})]}),s.jsx($t,{path:"*",element:s.jsx(QV,{})})]})}EE.createRoot(document.getElementById("root")).render(s.jsx(b.StrictMode,{children:s.jsx(AT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(XV,{})})})); diff --git a/soul-admin/dist/assets/index-BJTFaSuJ.js b/soul-admin/dist/assets/index-BJTFaSuJ.js new file mode 100644 index 00000000..20085a53 --- /dev/null +++ b/soul-admin/dist/assets/index-BJTFaSuJ.js @@ -0,0 +1,927 @@ +function vE(t,e){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Ow(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nm={exports:{}},Ec={},wm={exports:{}},pt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Nv;function NE(){if(Nv)return pt;Nv=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(L){return L===null||typeof L!="object"?null:(L=m&&L[m]||L["@@iterator"],typeof L=="function"?L:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,j={};function v(L,K,oe){this.props=L,this.context=K,this.refs=j,this.updater=oe||y}v.prototype.isReactComponent={},v.prototype.setState=function(L,K){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,K,"setState")},v.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function k(){}k.prototype=v.prototype;function E(L,K,oe){this.props=L,this.context=K,this.refs=j,this.updater=oe||y}var C=E.prototype=new k;C.constructor=E,N(C,v.prototype),C.isPureReactComponent=!0;var T=Array.isArray,P=Object.prototype.hasOwnProperty,F={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function R(L,K,oe){var Y,X={},W=null,se=null;if(K!=null)for(Y in K.ref!==void 0&&(se=K.ref),K.key!==void 0&&(W=""+K.key),K)P.call(K,Y)&&!D.hasOwnProperty(Y)&&(X[Y]=K[Y]);var de=arguments.length-2;if(de===1)X.children=oe;else if(1>>1,K=I[L];if(0>>1;La(X,V))Wa(se,X)?(I[L]=se,I[W]=V,L=W):(I[L]=X,I[Y]=V,L=Y);else if(Wa(se,V))I[L]=se,I[W]=V,L=W;else break e}}return q}function a(I,q){var V=I.sortIndex-q.sortIndex;return V!==0?V:I.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,y=!1,N=!1,j=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(I){for(var q=n(h);q!==null;){if(q.callback===null)r(h);else if(q.startTime<=I)r(h),q.sortIndex=q.expirationTime,e(u,q);else break;q=n(h)}}function T(I){if(j=!1,C(I),!N)if(n(u)!==null)N=!0,U(P);else{var q=n(h);q!==null&&H(T,q.startTime-I)}}function P(I,q){N=!1,j&&(j=!1,k(R),R=-1),y=!0;var V=g;try{for(C(q),m=n(u);m!==null&&(!(m.expirationTime>q)||I&&!re());){var L=m.callback;if(typeof L=="function"){m.callback=null,g=m.priorityLevel;var K=L(m.expirationTime<=q);q=t.unstable_now(),typeof K=="function"?m.callback=K:m===n(u)&&r(u),C(q)}else r(u);m=n(u)}if(m!==null)var oe=!0;else{var Y=n(h);Y!==null&&H(T,Y.startTime-q),oe=!1}return oe}finally{m=null,g=V,y=!1}}var F=!1,D=null,R=-1,O=5,_=-1;function re(){return!(t.unstable_now()-_I||125L?(I.sortIndex=V,e(h,I),n(u)===null&&I===n(h)&&(j?(k(R),R=-1):j=!0,H(T,V-L))):(I.sortIndex=K,e(u,I),N||y||(N=!0,U(P))),I},t.unstable_shouldYield=re,t.unstable_wrapCallback=function(I){var q=g;return function(){var V=g;g=q;try{return I.apply(this,arguments)}finally{g=V}}}})(Sm)),Sm}var Cv;function SE(){return Cv||(Cv=1,km.exports=kE()),km.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ev;function CE(){if(Ev)return Ir;Ev=1;var t=yd(),e=SE();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function y(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function N(l,d,p,x){if(d===null||typeof d>"u"||y(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,w,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=w,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){v[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];v[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){v[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){v[l]=new j(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){v[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){v[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){v[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){v[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){v[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,E);v[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,E);v[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,E);v[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),v.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var w=v.hasOwnProperty(d)?v[d]:null;(w!==null?w.type!==0:x||!(2B||w[A]!==S[B]){var J=` +`+w[A].replace(" at new "," at ");return l.displayName&&J.includes("")&&(J=J.replace("",l.displayName)),J}while(1<=A&&0<=B);break}}}finally{oe=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?K(l):""}function X(l){switch(l.tag){case 5:return K(l.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return l=Y(l.type,!1),l;case 11:return l=Y(l.type.render,!1),l;case 1:return l=Y(l.type,!0),l;default:return""}}function W(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 F:return"Portal";case O:return"Profiler";case R:return"StrictMode";case he:return"Suspense";case xe:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case re:return(l.displayName||"Context")+".Consumer";case _:return(l._context.displayName||"Context")+".Provider";case ne:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case z:return d=l.displayName||null,d!==null?d:W(l.type)||"Memo";case U:d=l._payload,l=l._init;try{return W(l(d))}catch{}}return null}function se(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 W(d);case 8:return d===R?"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 de(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ce(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function ye(l){var d=ce(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 w=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return w.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 Le(l){l._valueTracker||(l._valueTracker=ye(l))}function Pe(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=ce(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function at(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 Mt(l,d){var p=d.checked;return V({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function on(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=de(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 bt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function nn(l,d){bt(l,d);var p=de(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")?At(l,d.type,p):d.hasOwnProperty("defaultValue")&&At(l,d.type,de(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function In(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 At(l,d,p){(d!=="number"||at(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Jt=Array.isArray;function rn(l,d,p,x){if(l=l.options,d){d={};for(var w=0;w"+d.valueOf().toString()+"",d=qe.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function ct(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var tt={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},gt=["Webkit","ms","Moz","O"];Object.keys(tt).forEach(function(l){gt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),tt[d]=tt[l]})});function Yt(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||tt.hasOwnProperty(l)&&tt[l]?(""+d).trim():d+"px"}function ln(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,w=Yt(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,w):l[p]=w}}var tr=V({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 nr(l,d){if(d){if(tr[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 Ps(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 Or=null;function Os(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var pe=null,ge=null,cn=null;function On(l){if(l=hc(l)){if(typeof pe!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Hd(d),pe(l.stateNode,l.type,d))}}function Zs(l){ge?cn?cn.push(l):cn=[l]:ge=l}function ea(){if(ge){var l=ge,d=cn;if(cn=ge=null,On(l),d)for(l=0;l>>=0,l===0?32:31-(Yl(l)/Fo|0)|0}var aa=64,ia=4194304;function _s(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 oa(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,w=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var B=A&~w;B!==0?x=_s(B):(S&=A,S!==0&&(x=_s(S)))}else A=p&~w,A!==0?x=_s(A):S!==0&&(x=_s(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&w)===0&&(w=x&-x,S=d&-d,w>=S||w===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 Cn(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-_n(d),l[d]=p}function Hi(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=rc),py=" ",my=!1;function gy(l,d){switch(l){case"keyup":return m3.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Wo=!1;function x3(l,d){switch(l){case"compositionend":return xy(d);case"keypress":return d.which!==32?null:(my=!0,py);case"textInput":return l=d.data,l===py&&my?null:l;default:return null}}function y3(l,d){if(Wo)return l==="compositionend"||!tp&&gy(l,d)?(l=ly(),Rd=Jf=_a=null,Wo=!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=ky(p)}}function Cy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Cy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function Ey(){for(var l=window,d=at();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=at(l.document)}return d}function sp(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 E3(l){var d=Ey(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&Cy(p.ownerDocument.documentElement,p)){if(x!==null&&sp(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 w=p.textContent.length,S=Math.min(x.start,w);x=x.end===void 0?S:Math.min(x.end,w),!l.extend&&S>x&&(w=x,x=S,S=w),w=Sy(p,S);var A=Sy(p,x);w&&A&&(l.rangeCount!==1||l.anchorNode!==w.node||l.anchorOffset!==w.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(w.node,w.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,Uo=null,ap=null,oc=null,ip=!1;function Ty(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;ip||Uo==null||Uo!==at(x)||(x=Uo,"selectionStart"in x&&sp(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}),oc&&ic(oc,x)||(oc=x,x=Fd(ap,"onSelect"),0Yo||(l.current=yp[Yo],yp[Yo]=null,Yo--)}function Ft(l,d){Yo++,yp[Yo]=l.current,l.current=d}var Ba={},sr=Fa(Ba),Cr=Fa(!1),Ki=Ba;function Qo(l,d){var p=l.type.contextTypes;if(!p)return Ba;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var w={},S;for(S in p)w[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=w),w}function Er(l){return l=l.childContextTypes,l!=null}function Wd(){qt(Cr),qt(sr)}function Hy(l,d,p){if(sr.current!==Ba)throw Error(n(168));Ft(sr,d),Ft(Cr,p)}function Wy(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var w in x)if(!(w in d))throw Error(n(108,se(l)||"Unknown",w));return V({},p,x)}function Ud(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Ba,Ki=sr.current,Ft(sr,l),Ft(Cr,Cr.current),!0}function Uy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Wy(l,d,Ki),x.__reactInternalMemoizedMergedChildContext=l,qt(Cr),qt(sr),Ft(sr,l)):qt(Cr),Ft(Cr,p)}var ua=null,Kd=!1,bp=!1;function Ky(l){ua===null?ua=[l]:ua.push(l)}function $3(l){Kd=!0,Ky(l)}function Va(){if(!bp&&ua!==null){bp=!0;var l=0,d=it;try{var p=ua;for(it=1;l>=A,w-=A,ha=1<<32-_n(d)+w|p<st?(Bn=et,et=null):Bn=et.sibling;var wt=we(le,et,ue[st],Me);if(wt===null){et===null&&(et=Bn);break}l&&et&&wt.alternate===null&&d(le,et),te=S(wt,te,st),Ze===null?Ve=wt:Ze.sibling=wt,Ze=wt,et=Bn}if(st===ue.length)return p(le,et),Qt&&Gi(le,st),Ve;if(et===null){for(;stst?(Bn=et,et=null):Bn=et.sibling;var Qa=we(le,et,wt.value,Me);if(Qa===null){et===null&&(et=Bn);break}l&&et&&Qa.alternate===null&&d(le,et),te=S(Qa,te,st),Ze===null?Ve=Qa:Ze.sibling=Qa,Ze=Qa,et=Bn}if(wt.done)return p(le,et),Qt&&Gi(le,st),Ve;if(et===null){for(;!wt.done;st++,wt=ue.next())wt=Se(le,wt.value,Me),wt!==null&&(te=S(wt,te,st),Ze===null?Ve=wt:Ze.sibling=wt,Ze=wt);return Qt&&Gi(le,st),Ve}for(et=x(le,et);!wt.done;st++,wt=ue.next())wt=De(et,le,st,wt.value,Me),wt!==null&&(l&&wt.alternate!==null&&et.delete(wt.key===null?st:wt.key),te=S(wt,te,st),Ze===null?Ve=wt:Ze.sibling=wt,Ze=wt);return l&&et.forEach(function(bE){return d(le,bE)}),Qt&&Gi(le,st),Ve}function xn(le,te,ue,Me){if(typeof ue=="object"&&ue!==null&&ue.type===D&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case P:e:{for(var Ve=ue.key,Ze=te;Ze!==null;){if(Ze.key===Ve){if(Ve=ue.type,Ve===D){if(Ze.tag===7){p(le,Ze.sibling),te=w(Ze,ue.props.children),te.return=le,le=te;break e}}else if(Ze.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===U&&Xy(Ve)===Ze.type){p(le,Ze.sibling),te=w(Ze,ue.props),te.ref=fc(le,Ze,ue),te.return=le,le=te;break e}p(le,Ze);break}else d(le,Ze);Ze=Ze.sibling}ue.type===D?(te=no(ue.props.children,le.mode,Me,ue.key),te.return=le,le=te):(Me=vu(ue.type,ue.key,ue.props,null,le.mode,Me),Me.ref=fc(le,te,ue),Me.return=le,le=Me)}return A(le);case F:e:{for(Ze=ue.key;te!==null;){if(te.key===Ze)if(te.tag===4&&te.stateNode.containerInfo===ue.containerInfo&&te.stateNode.implementation===ue.implementation){p(le,te.sibling),te=w(te,ue.children||[]),te.return=le,le=te;break e}else{p(le,te);break}else d(le,te);te=te.sibling}te=gm(ue,le.mode,Me),te.return=le,le=te}return A(le);case U:return Ze=ue._init,xn(le,te,Ze(ue._payload),Me)}if(Jt(ue))return ze(le,te,ue,Me);if(q(ue))return Be(le,te,ue,Me);Yd(le,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,te!==null&&te.tag===6?(p(le,te.sibling),te=w(te,ue),te.return=le,le=te):(p(le,te),te=mm(ue,le.mode,Me),te.return=le,le=te),A(le)):p(le,te)}return xn}var tl=Zy(!0),eb=Zy(!1),Qd=Fa(null),Xd=null,nl=null,Sp=null;function Cp(){Sp=nl=Xd=null}function Ep(l){var d=Qd.current;qt(Qd),l._currentValue=d}function Tp(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 rl(l,d){Xd=l,Sp=nl=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(Tr=!0),l.firstContext=null)}function ns(l){var d=l._currentValue;if(Sp!==l)if(l={context:l,memoizedValue:d,next:null},nl===null){if(Xd===null)throw Error(n(308));nl=l,Xd.dependencies={lanes:0,firstContext:l}}else nl=nl.next=l;return d}var Ji=null;function Mp(l){Ji===null?Ji=[l]:Ji.push(l)}function tb(l,d,p,x){var w=d.interleaved;return w===null?(p.next=p,Mp(d)):(p.next=w.next,w.next=p),d.interleaved=p,pa(l,x)}function pa(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 Ha=!1;function Ap(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nb(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 ma(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Wa(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(vt&2)!==0){var w=x.pending;return w===null?d.next=d:(d.next=w.next,w.next=d),x.pending=d,pa(l,p)}return w=x.interleaved,w===null?(d.next=d,Mp(x)):(d.next=w.next,w.next=d),x.interleaved=d,pa(l,p)}function Zd(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,Ut(l,p)}}function rb(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var w=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?w=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?w=S=d:S=S.next=d}else w=S=d;p={baseState:x.baseState,firstBaseUpdate:w,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 eu(l,d,p,x){var w=l.updateQueue;Ha=!1;var S=w.firstBaseUpdate,A=w.lastBaseUpdate,B=w.shared.pending;if(B!==null){w.shared.pending=null;var J=B,fe=J.next;J.next=null,A===null?S=fe:A.next=fe,A=J;var je=l.alternate;je!==null&&(je=je.updateQueue,B=je.lastBaseUpdate,B!==A&&(B===null?je.firstBaseUpdate=fe:B.next=fe,je.lastBaseUpdate=J))}if(S!==null){var Se=w.baseState;A=0,je=fe=J=null,B=S;do{var we=B.lane,De=B.eventTime;if((x&we)===we){je!==null&&(je=je.next={eventTime:De,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var ze=l,Be=B;switch(we=d,De=p,Be.tag){case 1:if(ze=Be.payload,typeof ze=="function"){Se=ze.call(De,Se,we);break e}Se=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Be.payload,we=typeof ze=="function"?ze.call(De,Se,we):ze,we==null)break e;Se=V({},Se,we);break e;case 2:Ha=!0}}B.callback!==null&&B.lane!==0&&(l.flags|=64,we=w.effects,we===null?w.effects=[B]:we.push(B))}else De={eventTime:De,lane:we,tag:B.tag,payload:B.payload,callback:B.callback,next:null},je===null?(fe=je=De,J=Se):je=je.next=De,A|=we;if(B=B.next,B===null){if(B=w.shared.pending,B===null)break;we=B,B=we.next,we.next=null,w.lastBaseUpdate=we,w.shared.pending=null}}while(!0);if(je===null&&(J=Se),w.baseState=J,w.firstBaseUpdate=fe,w.lastBaseUpdate=je,d=w.shared.interleaved,d!==null){w=d;do A|=w.lane,w=w.next;while(w!==d)}else S===null&&(w.shared.lanes=0);Xi|=A,l.lanes=A,l.memoizedState=Se}}function sb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Dp.transition;Dp.transition={};try{l(!1),d()}finally{it=p,Dp.transition=x}}function jb(){return rs().memoizedState}function H3(l,d,p){var x=Ga(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},kb(l))Sb(d,p);else if(p=tb(l,d,p,x),p!==null){var w=Nr();ks(p,l,x,w),Cb(p,d,x)}}function W3(l,d,p){var x=Ga(l),w={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(kb(l))Sb(d,w);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(w.hasEagerState=!0,w.eagerState=B,bs(B,A)){var J=d.interleaved;J===null?(w.next=w,Mp(d)):(w.next=J.next,J.next=w),d.interleaved=w;return}}catch{}finally{}p=tb(l,d,w,x),p!==null&&(w=Nr(),ks(p,l,x,w),Cb(p,d,x))}}function kb(l){var d=l.alternate;return l===an||d!==null&&d===an}function Sb(l,d){xc=ru=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function Cb(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Ut(l,p)}}var iu={readContext:ns,useCallback:ar,useContext:ar,useEffect:ar,useImperativeHandle:ar,useInsertionEffect:ar,useLayoutEffect:ar,useMemo:ar,useReducer:ar,useRef:ar,useState:ar,useDebugValue:ar,useDeferredValue:ar,useTransition:ar,useMutableSource:ar,useSyncExternalStore:ar,useId:ar,unstable_isNewReconciler:!1},U3={readContext:ns,useCallback:function(l,d){return Fs().memoizedState=[l,d===void 0?null:d],l},useContext:ns,useEffect:mb,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,su(4194308,4,yb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return su(4194308,4,l,d)},useInsertionEffect:function(l,d){return su(4,2,l,d)},useMemo:function(l,d){var p=Fs();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=Fs();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=H3.bind(null,an,l),[x.memoizedState,l]},useRef:function(l){var d=Fs();return l={current:l},d.memoizedState=l},useState:fb,useDebugValue:Vp,useDeferredValue:function(l){return Fs().memoizedState=l},useTransition:function(){var l=fb(!1),d=l[0];return l=V3.bind(null,l[1]),Fs().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=an,w=Fs();if(Qt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Fn===null)throw Error(n(349));(Qi&30)!==0||lb(x,d,p)}w.memoizedState=p;var S={value:p,getSnapshot:d};return w.queue=S,mb(db.bind(null,x,S,l),[l]),x.flags|=2048,vc(9,cb.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=Fs(),d=Fn.identifierPrefix;if(Qt){var p=fa,x=ha;p=(x&~(1<<32-_n(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=yc++,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[zs]=d,l[uc]=x,Kb(l,d,!1,!1),d.stateNode=l;e:{switch(A=Ps(p,x),p){case"dialog":Kt("cancel",l),Kt("close",l),w=x;break;case"iframe":case"object":case"embed":Kt("load",l),w=x;break;case"video":case"audio":for(w=0;wll&&(d.flags|=128,x=!0,Nc(S,!1),d.lanes=4194304)}else{if(!x)if(l=tu(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Nc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Qt)return ir(d),null}else 2*It()-S.renderingStartTime>ll&&p!==1073741824&&(d.flags|=128,x=!0,Nc(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=It(),d.sibling=null,p=sn.current,Ft(sn,x?p&1|2:p&1),d):(ir(d),null);case 22:case 23:return hm(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?($r&1073741824)!==0&&(ir(d),d.subtreeFlags&6&&(d.flags|=8192)):ir(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function Z3(l,d){switch(Np(d),d.tag){case 1:return Er(d.type)&&Wd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return sl(),qt(Cr),qt(sr),Op(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Rp(d),null;case 13:if(qt(sn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));el()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return qt(sn),null;case 4:return sl(),null;case 10:return Ep(d.type._context),null;case 22:case 23:return hm(),null;case 24:return null;default:return null}}var du=!1,or=!1,eE=typeof WeakSet=="function"?WeakSet:Set,_e=null;function il(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){un(l,d,x)}else p.current=null}function em(l,d,p){try{p()}catch(x){un(l,d,x)}}var Jb=!1;function tE(l,d){if(hp=Ad,l=Ey(),sp(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 w=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,B=-1,J=-1,fe=0,je=0,Se=l,we=null;t:for(;;){for(var De;Se!==p||w!==0&&Se.nodeType!==3||(B=A+w),Se!==S||x!==0&&Se.nodeType!==3||(J=A+x),Se.nodeType===3&&(A+=Se.nodeValue.length),(De=Se.firstChild)!==null;)we=Se,Se=De;for(;;){if(Se===l)break t;if(we===p&&++fe===w&&(B=A),we===S&&++je===x&&(J=A),(De=Se.nextSibling)!==null)break;Se=we,we=Se.parentNode}Se=De}p=B===-1||J===-1?null:{start:B,end:J}}else p=null}p=p||{start:0,end:0}}else p=null;for(fp={focusedElem:l,selectionRange:p},Ad=!1,_e=d;_e!==null;)if(d=_e,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,_e=l;else for(;_e!==null;){d=_e;try{var ze=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(ze!==null){var Be=ze.memoizedProps,xn=ze.memoizedState,le=d.stateNode,te=le.getSnapshotBeforeUpdate(d.elementType===d.type?Be:Ns(d.type,Be),xn);le.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var ue=d.stateNode.containerInfo;ue.nodeType===1?ue.textContent="":ue.nodeType===9&&ue.documentElement&&ue.removeChild(ue.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Me){un(d,d.return,Me)}if(l=d.sibling,l!==null){l.return=d.return,_e=l;break}_e=d.return}return ze=Jb,Jb=!1,ze}function wc(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&l)===l){var S=w.destroy;w.destroy=void 0,S!==void 0&&em(d,p,S)}w=w.next}while(w!==x)}}function uu(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 tm(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 Yb(l){var d=l.alternate;d!==null&&(l.alternate=null,Yb(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[zs],delete d[uc],delete d[xp],delete d[_3],delete d[z3])),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 Qb(l){return l.tag===5||l.tag===3||l.tag===4}function Xb(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Qb(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 nm(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=Vd));else if(x!==4&&(l=l.child,l!==null))for(nm(l,d,p),l=l.sibling;l!==null;)nm(l,d,p),l=l.sibling}function rm(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(rm(l,d,p),l=l.sibling;l!==null;)rm(l,d,p),l=l.sibling}var qn=null,ws=!1;function Ua(l,d,p){for(p=p.child;p!==null;)Zb(l,d,p),p=p.sibling}function Zb(l,d,p){if(Sr&&typeof Sr.onCommitFiberUnmount=="function")try{Sr.onCommitFiberUnmount(sa,p)}catch{}switch(p.tag){case 5:or||il(p,d);case 6:var x=qn,w=ws;qn=null,Ua(l,d,p),qn=x,ws=w,qn!==null&&(ws?(l=qn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):qn.removeChild(p.stateNode));break;case 18:qn!==null&&(ws?(l=qn,p=p.stateNode,l.nodeType===8?gp(l.parentNode,p):l.nodeType===1&&gp(l,p),ec(l)):gp(qn,p.stateNode));break;case 4:x=qn,w=ws,qn=p.stateNode.containerInfo,ws=!0,Ua(l,d,p),qn=x,ws=w;break;case 0:case 11:case 14:case 15:if(!or&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var S=w,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&em(p,d,A),w=w.next}while(w!==x)}Ua(l,d,p);break;case 1:if(!or&&(il(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(B){un(p,d,B)}Ua(l,d,p);break;case 21:Ua(l,d,p);break;case 22:p.mode&1?(or=(x=or)||p.memoizedState!==null,Ua(l,d,p),or=x):Ua(l,d,p);break;default:Ua(l,d,p)}}function ev(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new eE),d.forEach(function(x){var w=dE.bind(null,l,x);p.has(x)||(p.add(x),x.then(w,w))})}}function js(l,d){var p=d.deletions;if(p!==null)for(var x=0;xw&&(w=A),x&=~S}if(x=w,x=It()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*rE(x/1960))-x,10l?16:l,qa===null)var x=!1;else{if(l=qa,qa=null,gu=0,(vt&6)!==0)throw Error(n(331));var w=vt;for(vt|=4,_e=l.current;_e!==null;){var S=_e,A=S.child;if((_e.flags&16)!==0){var B=S.deletions;if(B!==null){for(var J=0;JIt()-im?eo(l,0):am|=p),Ar(l,d)}function fv(l,d){d===0&&((l.mode&1)===0?d=1:(d=ia,ia<<=1,(ia&130023424)===0&&(ia=4194304)));var p=Nr();l=pa(l,d),l!==null&&(Cn(l,d,p),Ar(l,p))}function cE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),fv(l,p)}function dE(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,w=l.memoizedState;w!==null&&(p=w.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),fv(l,p)}var pv;pv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||Cr.current)Tr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return Tr=!1,Q3(l,d,p);Tr=(l.flags&131072)!==0}else Tr=!1,Qt&&(d.flags&1048576)!==0&&qy(d,Gd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;cu(l,d),l=d.pendingProps;var w=Qo(d,sr.current);rl(d,p),w=_p(null,d,x,l,w,p);var S=zp();return d.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,Er(x)?(S=!0,Ud(d)):S=!1,d.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Ap(d),w.updater=ou,d.stateNode=w,w._reactInternals=d,Wp(d,x,l,p),d=Gp(null,d,x,!0,S,p)):(d.tag=0,Qt&&S&&vp(d),vr(null,d,w,p),d=d.child),d;case 16:x=d.elementType;e:{switch(cu(l,d),l=d.pendingProps,w=x._init,x=w(x._payload),d.type=x,w=d.tag=hE(x),l=Ns(x,l),w){case 0:d=qp(null,d,x,l,p);break e;case 1:d=Fb(null,d,x,l,p);break e;case 11:d=Db(null,d,x,l,p);break e;case 14:d=Lb(null,d,x,Ns(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:Ns(x,w),qp(l,d,x,w,p);case 1:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:Ns(x,w),Fb(l,d,x,w,p);case 3:e:{if(Bb(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,w=S.element,nb(l,d),eu(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){w=al(Error(n(423)),d),d=Vb(l,d,x,p,w);break e}else if(x!==w){w=al(Error(n(424)),d),d=Vb(l,d,x,p,w);break e}else for(zr=$a(d.stateNode.containerInfo.firstChild),_r=d,Qt=!0,vs=null,p=eb(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(el(),x===w){d=ga(l,d,p);break e}vr(l,d,x,p)}d=d.child}return d;case 5:return ab(d),l===null&&jp(d),x=d.type,w=d.pendingProps,S=l!==null?l.memoizedProps:null,A=w.children,pp(x,w)?A=null:S!==null&&pp(x,S)&&(d.flags|=32),$b(l,d),vr(l,d,A,p),d.child;case 6:return l===null&&jp(d),null;case 13:return Hb(l,d,p);case 4:return Ip(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=tl(d,null,x,p):vr(l,d,x,p),d.child;case 11:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:Ns(x,w),Db(l,d,x,w,p);case 7:return vr(l,d,d.pendingProps,p),d.child;case 8:return vr(l,d,d.pendingProps.children,p),d.child;case 12:return vr(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,w=d.pendingProps,S=d.memoizedProps,A=w.value,Ft(Qd,x._currentValue),x._currentValue=A,S!==null)if(bs(S.value,A)){if(S.children===w.children&&!Cr.current){d=ga(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 J=B.firstContext;J!==null;){if(J.context===x){if(S.tag===1){J=ma(-1,p&-p),J.tag=2;var fe=S.updateQueue;if(fe!==null){fe=fe.shared;var je=fe.pending;je===null?J.next=J:(J.next=je.next,je.next=J),fe.pending=J}}S.lanes|=p,J=S.alternate,J!==null&&(J.lanes|=p),Tp(S.return,p,d),B.lanes|=p;break}J=J.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),Tp(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}vr(l,d,w.children,p),d=d.child}return d;case 9:return w=d.type,x=d.pendingProps.children,rl(d,p),w=ns(w),x=x(w),d.flags|=1,vr(l,d,x,p),d.child;case 14:return x=d.type,w=Ns(x,d.pendingProps),w=Ns(x.type,w),Lb(l,d,x,w,p);case 15:return _b(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:Ns(x,w),cu(l,d),d.tag=1,Er(x)?(l=!0,Ud(d)):l=!1,rl(d,p),Tb(d,x,w),Wp(d,x,w,p),Gp(null,d,x,!0,l,p);case 19:return Ub(l,d,p);case 22:return zb(l,d,p)}throw Error(n(156,d.tag))};function mv(l,d){return br(l,d)}function uE(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 as(l,d,p,x){return new uE(l,d,p,x)}function pm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function hE(l){if(typeof l=="function")return pm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===ne)return 11;if(l===z)return 14}return 2}function Ya(l,d){var p=l.alternate;return p===null?(p=as(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 vu(l,d,p,x,w,S){var A=2;if(x=l,typeof l=="function")pm(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case D:return no(p.children,w,S,d);case R:A=8,w|=8;break;case O:return l=as(12,p,d,w|2),l.elementType=O,l.lanes=S,l;case he:return l=as(13,p,d,w),l.elementType=he,l.lanes=S,l;case xe:return l=as(19,p,d,w),l.elementType=xe,l.lanes=S,l;case H:return Nu(p,w,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case _:A=10;break e;case re:A=9;break e;case ne:A=11;break e;case z:A=14;break e;case U:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=as(A,p,d,w),d.elementType=l,d.type=x,d.lanes=S,d}function no(l,d,p,x){return l=as(7,l,x,d),l.lanes=p,l}function Nu(l,d,p,x){return l=as(22,l,x,d),l.elementType=H,l.lanes=p,l.stateNode={isHidden:!1},l}function mm(l,d,p){return l=as(6,l,null,d),l.lanes=p,l}function gm(l,d,p){return d=as(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function fE(l,d,p,x,w){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=vn(0),this.expirationTimes=vn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vn(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function xm(l,d,p,x,w,S,A,B,J){return l=new fE(l,d,p,B,J),d===1?(d=1,S===!0&&(d|=8)):d=0,S=as(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ap(S),l}function pE(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(),jm.exports=CE(),jm.exports}var Mv;function EE(){if(Mv)return Tu;Mv=1;var t=Dw();return Tu.createRoot=t.createRoot,Tu.hydrateRoot=t.hydrateRoot,Tu}var TE=EE(),bd=Dw();const Lw=Ow(bd);/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function td(){return td=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function zx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function AE(){return Math.random().toString(36).substr(2,8)}function Iv(t,e){return{usr:t.state,key:t.key,idx:e}}function kg(t,e,n,r){return n===void 0&&(n=null),td({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?zl(e):e,{state:n,key:e&&e.key||r||AE()})}function uh(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 zl(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 IE(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=ci.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(td({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=ci.Pop;let v=f(),k=v==null?null:v-h;h=v,u&&u({action:c,location:j.location,delta:k})}function g(v,k){c=ci.Push;let E=kg(j.location,v,k);h=f()+1;let C=Iv(E,h),T=j.createHref(E);try{o.pushState(C,"",T)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;a.location.assign(T)}i&&u&&u({action:c,location:j.location,delta:1})}function y(v,k){c=ci.Replace;let E=kg(j.location,v,k);h=f();let C=Iv(E,h),T=j.createHref(E);o.replaceState(C,"",T),i&&u&&u({action:c,location:j.location,delta:0})}function N(v){let k=a.location.origin!=="null"?a.location.origin:a.location.href,E=typeof v=="string"?v:uh(v);return E=E.replace(/ $/,"%20"),bn(k,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,k)}let j={get action(){return c},get location(){return t(a,o)},listen(v){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Av,m),u=v,()=>{a.removeEventListener(Av,m),u=null}},createHref(v){return e(a,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(v){return o.go(v)}};return j}var Rv;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Rv||(Rv={}));function RE(t,e,n){return n===void 0&&(n="/"),PE(t,e,n)}function PE(t,e,n,r){let a=typeof e=="string"?zl(e):e,i=$x(a.pathname||"/",n);if(i==null)return null;let o=_w(t);OE(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};u.relativePath.startsWith("/")&&(bn(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=pi([r,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(bn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),_w(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:BE(h,i.index),routesMeta:f})};return t.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let u of zw(i.path))a(i,o,u)}),e}function zw(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=zw(r.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function OE(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:VE(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const DE=/^:[\w-]+$/,LE=3,_E=2,zE=1,$E=10,FE=-2,Pv=t=>t==="*";function BE(t,e){let n=t.split("/"),r=n.length;return n.some(Pv)&&(r+=FE),e&&(r+=_E),n.filter(a=>!Pv(a)).reduce((a,i)=>a+(DE.test(i)?LE:i===""?zE:$E),r)}function VE(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function HE(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let j=c[m]||"";o=i.slice(0,i.length-j.length).replace(/(.)\/+$/,"$1")}const N=c[m];return y&&!N?h[g]=void 0:h[g]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function UE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),zx(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=[],a="^"+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:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function KE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return zx(!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 $x(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 qE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,GE=t=>qE.test(t);function JE(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?zl(t):t,i;if(n)if(GE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),zx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Ov(n.substring(1),"/"):i=Ov(n,e)}else i=e;return{pathname:i,search:XE(r),hash:ZE(a)}}function Ov(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Cm(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 YE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Fx(t,e){let n=YE(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Bx(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=zl(t):(a=td({},t),bn(!a.pathname||!a.pathname.includes("?"),Cm("?","pathname","search",a)),bn(!a.pathname||!a.pathname.includes("#"),Cm("#","pathname","hash",a)),bn(!a.search||!a.search.includes("#"),Cm("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.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;a.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=JE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const pi=t=>t.join("/").replace(/\/\/+/g,"/"),QE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),XE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ZE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function eT(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const $w=["post","put","patch","delete"];new Set($w);const tT=["get",...$w];new Set(tT);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function nd(){return nd=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=Bx(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:pi([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const aT=b.createContext(null);function iT(t){let e=b.useContext(Da).outlet;return e&&b.createElement(aT.Provider,{value:t},e)}function Vw(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(Ci),{matches:a}=b.useContext(Da),{pathname:i}=Ei(),o=JSON.stringify(Fx(a,r.v7_relativeSplatPath));return b.useMemo(()=>Bx(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function oT(t,e){return lT(t,e)}function lT(t,e,n,r){$l()||bn(!1);let{navigator:a}=b.useContext(Ci),{matches:i}=b.useContext(Da),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Ei(),f;if(e){var m;let v=typeof e=="string"?zl(e):e;u==="/"||(m=v.pathname)!=null&&m.startsWith(u)||bn(!1),f=v}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let v=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let N=RE(t,{pathname:y}),j=fT(N&&N.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:pi([u,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?u:pi([u,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return e&&j?b.createElement(pf.Provider,{value:{location:nd({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:ci.Pop}},j):j}function cT(){let t=xT(),e=eT(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:a},n):null,null)}const dT=b.createElement(cT,null);class uT extends b.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?b.createElement(Da.Provider,{value:this.props.routeContext},b.createElement(Fw.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hT(t){let{routeContext:e,match:n,children:r}=t,a=b.useContext(Vx);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Da.Provider,{value:e},r)}function fT(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||bn(!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,N=!1,j=null,v=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||dT,u&&(h<0&&g===0?(bT("route-fallback"),N=!0,v=null):h===g&&(N=!0,v=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),E=()=>{let C;return y?C=j:N?C=v:m.route.Component?C=b.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,b.createElement(hT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(uT,{location:n.location,revalidation:n.revalidation,component:j,error:y,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):E()},null)}var Hw=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Hw||{}),Ww=(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})(Ww||{});function pT(t){let e=b.useContext(Vx);return e||bn(!1),e}function mT(t){let e=b.useContext(nT);return e||bn(!1),e}function gT(t){let e=b.useContext(Da);return e||bn(!1),e}function Uw(t){let e=gT(),n=e.matches[e.matches.length-1];return n.route.id||bn(!1),n.route.id}function xT(){var t;let e=b.useContext(Fw),n=mT(),r=Uw();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function yT(){let{router:t}=pT(Hw.UseNavigateStable),e=Uw(Ww.UseNavigateStable),n=b.useRef(!1);return Bw(()=>{n.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,nd({fromRouteId:e},i)))},[t,e])}const Dv={};function bT(t,e,n){Dv[t]||(Dv[t]=!0)}function vT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Em(t){let{to:e,replace:n,state:r,relative:a}=t;$l()||bn(!1);let{future:i,static:o}=b.useContext(Ci),{matches:c}=b.useContext(Da),{pathname:u}=Ei(),h=Ti(),f=Bx(e,Fx(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:a}),[h,m,a,n,r]),null}function NT(t){return iT(t.context)}function Bt(t){bn(!1)}function wT(t){let{basename:e="/",children:n=null,location:r,navigationType:a=ci.Pop,navigator:i,static:o=!1,future:c}=t;$l()&&bn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:i,static:o,future:nd({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=zl(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:N="default"}=r,j=b.useMemo(()=>{let v=$x(f,u);return v==null?null:{location:{pathname:v,search:m,hash:g,state:y,key:N},navigationType:a}},[u,f,m,g,y,N,a]);return j==null?null:b.createElement(Ci.Provider,{value:h},b.createElement(pf.Provider,{children:n,value:j}))}function jT(t){let{children:e,location:n}=t;return oT(Sg(e),n)}new Promise(()=>{});function Sg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,a)=>{if(!b.isValidElement(r))return;let i=[...e,a];if(r.type===b.Fragment){n.push.apply(n,Sg(r.props.children,i));return}r.type!==Bt&&bn(!1),!r.props.index||!r.props.children||bn(!1);let o={id:r.props.id||i.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=Sg(r.props.children,i)),n.push(o)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Cg(){return Cg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function ST(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function CT(t,e){return t.button===0&&(!e||e==="_self")&&!ST(t)}function Eg(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(a=>[n,a]):[[n,r]])},[]))}function ET(t,e){let n=Eg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const TT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],MT="6";try{window.__reactRouterVersion=MT}catch{}const AT="startTransition",Lv=ff[AT];function IT(t){let{basename:e,children:n,future:r,window:a}=t,i=b.useRef();i.current==null&&(i.current=ME({window:a,v5Compat:!0}));let o=i.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&Lv?Lv(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>vT(r),[r]),b.createElement(wT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const RT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",PT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Tg=b.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=kT(e,TT),{basename:y}=b.useContext(Ci),N,j=!1;if(typeof h=="string"&&PT.test(h)&&(N=h,RT))try{let C=new URL(window.location.href),T=h.startsWith("//")?new URL(C.protocol+h):new URL(h),P=$x(T.pathname,y);T.origin===C.origin&&P!=null?h=P+T.search+T.hash:j=!0}catch{}let v=rT(h,{relative:a}),k=OT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function E(C){r&&r(C),C.defaultPrevented||k(C)}return b.createElement("a",Cg({},g,{href:N||v,onClick:j||i?r:E,ref:n,target:u}))});var _v;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(_v||(_v={}));var zv;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(zv||(zv={}));function OT(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Ti(),h=Ei(),f=Vw(t,{relative:o});return b.useCallback(m=>{if(CT(m,n)){m.preventDefault();let g=r!==void 0?r:uh(h)===uh(f);u(t,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function Kw(t){let e=b.useRef(Eg(t)),n=b.useRef(!1),r=Ei(),a=b.useMemo(()=>ET(r.search,n.current?null:e.current),[r.search]),i=Ti(),o=b.useCallback((c,u)=>{const h=Eg(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,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 DT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),LT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),$v=t=>{const e=LT(t);return e.charAt(0).toUpperCase()+e.slice(1)},qw=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),_T=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. + * See the LICENSE file in the root directory of this source tree. + */var zT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $T=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...zT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:qw("lucide",a),...!i&&!_T(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(i)?i:[i]]));/** + * @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 Ee=(t,e)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement($T,{ref:i,iconNode:e,className:qw(`lucide-${DT($v(t))}`,`lucide-${t}`,r),...a}));return n.displayName=$v(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 FT=[["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"}]],Tm=Ee("arrow-up-down",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:"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"}]],Fv=Ee("bitcoin",BT);/** + * @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 VT=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],HT=Ee("bold",VT);/** + * @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 WT=[["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"}]],Wr=Ee("book-open",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:"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"}]],Mg=Ee("calendar",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=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Ag=Ee("chart-column",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:"M20 6 9 17l-5-5",key:"1gmf2c"}]],mf=Ee("check",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=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rd=Ee("chevron-down",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=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],YT=Ee("chevron-left",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 QT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],lo=Ee("chevron-right",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:"m18 15-6-6-6 6",key:"153udz"}]],Gw=Ee("chevron-up",XT);/** + * @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 ZT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Jw=Ee("circle-alert",ZT);/** + * @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 eM=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Bv=Ee("circle-check-big",eM);/** + * @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 tM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ig=Ee("circle-check",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=[["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"}]],Yw=Ee("circle-question-mark",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=[["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"}]],Mm=Ee("circle-user",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=[["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"}]],Qw=Ee("circle-x",sM);/** + * @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 aM=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Rg=Ee("clock",aM);/** + * @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 iM=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],oM=Ee("cloud",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 lM=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],cM=Ee("code",lM);/** + * @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 dM=[["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"}]],Hx=Ee("copy",dM);/** + * @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 uM=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Vv=Ee("credit-card",uM);/** + * @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 hM=[["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"}]],jl=Ee("crown",hM);/** + * @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=[["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"}]],hh=Ee("dollar-sign",fM);/** + * @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 pM=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],mM=Ee("download",pM);/** + * @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 gM=[["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"}]],Ra=Ee("external-link",gM);/** + * @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 xM=[["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"}]],Pg=Ee("eye",xM);/** + * @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 yM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],bM=Ee("file-text",yM);/** + * @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 vM=[["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"}]],Xw=Ee("funnel",vM);/** + * @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",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],Zw=Ee("gift",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 wM=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],jM=Ee("git-merge",wM);/** + * @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 kM=[["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"}]],Og=Ee("globe",kM);/** + * @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=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],CM=Ee("graduation-cap",SM);/** + * @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 EM=[["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"}]],ya=Ee("grip-vertical",EM);/** + * @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 TM=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],MM=Ee("handshake",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 AM=[["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"}]],Hv=Ee("hash",AM);/** + * @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 IM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],RM=Ee("heading-1",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 PM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],OM=Ee("heading-2",PM);/** + * @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 DM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],LM=Ee("heading-3",DM);/** + * @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 _M=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],zM=Ee("house",_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 $M=[["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"}]],ej=Ee("image",$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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Oc=Ee("info",FM);/** + * @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 BM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],VM=Ee("italic",BM);/** + * @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 HM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],tj=Ee("key",HM);/** + * @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 WM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],UM=Ee("layout-dashboard",WM);/** + * @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 KM=[["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"}]],Ts=Ee("link-2",KM);/** + * @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 qM=[["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"}]],Dg=Ee("link",qM);/** + * @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 GM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],JM=Ee("list-ordered",GM);/** + * @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 YM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],QM=Ee("list",YM);/** + * @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 XM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],ZM=Ee("lock",XM);/** + * @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 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],tA=Ee("log-out",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 nA=[["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"}]],nj=Ee("map-pin",nA);/** + * @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 rA=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],sA=Ee("menu",rA);/** + * @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:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],iA=Ee("message-circle",aA);/** + * @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 oA=[["path",{d:"M5 12h14",key:"1ays0h"}]],lA=Ee("minus",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 cA=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],Nl=Ee("navigation",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 dA=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],uA=Ee("palette",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 hA=[["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"}]],Vt=Ee("pen-line",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 fA=[["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"}]],rj=Ee("pencil",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=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],mA=Ee("percent",pA);/** + * @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 gA=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],xA=Ee("phone",gA);/** + * @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 yA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],bA=Ee("pin",yA);/** + * @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:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],fn=Ee("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 NA=[["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"}]],Wv=Ee("qr-code",NA);/** + * @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 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],jA=Ee("quote",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 kA=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],SA=Ee("redo",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 CA=[["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"}]],He=Ee("refresh-cw",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:"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"}]],yn=Ee("save",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=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ta=Ee("search",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:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],AA=Ee("send",MA);/** + * @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 IA=[["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"}]],mo=Ee("settings",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 RA=[["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"}]],Mu=Ee("settings-2",RA);/** + * @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=[["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"}]],Vc=Ee("shield-check",PA);/** + * @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 OA=[["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"}]],Lg=Ee("shopping-bag",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=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],vi=Ee("smartphone",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:"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"}]],co=Ee("star",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:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],zA=Ee("strikethrough",_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 $A=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],FA=Ee("table",$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 BA=[["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"}]],Hc=Ee("tag",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:"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"}]],Yn=Ee("trash-2",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:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Tl=Ee("trending-up",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:"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"}]],_g=Ee("trophy",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:"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"}]],sj=Ee("undo-2",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:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],qA=Ee("undo",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 GA=[["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"}]],fh=Ee("upload",GA);/** + * @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 JA=[["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"}]],zg=Ee("user-plus",JA);/** + * @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 YA=[["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"}]],go=Ee("user",YA);/** + * @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:"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"}]],cr=Ee("users",QA);/** + * @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 XA=[["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"}]],Ml=Ee("wallet",XA);/** + * @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:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Zn=Ee("x",ZA);/** + * @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 e5=[["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"}]],di=Ee("zap",e5),Wx="admin_token";function vd(){try{return localStorage.getItem(Wx)}catch{return null}}function t5(t){try{localStorage.setItem(Wx,t)}catch{}}function Am(){try{localStorage.removeItem(Wx)}catch{}}const n5="https://soulapi.quwanzhi.com",r5=15e3,Uv=6e4,s5=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):n5};function wo(t){const e=s5(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function gf(t,e={}){const{data:n,...r}=e,a=wo(t),i=new Headers(r.headers),o=vd();o&&i.set("Authorization",`Bearer ${o}`),n!=null&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=r.timeout??r5,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),y=(m.headers.get("Content-Type")||"").includes("application/json")?await m.json():m,N=j=>{const v=j,k=((v==null?void 0:v.message)||(v==null?void 0:v.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){N(y);const j=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw j.status=m.status,j.data=y,j}return N(y),y}function Oe(t,e){return gf(t,{...e,method:"GET"})}function Nt(t,e,n){return gf(t,{...n,method:"POST",data:e})}function Dt(t,e,n){return gf(t,{...n,method:"PUT",data:e})}function Ws(t,e){return gf(t,{...e,method:"DELETE"})}function a5(){const[t,e]=b.useState(!1),[n,r]=b.useState("");return b.useEffect(()=>{const a=i=>{const o=i.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",a),()=>window.removeEventListener("recharge-alert",a)},[]),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(Jw,{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(Zn,{className:"w-4 h-4"})})]}):null}const i5=[{icon:UM,label:"数据概览",href:"/dashboard"},{icon:Wr,label:"内容管理",href:"/content"},{icon:cr,label:"用户管理",href:"/users"},{icon:jM,label:"找伙伴",href:"/find-partner"},{icon:Ml,label:"推广中心",href:"/distribution"}];function o5(){const t=Ei(),e=Ti(),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;if(!vd()){e("/login",{replace:!0});return}return Oe("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(Am(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(Am(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{Am();try{await Nt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?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:[i5.map(c=>{const u=t.pathname===c.href;return s.jsxs(Tg,{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(Tg,{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(mo,{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(tA,{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(a5,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(NT,{})})]})]})}function Kv(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ux(...t){return e=>{let n=!1;const r=t.map(a=>{const i=Kv(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;aj(i)&&typeof ph=="function"&&(i=ph(i._payload));const c=b.Children.toArray(i),u=c.find(h5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var oj=ij("Slot");function d5(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(aj(a)&&typeof ph=="function"&&(a=ph(a._payload)),b.isValidElement(a)){const o=p5(a),c=f5(i,a.props);return a.type!==b.Fragment&&(c.ref=r?Ux(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var u5=Symbol("radix.slottable");function h5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===u5}function f5(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function p5(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function lj(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Gv=cj,dj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Gv(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const g=qv(f)||qv(m);return a[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(N=>{let[j,v]=N;return Array.isArray(v)?v.includes({...i,...c}[j]):{...i,...c}[j]===v})?[...h,m,g]:h},[]);return Gv(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},m5=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),uj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),mh="-",Jv=[],x5="arbitrary..",y5=t=>{const e=v5(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return b5(o);const c=o.split(mh),u=c[0]===""&&c.length>1?1:0;return hj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?m5(h,u):u:h||Jv}return n[o]||Jv}}},hj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=hj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(mh):t.slice(e).join(mh),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?x5+r:void 0})(),v5=t=>{const{theme:e,classGroups:n}=t;return N5(n,e)},N5=(t,e)=>{const n=uj();for(const r in t){const a=t[r];Kx(a,n,r,e)}return n},Kx=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){j5(t,e,n);return}if(typeof t=="function"){k5(t,e,n,r);return}S5(t,e,n,r)},j5=(t,e,n)=>{const r=t===""?e:fj(e,t);r.classGroupId=n},k5=(t,e,n,r)=>{if(C5(t)){Kx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(g5(n,t))},S5=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(mh),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,E5=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const a=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},$g="!",Yv=":",T5=[],Qv=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),M5=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let j=0;ju?h-u:void 0;return Qv(i,y,g,N)};if(e){const a=e+Yv,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):Qv(T5,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},A5=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i0&&(a.sort(),r.push(...a),a=[]),r.push(o)):a.push(o)}return a.length>0&&(a.sort(),r.push(...a)),r}},I5=t=>({cache:E5(t.cacheSize),parseClassName:M5(t),sortModifiers:A5(t),...y5(t)}),R5=/\s+/,P5=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(R5);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:N,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let v=!!j,k=r(v?N.substring(0,j):N);if(!k){if(!v){u=f+(u.length>0?" "+u:u);continue}if(k=r(N),!k){u=f+(u.length>0?" "+u:u);continue}v=!1}const E=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=y?E+$g:E,T=C+k;if(o.indexOf(T)>-1)continue;o.push(T);const P=a(k,v);for(let F=0;F0?" "+u:u)}return u},O5=(...t)=>{let e=0,n,r,a="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,a,i;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=I5(h),r=n.cache.get,a=n.cache.set,i=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=P5(u,n);return a(u,f),f};return i=o,(...u)=>i(O5(...u))},L5=[],Mn=t=>{const e=n=>n[t]||L5;return e.isThemeGetter=!0,e},mj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_5=/^\d+\/\d+$/,z5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$5=/\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$/,F5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,B5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,V5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,dl=t=>_5.test(t),ht=t=>!!t&&!Number.isNaN(Number(t)),Xa=t=>!!t&&Number.isInteger(Number(t)),Im=t=>t.endsWith("%")&&ht(t.slice(0,-1)),ba=t=>z5.test(t),H5=()=>!0,W5=t=>$5.test(t)&&!F5.test(t),xj=()=>!1,U5=t=>B5.test(t),K5=t=>V5.test(t),q5=t=>!$e(t)&&!Fe(t),G5=t=>Fl(t,vj,xj),$e=t=>mj.test(t),ro=t=>Fl(t,Nj,W5),Rm=t=>Fl(t,Z5,ht),Xv=t=>Fl(t,yj,xj),J5=t=>Fl(t,bj,K5),Au=t=>Fl(t,wj,U5),Fe=t=>gj.test(t),Tc=t=>Bl(t,Nj),Y5=t=>Bl(t,eI),Zv=t=>Bl(t,yj),Q5=t=>Bl(t,vj),X5=t=>Bl(t,bj),Iu=t=>Bl(t,wj,!0),Fl=(t,e,n)=>{const r=mj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Bl=(t,e,n=!1)=>{const r=gj.exec(t);return r?r[1]?e(r[1]):n:!1},yj=t=>t==="position"||t==="percentage",bj=t=>t==="image"||t==="url",vj=t=>t==="length"||t==="size"||t==="bg-size",Nj=t=>t==="length",Z5=t=>t==="number",eI=t=>t==="family-name",wj=t=>t==="shadow",tI=()=>{const t=Mn("color"),e=Mn("font"),n=Mn("text"),r=Mn("font-weight"),a=Mn("tracking"),i=Mn("leading"),o=Mn("breakpoint"),c=Mn("container"),u=Mn("spacing"),h=Mn("radius"),f=Mn("shadow"),m=Mn("inset-shadow"),g=Mn("text-shadow"),y=Mn("drop-shadow"),N=Mn("blur"),j=Mn("perspective"),v=Mn("aspect"),k=Mn("ease"),E=Mn("animate"),C=()=>["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"],P=()=>[...T(),Fe,$e],F=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],R=()=>[Fe,$e,u],O=()=>[dl,"full","auto",...R()],_=()=>[Xa,"none","subgrid",Fe,$e],re=()=>["auto",{span:["full",Xa,Fe,$e]},Xa,Fe,$e],ne=()=>[Xa,"auto",Fe,$e],he=()=>["auto","min","max","fr",Fe,$e],xe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...R()],H=()=>[dl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],I=()=>[t,Fe,$e],q=()=>[...T(),Zv,Xv,{position:[Fe,$e]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",Q5,G5,{size:[Fe,$e]}],K=()=>[Im,Tc,ro],oe=()=>["","none","full",h,Fe,$e],Y=()=>["",ht,Tc,ro],X=()=>["solid","dashed","dotted","double"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[ht,Im,Zv,Xv],de=()=>["","none",N,Fe,$e],ce=()=>["none",ht,Fe,$e],ye=()=>["none",ht,Fe,$e],Le=()=>[ht,Fe,$e],Pe=()=>[dl,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ba],breakpoint:[ba],color:[H5],container:[ba],"drop-shadow":[ba],ease:["in","out","in-out"],font:[q5],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ba],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ba],shadow:[ba],spacing:["px",ht],text:[ba],"text-shadow":[ba],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",dl,$e,Fe,v]}],container:["container"],columns:[{columns:[ht,$e,Fe,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"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:P()}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[Xa,"auto",Fe,$e]}],basis:[{basis:[dl,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ht,dl,"auto","initial","none",$e]}],grow:[{grow:["",ht,Fe,$e]}],shrink:[{shrink:["",ht,Fe,$e]}],order:[{order:[Xa,"first","last","none",Fe,$e]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:re()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:re()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":he()}],"auto-rows":[{"auto-rows":he()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...xe(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...xe()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":xe()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[c,"screen",...H()]}],"min-w":[{"min-w":[c,"screen","none",...H()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",n,Tc,ro]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Fe,Rm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Im,$e]}],"font-family":[{font:[Y5,$e,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:[a,Fe,$e]}],"line-clamp":[{"line-clamp":[ht,"none",Fe,Rm]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Fe,$e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Fe,$e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[ht,"from-font","auto",Fe,ro]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[ht,"auto",Fe,$e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe,$e]}],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",Fe,$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xa,Fe,$e],radial:["",Fe,$e],conic:[Xa,Fe,$e]},X5,J5]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ht,Fe,$e]}],"outline-w":[{outline:["",ht,Tc,ro]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,Iu,Au]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",m,Iu,Au]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[ht,ro]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",g,Iu,Au]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[ht,Fe,$e]}],"mix-blend":[{"mix-blend":[...W(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":W()}],"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":[ht]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Fe,$e]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[ht]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Fe,$e]}],filter:[{filter:["","none",Fe,$e]}],blur:[{blur:de()}],brightness:[{brightness:[ht,Fe,$e]}],contrast:[{contrast:[ht,Fe,$e]}],"drop-shadow":[{"drop-shadow":["","none",y,Iu,Au]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",ht,Fe,$e]}],"hue-rotate":[{"hue-rotate":[ht,Fe,$e]}],invert:[{invert:["",ht,Fe,$e]}],saturate:[{saturate:[ht,Fe,$e]}],sepia:[{sepia:["",ht,Fe,$e]}],"backdrop-filter":[{"backdrop-filter":["","none",Fe,$e]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[ht,Fe,$e]}],"backdrop-contrast":[{"backdrop-contrast":[ht,Fe,$e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ht,Fe,$e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ht,Fe,$e]}],"backdrop-invert":[{"backdrop-invert":["",ht,Fe,$e]}],"backdrop-opacity":[{"backdrop-opacity":[ht,Fe,$e]}],"backdrop-saturate":[{"backdrop-saturate":[ht,Fe,$e]}],"backdrop-sepia":[{"backdrop-sepia":["",ht,Fe,$e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Fe,$e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ht,"initial",Fe,$e]}],ease:[{ease:["linear","initial",k,Fe,$e]}],delay:[{delay:[ht,Fe,$e]}],animate:[{animate:["none",E,Fe,$e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Fe,$e]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:Le()}],"skew-x":[{"skew-x":Le()}],"skew-y":[{"skew-y":Le()}],transform:[{transform:[Fe,$e,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Fe,$e]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",Fe,$e]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[ht,Tc,ro,Rm]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},nI=D5(tI);function Et(...t){return nI(cj(t))}function ps(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const rI=dj("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 ee({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?oj:"button";return s.jsx(i,{"data-slot":"button",className:Et(rI({variant:e,size:n,className:t})),...a})}function ie({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Et("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 sI(){const t=Ti(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1);b.useEffect(()=>{vd()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await Nt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){t5(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(Vc,{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(go,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ie,{type:"text",value:e,onChange:f=>{n(f.target.value),i&&o("")},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(ZM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ie,{type:"password",value:r,onChange:f=>{a(f.target.value),i&&o("")},placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(ee,{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 Ae=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Et("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ae.displayName="Card";const Ye=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Et("flex flex-col space-y-1.5 p-6",t),...e}));Ye.displayName="CardHeader";const Qe=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Et("font-semibold leading-none tracking-tight",t),...e}));Qe.displayName="CardTitle";const Lt=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Et("text-sm text-muted-foreground",t),...e}));Lt.displayName="CardDescription";const Ie=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Et("p-6 pt-0",t),...e}));Ie.displayName="CardContent";const aI=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Et("flex items-center p-6 pt-0",t),...e}));aI.displayName="CardFooter";const iI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Pm(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=iI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.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:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.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)=>Pm(t,"success",e),error:(t,e)=>Pm(t,"error",e),info:(t,e)=>Pm(t,"info",e)};function lt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function oI(t,e){const n=b.createContext(e),r=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,a]}function Mi(t,e=[]){let n=[];function r(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...N}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,v=b.useMemo(()=>N,Object.values(N));return s.jsx(j.Provider,{value:v,children:y})};h.displayName=i+"Provider";function f(m,g){var j;const y=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,N=b.useContext(y);if(N)return N;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,lI(a,...e)]}function lI(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(i)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var dr=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},cI=ff[" useId ".trim().toString()]||(()=>{}),dI=0;function mi(t){const[e,n]=b.useState(cI());return dr(()=>{n(r=>r??String(dI++))},[t]),e?`radix-${e}`:""}var uI=ff[" useInsertionEffect ".trim().toString()]||dr;function jo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=hI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=b.useRef(t!==void 0);b.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=b.useCallback(f=>{var m;if(c){const g=fI(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function hI({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return uI(()=>{i.current=e},[e]),b.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function fI(t){return typeof t=="function"}function sd(t){const e=pI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(gI);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function pI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=yI(a),c=xI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?Ux(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var mI=Symbol("radix.slottable");function gI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===mI}function xI(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function yI(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ft=bI.reduce((t,e)=>{const n=sd(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function vI(t,e){t&&bd.flushSync(()=>t.dispatchEvent(e))}function Ni(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function NI(t,e=globalThis==null?void 0:globalThis.document){const n=Ni(t);b.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var wI="DismissableLayer",Fg="dismissableLayer.update",jI="dismissableLayer.pointerDownOutside",kI="dismissableLayer.focusOutside",e1,jj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qx=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(jj),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),N=Ct(e,D=>m(D)),j=Array.from(h.layers),[v]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),E=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,T=E>=k,P=EI(D=>{const R=D.target,O=[...h.branches].some(_=>_.contains(R));!T||O||(a==null||a(D),o==null||o(D),D.defaultPrevented||c==null||c())},g),F=TI(D=>{const R=D.target;[...h.branches].some(_=>_.contains(R))||(i==null||i(D),o==null||o(D),D.defaultPrevented||c==null||c())},g);return NI(D=>{E===h.layers.size-1&&(r==null||r(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(e1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),t1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=e1)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),t1())},[f,h]),b.useEffect(()=>{const D=()=>y({});return document.addEventListener(Fg,D),()=>document.removeEventListener(Fg,D)},[]),s.jsx(ft.div,{...u,ref:N,style:{pointerEvents:C?T?"auto":"none":void 0,...t.style},onFocusCapture:lt(t.onFocusCapture,F.onFocusCapture),onBlurCapture:lt(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:lt(t.onPointerDownCapture,P.onPointerDownCapture)})});qx.displayName=wI;var SI="DismissableLayerBranch",CI=b.forwardRef((t,e)=>{const n=b.useContext(jj),r=b.useRef(null),a=Ct(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(ft.div,{...t,ref:a})});CI.displayName=SI;function EI(t,e=globalThis==null?void 0:globalThis.document){const n=Ni(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){kj(jI,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=u,e.addEventListener("click",a.current,{once:!0})):u()}else e.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function TI(t,e=globalThis==null?void 0:globalThis.document){const n=Ni(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&kj(kI,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function t1(){const t=new CustomEvent(Fg);document.dispatchEvent(t)}function kj(t,e,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),r?vI(a,i):a.dispatchEvent(i)}var Om="focusScope.autoFocusOnMount",Dm="focusScope.autoFocusOnUnmount",n1={bubbles:!1,cancelable:!0},MI="FocusScope",Gx=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=Ni(a),f=Ni(i),m=b.useRef(null),g=Ct(e,j=>u(j)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let j=function(C){if(y.paused||!c)return;const T=C.target;c.contains(T)?m.current=T:ti(m.current,{select:!0})},v=function(C){if(y.paused||!c)return;const T=C.relatedTarget;T!==null&&(c.contains(T)||ti(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const P of C)P.removedNodes.length>0&&ti(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const E=new MutationObserver(k);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){s1.add(y);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(Om,n1);c.addEventListener(Om,h),c.dispatchEvent(k),k.defaultPrevented||(AI(DI(Sj(c)),{select:!0}),document.activeElement===j&&ti(c))}return()=>{c.removeEventListener(Om,h),setTimeout(()=>{const k=new CustomEvent(Dm,n1);c.addEventListener(Dm,f),c.dispatchEvent(k),k.defaultPrevented||ti(j??document.body,{select:!0}),c.removeEventListener(Dm,f),s1.remove(y)},0)}}},[c,h,f,y]);const N=b.useCallback(j=>{if(!n&&!r||y.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const E=j.currentTarget,[C,T]=II(E);C&&T?!j.shiftKey&&k===T?(j.preventDefault(),n&&ti(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&ti(T,{select:!0})):k===E&&j.preventDefault()}},[n,r,y.paused]);return s.jsx(ft.div,{tabIndex:-1,...o,ref:g,onKeyDown:N})});Gx.displayName=MI;function AI(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(ti(r,{select:e}),document.activeElement!==n)return}function II(t){const e=Sj(t),n=r1(e,t),r=r1(e.reverse(),t);return[n,r]}function Sj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function r1(t,e){for(const n of t)if(!RI(n,{upTo:e}))return n}function RI(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 PI(t){return t instanceof HTMLInputElement&&"select"in t}function ti(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&PI(t)&&e&&t.select()}}var s1=OI();function OI(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=a1(t,e),t.unshift(e)},remove(e){var n;t=a1(t,e),(n=t[0])==null||n.resume()}}}function a1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function DI(t){return t.filter(e=>e.tagName!=="A")}var LI="Portal",Jx=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);dr(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?Lw.createPortal(s.jsx(ft.div,{...r,ref:e}),o):null});Jx.displayName=LI;function _I(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Nd=t=>{const{present:e,children:n}=t,r=zI(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=Ct(r.ref,$I(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};Nd.displayName="Presence";function zI(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=_I(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=Ru(r.current);i.current=c==="mounted"?h:"none"},[c]),dr(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,y=Ru(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),dr(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const j=Ru(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&j&&(u("ANIMATION_END"),!a.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=y=>{y.target===e&&(i.current=Ru(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:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Ru(t){return(t==null?void 0:t.animationName)||"none"}function $I(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Lm=0;function Cj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??i1()),document.body.insertAdjacentElement("beforeend",t[1]??i1()),Lm++,()=>{Lm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Lm--}},[])}function i1(){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 Us=function(){return Us=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return nR;var e=rR(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])}},aR=Aj(),kl="data-scroll-locked",iR=function(t,e,n,r){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` + .`.concat(BI,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body[`).concat(kl,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(a,`px; + padding-top: `).concat(i,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(c,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(th,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(nh,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(th," .").concat(th,` { + right: 0 `).concat(r,`; + } + + .`).concat(nh," .").concat(nh,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(kl,`] { + `).concat(VI,": ").concat(c,`px; + } +`)},l1=function(){var t=parseInt(document.body.getAttribute(kl)||"0",10);return isFinite(t)?t:0},oR=function(){b.useEffect(function(){return document.body.setAttribute(kl,(l1()+1).toString()),function(){var t=l1()-1;t<=0?document.body.removeAttribute(kl):document.body.setAttribute(kl,t.toString())}},[])},lR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;oR();var i=b.useMemo(function(){return sR(a)},[a]);return b.createElement(aR,{styles:iR(i,!e,a,n?"":"!important")})},Bg=!1;if(typeof window<"u")try{var Pu=Object.defineProperty({},"passive",{get:function(){return Bg=!0,!0}});window.addEventListener("test",Pu,Pu),window.removeEventListener("test",Pu,Pu)}catch{Bg=!1}var ul=Bg?{passive:!1}:!1,cR=function(t){return t.tagName==="TEXTAREA"},Ij=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!cR(t)&&n[e]==="visible")},dR=function(t){return Ij(t,"overflowY")},uR=function(t){return Ij(t,"overflowX")},c1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Rj(t,r);if(a){var i=Pj(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},hR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},fR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Rj=function(t,e){return t==="v"?dR(e):uR(e)},Pj=function(t,e){return t==="v"?hR(e):fR(e)},pR=function(t,e){return t==="h"&&e==="rtl"?-1:1},mR=function(t,e,n,r,a){var i=pR(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=Pj(t,c),N=y[0],j=y[1],v=y[2],k=j-v-i*N;(N||k)&&Rj(t,c)&&(m+=k,g+=N);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}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},Ou=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},d1=function(t){return[t.deltaX,t.deltaY]},u1=function(t){return t&&"current"in t?t.current:t},gR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},xR=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},yR=0,hl=[];function bR(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(yR++)[0],i=b.useState(Aj)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var j=FI([t.lockRef.current],(t.shards||[]).map(u1),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=Ou(j),E=n.current,C="deltaX"in j?j.deltaX:E[0]-k[0],T="deltaY"in j?j.deltaY:E[1]-k[1],P,F=j.target,D=Math.abs(C)>Math.abs(T)?"h":"v";if("touches"in j&&D==="h"&&F.type==="range")return!1;var R=window.getSelection(),O=R&&R.anchorNode,_=O?O===F||O.contains(F):!1;if(_)return!1;var re=c1(D,F);if(!re)return!0;if(re?P=D:(P=D==="v"?"h":"v",re=c1(D,F)),!re)return!1;if(!r.current&&"changedTouches"in j&&(C||T)&&(r.current=P),!P)return!0;var ne=r.current||P;return mR(ne,v,j,ne==="h"?C:T)},[]),u=b.useCallback(function(j){var v=j;if(!(!hl.length||hl[hl.length-1]!==i)){var k="deltaY"in v?d1(v):Ou(v),E=e.current.filter(function(P){return P.name===v.type&&(P.target===v.target||v.target===P.shadowParent)&&gR(P.delta,k)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var C=(o.current.shards||[]).map(u1).filter(Boolean).filter(function(P){return P.contains(v.target)}),T=C.length>0?c(v,C[0]):!o.current.noIsolation;T&&v.cancelable&&v.preventDefault()}}},[]),h=b.useCallback(function(j,v,k,E){var C={name:j,delta:v,target:k,should:E,shadowParent:vR(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(T){return T!==C})},1)},[]),f=b.useCallback(function(j){n.current=Ou(j),r.current=void 0},[]),m=b.useCallback(function(j){h(j.type,d1(j),j.target,c(j,t.lockRef.current))},[]),g=b.useCallback(function(j){h(j.type,Ou(j),j.target,c(j,t.lockRef.current))},[]);b.useEffect(function(){return hl.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,ul),document.addEventListener("touchmove",u,ul),document.addEventListener("touchstart",f,ul),function(){hl=hl.filter(function(j){return j!==i}),document.removeEventListener("wheel",u,ul),document.removeEventListener("touchmove",u,ul),document.removeEventListener("touchstart",f,ul)}},[]);var y=t.removeScrollBar,N=t.inert;return b.createElement(b.Fragment,null,N?b.createElement(i,{styles:xR(a)}):null,y?b.createElement(lR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function vR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const NR=JI(Mj,bR);var Yx=b.forwardRef(function(t,e){return b.createElement(xf,Us({},t,{ref:e,sideCar:NR}))});Yx.classNames=xf.classNames;var wR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},fl=new WeakMap,Du=new WeakMap,Lu={},Fm=0,Oj=function(t){return t&&(t.host||Oj(t.parentNode))},jR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Oj(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})},kR=function(t,e,n,r){var a=jR(e,Array.isArray(t)?t:[t]);Lu[n]||(Lu[n]=new WeakMap);var i=Lu[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.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),N=y!==null&&y!=="false",j=(fl.get(g)||0)+1,v=(i.get(g)||0)+1;fl.set(g,j),i.set(g,v),o.push(g),j===1&&N&&Du.set(g,!0),v===1&&g.setAttribute(n,"true"),N||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Fm++,function(){o.forEach(function(m){var g=fl.get(m)-1,y=i.get(m)-1;fl.set(m,g),i.set(m,y),g||(Du.has(m)||m.removeAttribute(r),Du.delete(m)),y||m.removeAttribute(n)}),Fm--,Fm||(fl=new WeakMap,fl=new WeakMap,Du=new WeakMap,Lu={})}},Dj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=wR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),kR(r,a,n,"aria-hidden")):function(){return null}},yf="Dialog",[Lj]=Mi(yf),[SR,Is]=Lj(yf),_j=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=jo({prop:r,defaultProp:a??!1,onChange:i,caller:yf});return s.jsx(SR,{scope:e,triggerRef:c,contentRef:u,contentId:mi(),titleId:mi(),descriptionId:mi(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};_j.displayName=yf;var zj="DialogTrigger",CR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Is(zj,n),i=Ct(e,a.triggerRef);return s.jsx(ft.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Zx(a.open),...r,ref:i,onClick:lt(t.onClick,a.onOpenToggle)})});CR.displayName=zj;var Qx="DialogPortal",[ER,$j]=Lj(Qx,{forceMount:void 0}),Fj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=Is(Qx,e);return s.jsx(ER,{scope:e,forceMount:n,children:b.Children.map(r,o=>s.jsx(Nd,{present:n||i.open,children:s.jsx(Jx,{asChild:!0,container:a,children:o})}))})};Fj.displayName=Qx;var gh="DialogOverlay",Bj=b.forwardRef((t,e)=>{const n=$j(gh,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Is(gh,t.__scopeDialog);return i.modal?s.jsx(Nd,{present:r||i.open,children:s.jsx(MR,{...a,ref:e})}):null});Bj.displayName=gh;var TR=sd("DialogOverlay.RemoveScroll"),MR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Is(gh,n);return s.jsx(Yx,{as:TR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(ft.div,{"data-state":Zx(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),ko="DialogContent",Vj=b.forwardRef((t,e)=>{const n=$j(ko,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Is(ko,t.__scopeDialog);return s.jsx(Nd,{present:r||i.open,children:i.modal?s.jsx(AR,{...a,ref:e}):s.jsx(IR,{...a,ref:e})})});Vj.displayName=ko;var AR=b.forwardRef((t,e)=>{const n=Is(ko,t.__scopeDialog),r=b.useRef(null),a=Ct(e,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return Dj(i)},[]),s.jsx(Hj,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:lt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:lt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:lt(t.onFocusOutside,i=>i.preventDefault())})}),IR=b.forwardRef((t,e)=>{const n=Is(ko,t.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return s.jsx(Hj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Hj=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=Is(ko,n),u=b.useRef(null),h=Ct(e,u);return Cj(),s.jsxs(s.Fragment,{children:[s.jsx(Gx,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(qx,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Zx(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(RR,{titleId:c.titleId}),s.jsx(OR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Xx="DialogTitle",Wj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Is(Xx,n);return s.jsx(ft.h2,{id:a.titleId,...r,ref:e})});Wj.displayName=Xx;var Uj="DialogDescription",Kj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Is(Uj,n);return s.jsx(ft.p,{id:a.descriptionId,...r,ref:e})});Kj.displayName=Uj;var qj="DialogClose",Gj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Is(qj,n);return s.jsx(ft.button,{type:"button",...r,ref:e,onClick:lt(t.onClick,()=>a.onOpenChange(!1))})});Gj.displayName=qj;function Zx(t){return t?"open":"closed"}var Jj="DialogTitleWarning",[QV,Yj]=oI(Jj,{contentName:ko,titleName:Xx,docsSlug:"dialog"}),RR=({titleId:t})=>{const e=Yj(Jj),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 b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},PR="DialogDescriptionWarning",OR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Yj(PR).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},DR=_j,LR=Fj,_R=Bj,zR=Vj,$R=Wj,FR=Kj,BR=Gj;function Rt(t){return s.jsx(DR,{"data-slot":"dialog",...t})}function VR(t){return s.jsx(LR,{...t})}const Qj=b.forwardRef(({className:t,...e},n)=>s.jsx(_R,{ref:n,className:Et("fixed inset-0 z-50 bg-black/50",t),...e}));Qj.displayName="DialogOverlay";const Tt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(VR,{children:[s.jsx(Qj,{}),s.jsxs(zR,{ref:a,"aria-describedby":void 0,className:Et("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(BR,{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(Zn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Tt.displayName="DialogContent";function Pt({className:t,...e}){return s.jsx("div",{className:Et("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Xt({className:t,...e}){return s.jsx("div",{className:Et("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Ot(t){return s.jsx($R,{className:"text-lg font-semibold leading-none",...t})}function bf(t){return s.jsx(FR,{className:"text-sm text-muted-foreground",...t})}const HR=dj("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 Ke({className:t,variant:e,asChild:n=!1,...r}){const a=n?oj:"span";return s.jsx(a,{className:Et(HR({variant:e}),t),...r})}var WR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],UR=WR.reduce((t,e)=>{const n=ij(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),KR="Label",Xj=b.forwardRef((t,e)=>s.jsx(UR.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Xj.displayName=KR;var Zj=Xj;const Z=b.forwardRef(({className:t,...e},n)=>s.jsx(Zj,{ref:n,className:Et("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Z.displayName=Zj.displayName;function e0(t){const e=t+"CollectionProvider",[n,r]=Mi(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:v,children:k}=j,E=wr.useRef(null),C=wr.useRef(new Map).current;return s.jsx(a,{scope:v,itemMap:C,collectionRef:E,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=sd(c),h=wr.forwardRef((j,v)=>{const{scope:k,children:E}=j,C=i(c,k),T=Ct(v,C.collectionRef);return s.jsx(u,{ref:T,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=sd(f),y=wr.forwardRef((j,v)=>{const{scope:k,children:E,...C}=j,T=wr.useRef(null),P=Ct(v,T),F=i(f,k);return wr.useEffect(()=>(F.itemMap.set(T,{ref:T,...C}),()=>void F.itemMap.delete(T))),s.jsx(g,{[m]:"",ref:P,children:E})});y.displayName=f;function N(j){const v=i(t+"CollectionConsumer",j);return wr.useCallback(()=>{const E=v.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((F,D)=>C.indexOf(F.ref.current)-C.indexOf(D.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},N,r]}var qR=b.createContext(void 0);function vf(t){const e=b.useContext(qR);return t||e||"ltr"}var Bm="rovingFocusGroup.onEntryFocus",GR={bubbles:!1,cancelable:!0},wd="RovingFocusGroup",[Vg,ek,JR]=e0(wd),[YR,tk]=Mi(wd,[JR]),[QR,XR]=YR(wd),nk=b.forwardRef((t,e)=>s.jsx(Vg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Vg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(ZR,{...t,ref:e})})}));nk.displayName=wd;var ZR=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=Ct(e,g),N=vf(i),[j,v]=jo({prop:o,defaultProp:c??null,onChange:u,caller:wd}),[k,E]=b.useState(!1),C=Ni(h),T=ek(n),P=b.useRef(!1),[F,D]=b.useState(0);return b.useEffect(()=>{const R=g.current;if(R)return R.addEventListener(Bm,C),()=>R.removeEventListener(Bm,C)},[C]),s.jsx(QR,{scope:n,orientation:r,dir:N,loop:a,currentTabStopId:j,onItemFocus:b.useCallback(R=>v(R),[v]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>D(R=>R+1),[]),onFocusableItemRemove:b.useCallback(()=>D(R=>R-1),[]),children:s.jsx(ft.div,{tabIndex:k||F===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:lt(t.onMouseDown,()=>{P.current=!0}),onFocus:lt(t.onFocus,R=>{const O=!P.current;if(R.target===R.currentTarget&&O&&!k){const _=new CustomEvent(Bm,GR);if(R.currentTarget.dispatchEvent(_),!_.defaultPrevented){const re=T().filter(U=>U.focusable),ne=re.find(U=>U.active),he=re.find(U=>U.id===j),z=[ne,he,...re].filter(Boolean).map(U=>U.ref.current);ak(z,f)}}P.current=!1}),onBlur:lt(t.onBlur,()=>E(!1))})})}),rk="RovingFocusGroupItem",sk=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=mi(),h=i||u,f=XR(rk,n),m=f.currentTabStopId===h,g=ek(n),{onFocusableItemAdd:y,onFocusableItemRemove:N,currentTabStopId:j}=f;return b.useEffect(()=>{if(r)return y(),()=>N()},[r,y,N]),s.jsx(Vg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(ft.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:lt(t.onMouseDown,v=>{r?f.onItemFocus(h):v.preventDefault()}),onFocus:lt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:lt(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=nP(v,f.orientation,f.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const T=C.indexOf(v.currentTarget);C=f.loop?rP(C,T+1):C.slice(T+1)}setTimeout(()=>ak(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});sk.displayName=rk;var eP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function nP(t,e,n){const r=tP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return eP[r]}function ak(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function rP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var sP=nk,aP=sk,Nf="Tabs",[iP]=Mi(Nf,[tk]),ik=tk(),[oP,t0]=iP(Nf),ok=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=vf(c),[m,g]=jo({prop:r,onChange:a,defaultProp:i??"",caller:Nf});return s.jsx(oP,{scope:n,baseId:mi(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(ft.div,{dir:f,"data-orientation":o,...h,ref:e})})});ok.displayName=Nf;var lk="TabsList",ck=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=t0(lk,n),o=ik(n);return s.jsx(sP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(ft.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});ck.displayName=lk;var dk="TabsTrigger",uk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=t0(dk,n),c=ik(n),u=pk(o.baseId,r),h=mk(o.baseId,r),f=r===o.value;return s.jsx(aP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(ft.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:lt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:lt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:lt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});uk.displayName=dk;var hk="TabsContent",fk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=t0(hk,n),u=pk(c.baseId,r),h=mk(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Nd,{present:a||f,children:({present:g})=>s.jsx(ft.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&&i})})});fk.displayName=hk;function pk(t,e){return`${t}-trigger-${e}`}function mk(t,e){return`${t}-content-${e}`}var lP=ok,gk=ck,xk=uk,yk=fk;const jd=lP,Vl=b.forwardRef(({className:t,...e},n)=>s.jsx(gk,{ref:n,className:Et("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Vl.displayName=gk.displayName;const Zt=b.forwardRef(({className:t,...e},n)=>s.jsx(xk,{ref:n,className:Et("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}));Zt.displayName=xk.displayName;const en=b.forwardRef(({className:t,...e},n)=>s.jsx(yk,{ref:n,className:Et("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));en.displayName=yk.displayName;function n0(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function r0(t){const[e,n]=b.useState(void 0);return dr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,c;if("borderBoxSize"in i){const u=i.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 wf="Switch",[cP]=Mi(wf),[dP,uP]=cP(wf),bk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),N=Ct(e,C=>y(C)),j=b.useRef(!1),v=g?f||!!g.closest("form"):!0,[k,E]=jo({prop:a,defaultProp:i??!1,onChange:h,caller:wf});return s.jsxs(dP,{scope:n,checked:k,disabled:c,children:[s.jsx(ft.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":jk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:lt(t.onClick,C=>{E(T=>!T),v&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),v&&s.jsx(wk,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});bk.displayName=wf;var vk="SwitchThumb",Nk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=uP(vk,n);return s.jsx(ft.span,{"data-state":jk(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});Nk.displayName=vk;var hP="SwitchBubbleInput",wk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=Ct(o,i),u=n0(n),h=r0(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const N=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(N)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});wk.displayName=hP;function jk(t){return t?"checked":"unchecked"}var kk=bk,fP=Nk;const kt=b.forwardRef(({className:t,...e},n)=>s.jsx(kk,{className:Et("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(fP,{className:Et("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")})}));kt.displayName=kk.displayName;function s0({open:t,onClose:e,userId:n,onUserUpdated:r}){var Os;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(null),[g,y]=b.useState(!1),[N,j]=b.useState(!1),[v,k]=b.useState(!1),[E,C]=b.useState("info"),[T,P]=b.useState(""),[F,D]=b.useState(""),[R,O]=b.useState([]),[_,re]=b.useState(""),[ne,he]=b.useState(""),[xe,z]=b.useState(""),[U,H]=b.useState(!1),[I,q]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[V,L]=b.useState([]),[K,oe]=b.useState(!1),[Y,X]=b.useState(""),[W,se]=b.useState(""),[de,ce]=b.useState(!1),[ye,Le]=b.useState(!1),[Pe,at]=b.useState(null),[Mt,on]=b.useState(null),[bt,nn]=b.useState(""),[In,At]=b.useState(""),[Jt,rn]=b.useState(""),[Rn,xr]=b.useState(!1),[Pn,Un]=b.useState(null),[G,We]=b.useState("");b.useEffect(()=>{t&&n&&(C("info"),at(null),on(null),Un(null),We(""),he(""),z(""),qe(),Oe("/api/db/vip-roles").then(pe=>{pe!=null&&pe.success&&pe.data&&L(pe.data)}).catch(()=>{}))},[t,n]);async function qe(){if(n){y(!0);try{const pe=await Oe(`/api/db/users?id=${encodeURIComponent(n)}`);if(pe!=null&&pe.success&&pe.user){const ge=pe.user;i(ge),P(ge.phone||""),D(ge.nickname||""),nn(ge.phone||""),At(ge.wechatId||""),rn(ge.openId||"");try{O(typeof ge.tags=="string"?JSON.parse(ge.tags||"[]"):[])}catch{O([])}q({isVip:!!(ge.isVip??!1),vipExpireDate:ge.vipExpireDate?String(ge.vipExpireDate).slice(0,10):"",vipRole:String(ge.vipRole??""),vipName:String(ge.vipName??""),vipProject:String(ge.vipProject??""),vipContact:String(ge.vipContact??""),vipBio:String(ge.vipBio??"")})}try{const ge=await Oe(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=50`);ge!=null&&ge.success&&ge.tracks&&c(ge.tracks)}catch{c([])}try{const ge=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ge!=null&&ge.success&&ge.referrals&&h(ge.referrals)}catch{h([])}try{const ge=await Oe(`/api/admin/users/${encodeURIComponent(n)}/balance`);ge!=null&&ge.success&&ge.data?m(ge.data):m(null)}catch{m(null)}}catch(pe){console.error("Load user detail error:",pe)}finally{y(!1)}}}async function yt(){if(!(a!=null&&a.phone)){ae.info("用户未绑定手机号,无法同步");return}j(!0);try{const pe=await Nt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});pe!=null&&pe.success?(ae.success("同步成功"),qe()):ae.error("同步失败: "+(pe==null?void 0:pe.error))}catch(pe){console.error("Sync CKB error:",pe),ae.error("同步失败")}finally{j(!1)}}async function ct(){if(a){if(I.isVip&&!I.vipExpireDate.trim()){ae.error("开启 VIP 请填写有效到期日");return}k(!0);try{const pe={id:a.id,phone:T||void 0,nickname:F||void 0,tags:JSON.stringify(R),isVip:I.isVip,vipExpireDate:I.isVip?I.vipExpireDate:void 0,vipRole:I.vipRole||void 0,vipName:I.vipName||void 0,vipProject:I.vipProject||void 0,vipContact:I.vipContact||void 0,vipBio:I.vipBio||void 0},ge=await Dt("/api/db/users",pe);ge!=null&&ge.success?(ae.success("保存成功"),qe(),r==null||r()):ae.error("保存失败: "+(ge==null?void 0:ge.error))}catch(pe){console.error("Save user error:",pe),ae.error("保存失败")}finally{k(!1)}}}const tt=()=>{_&&!R.includes(_)&&(O([...R,_]),re(""))},gt=pe=>O(R.filter(ge=>ge!==pe));async function Yt(){if(a){if(!ne){ae.error("请输入新密码");return}if(ne!==xe){ae.error("两次密码不一致");return}if(ne.length<6){ae.error("密码至少 6 位");return}H(!0);try{const pe=await Dt("/api/db/users",{id:a.id,password:ne});pe!=null&&pe.success?(ae.success("修改成功"),he(""),z("")):ae.error("修改失败: "+((pe==null?void 0:pe.error)||""))}catch{ae.error("修改失败")}finally{H(!1)}}}async function ln(){if(!a)return;const pe=parseFloat(Y);if(Number.isNaN(pe)||pe===0){ae.error("请输入有效金额(正数增加、负数扣减)");return}ce(!0);try{const ge=await Nt(`/api/admin/users/${a.id}/balance/adjust`,{amount:pe,remark:W||void 0});ge!=null&&ge.success?(ae.success("余额已调整"),oe(!1),X(""),se(""),qe(),r==null||r()):ae.error("调整失败: "+((ge==null?void 0:ge.error)||""))}catch{ae.error("调整失败")}finally{ce(!1)}}async function tr(){if(!bt&&!Jt&&!In){on("请至少输入手机号、微信号或 OpenID 中的一项");return}Le(!0),on(null),at(null);try{const pe=new URLSearchParams;bt&&pe.set("phone",bt),Jt&&pe.set("openId",Jt),In&&pe.set("wechatId",In);const ge=await Oe(`/api/admin/shensheshou/query?${pe}`);ge!=null&&ge.success&&ge.data?(at(ge.data),a&&await nr(ge.data)):on((ge==null?void 0:ge.error)||"未查询到数据,该用户可能未在神射手收录")}catch(pe){console.error("SSS query error:",pe),on("请求失败,请检查神射手接口配置")}finally{Le(!1)}}async function nr(pe){if(a)try{await Nt("/api/admin/shensheshou/enrich",{userId:a.id,phone:bt||a.phone||"",openId:Jt||a.openId||"",wechatId:In||a.wechatId||""}),qe()}catch(ge){console.error("SSS enrich error:",ge)}}async function Ps(){if(a){xr(!0),Un(null);try{const pe={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:R}]},ge=await Nt("/api/admin/shensheshou/ingest",pe);ge!=null&&ge.success&&ge.data?Un(ge.data):Un({error:(ge==null?void 0:ge.error)||"推送失败"})}catch(pe){console.error("SSS ingest error:",pe),Un({error:"请求失败"})}finally{xr(!1)}}}const Or=pe=>{const cn={view_chapter:Wr,purchase:Lg,match:cr,login:go,register:go,share:Ts,bind_phone:xA,bind_wechat:iA,fill_profile:Hc,visit_page:Nl}[pe]||Rg;return s.jsx(cn,{className:"w-4 h-4"})};return t?s.jsxs(s.Fragment,{children:[s.jsx(Rt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(go,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",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:a.avatar?s.jsx("img",{src:ps(a.avatar),className:"w-full h-full rounded-full object-cover",alt:""}):((Os=a.nickname)==null?void 0:Os.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:a.nickname}),a.isAdmin&&s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),a.hasFullBook&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),a.vipRole&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0",children:a.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[a.phone?`📱 ${a.phone}`:"未绑定手机",a.wechatId&&` · 💬 ${a.wechatId}`,a.mbti&&` · ${a.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",a.id.slice(0,16),"…"]}),a.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:a.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(a.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(jd,{value:E,onValueChange:C,className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs(Vl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[s.jsx(Zt,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),s.jsx(Zt,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),s.jsxs(Zt,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(Nl,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),s.jsx(Zt,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),s.jsxs(Zt,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(di,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),s.jsxs(en,{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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:T,onChange:pe=>P(pe.target.value),disabled:!!(a!=null&&a.phone)}),(a==null?void 0:a.phone)&&s.jsx("p",{className:"text-xs text-gray-500",children:"编辑时手机号不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:F,onChange:pe=>D(pe.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.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:a.openId})]}),a.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(nj,{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:a.region})]})]}),a.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:a.industry})]}),a.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:a.position})]})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 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:a.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:["¥",(a.pendingEarnings??0).toFixed(2)]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg flex flex-col 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]",children:["¥",((f==null?void 0:f.balance)??0).toFixed(2)]})]}),s.jsx(ee,{size:"sm",variant:"outline",className:"mt-2 border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 text-xs",onClick:()=>{X(""),se(""),oe(!0)},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-sm text-white",children:a.createdAt?new Date(a.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(tj,{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(ie,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:ne,onChange:pe=>he(pe.target.value)}),s.jsx(ie,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:xe,onChange:pe=>z(pe.target.value)}),s.jsx(ee,{size:"sm",onClick:Yt,disabled:U||!ne||!xe,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(jl,{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(kt,{checked:I.isVip,onCheckedChange:pe=>q(ge=>({...ge,isVip:pe}))})]}),I.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(ie,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:I.vipExpireDate,onChange:pe=>q(ge=>({...ge,vipExpireDate:pe.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:I.vipRole,onChange:pe=>q(ge=>({...ge,vipRole:pe.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),V.map(pe=>s.jsx("option",{value:pe.name,children:pe.name},pe.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:I.vipName,onChange:pe=>q(ge=>({...ge,vipName:pe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"项目"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"如:某某科技",value:I.vipProject,onChange:pe=>q(ge=>({...ge,vipProject:pe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"联系方式"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"微信/手机等",value:I.vipContact,onChange:pe=>q(ge=>({...ge,vipContact:pe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"简介"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"简短介绍",value:I.vipBio,onChange:pe=>q(ge=>({...ge,vipBio:pe.target.value}))})]})]})]})]}),a.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(jl,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:a.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:a.vipName})]}),a.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:a.vipProject})]}),a.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:a.vipContact})]}),a.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(a.vipExpireDate).toLocaleDateString()})]})]}),a.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:a.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(vi,{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(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:G,onChange:pe=>We(pe.target.value)}),s.jsxs(ee,{size:"sm",onClick:async()=>{if(!(!G||!a))try{await Dt("/api/db/users",{id:a.id,wechatId:G}),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(yn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),a.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:a.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(Ts,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(ee,{size:"sm",onClick:yt,disabled:N||!a.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:N?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(He,{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:"同步状态:"}),a.ckbSyncedAt?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):s.jsx(Ke,{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:a.ckbSyncedAt?new Date(a.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),s.jsxs(en,{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(Hc,{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(Ig,{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(pe=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:pe.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:pe.tags.map(ge=>s.jsxs("button",{type:"button",onClick:()=>{R.includes(ge)?gt(ge):O([...R,ge])},className:`px-2 py-0.5 rounded text-xs border transition-all ${R.includes(ge)?"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:[R.includes(ge)?"✓ ":"",ge]},ge))})]},pe.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:[R.map((pe,ge)=>s.jsxs(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[pe,s.jsx("button",{type:"button",onClick:()=>gt(pe),className:"ml-1 hover:text-red-400",children:s.jsx(Zn,{className:"w-3 h-3"})})]},ge)),R.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:_,onChange:pe=>re(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&tt()}),s.jsx(ee,{onClick:tt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),(()=>{const pe=a.tags||a.ckbTags||"";let ge=[];try{const On=typeof pe=="string"?JSON.parse(pe||"[]"):[];ge=Array.isArray(On)?On:typeof pe=="string"?pe.split(","):[]}catch{ge=typeof pe=="string"?pe.split(","):[]}const cn=ge.map(On=>String(On).trim()).filter(Boolean);return cn.length===0?null: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(Hc,{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:cn.map((On,Zs)=>s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 border-0",children:On},Zs))})]})})()]}),s.jsxs(en,{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(Nl,{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((pe,ge)=>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:Or(pe.action)}),ge0?u.map((pe,ge)=>{var On;const cn=pe;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:((On=cn.nickname)==null?void 0:On.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:cn.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[cn.status==="vip"&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-xs",children:cn.createdAt?new Date(cn.createdAt).toLocaleDateString():""})]})]},cn.id||ge)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),s.jsxs(en,{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(di,{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(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:bt,onChange:pe=>nn(pe.target.value)})]}),s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:In,onChange:pe=>At(pe.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(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:Jt,onChange:pe=>rn(pe.target.value)})]})]}),s.jsx(ee,{onClick:tr,disabled:ye,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:ye?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ta,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),Mt&&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:Mt}),Pe&&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:Pe.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:Pe.user_level??"-"})]})]}),Pe.tags&&Pe.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:Pe.tags.map((pe,ge)=>s.jsx(Ke,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:pe},ge))})]}),Pe.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",Pe.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(di,{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(ee,{onClick:Ps,disabled:Rn||!a.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Rn?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(di,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!a.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),Pn&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:Pn.error?s.jsx("p",{className:"text-red-400",children:String(Pn.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(Ig,{className:"w-4 h-4"})," 推送成功"]}),Pn.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(Pn.new_tags_added??0)]})]})})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(ee,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(ee,{onClick:ct,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Rt,{open:K,onOpenChange:oe,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsx(Ot,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"调整金额(元)"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"正数增加,负数扣减,如 10 或 -5",value:Y,onChange:pe=>X(pe.target.value)})]}),s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:W,onChange:pe=>se(pe.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ee,{variant:"outline",onClick:()=>oe(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(ee,{onClick:ln,disabled:de,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:de?"提交中...":"确认调整"})]})]})})]}):null}function _u(t){if(!t)return"";const e=t.replace(/\s+/g,"");return e.length<7?e:`${e.slice(0,3)}****${e.slice(-4)}`}function pP(){const t=Ti(),[e,n]=b.useState(!0),[r,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,g]=b.useState(0),[y,N]=b.useState(0),[j,v]=b.useState(0),[k,E]=b.useState(0),[C,T]=b.useState(0),[P,F]=b.useState(null),[D,R]=b.useState(null),[O,_]=b.useState(!1),[re,ne]=b.useState("week"),[he,xe]=b.useState(null),[z,U]=b.useState(!1),[H,I]=b.useState(!1),q=X=>{const W=X;if((W==null?void 0:W.status)===401)F("登录已过期,请重新登录");else{if((W==null?void 0:W.name)==="AbortError")return;F("加载失败,请检查网络或联系管理员")}};async function V(X){const W=X?{signal:X}:void 0;n(!0),F(null);try{const ce=await Oe("/api/admin/dashboard/stats",W);ce!=null&&ce.success&&(g(ce.totalUsers??0),N(ce.paidOrderCount??0),v(ce.totalRevenue??0),E(ce.conversionRate??0))}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",ce);try{const ye=await Oe("/api/admin/dashboard/overview",W);ye!=null&&ye.success&&(g(ye.totalUsers??0),N(ye.paidOrderCount??0),v(ye.totalRevenue??0),E(ye.conversionRate??0))}catch(ye){q(ye)}}}finally{n(!1)}try{const ce=await Oe("/api/admin/balance/summary",W);ce!=null&&ce.success&&ce.data&&T(ce.data.totalGifted??0)}catch{}a(!0),o(!0);const se=async()=>{try{const ce=await Oe("/api/admin/dashboard/recent-orders",W);if(ce!=null&&ce.success&&ce.recentOrders)f(ce.recentOrders);else throw new Error("no data")}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError")try{const ye=await Oe("/api/admin/orders?page=1&pageSize=20&status=paid",W),Pe=((ye==null?void 0:ye.orders)??[]).filter(at=>["paid","completed","success"].includes(at.status||""));f(Pe.slice(0,10))}catch{f([])}}finally{a(!1)}},de=async()=>{try{const ce=await Oe("/api/admin/dashboard/new-users",W);if(ce!=null&&ce.success&&ce.newUsers)u(ce.newUsers);else throw new Error("no data")}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError")try{const ye=await Oe("/api/db/users?page=1&pageSize=10",W);u((ye==null?void 0:ye.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([se(),de()])}async function L(X){const W=X||re;U(!0);try{const se=await Oe(`/api/admin/track/stats?period=${W}`);se!=null&&se.success&&xe({total:se.total??0,byModule:se.byModule??{}})}catch{xe(null)}finally{U(!1)}}b.useEffect(()=>{const X=new AbortController;V(X.signal),L();const W=setInterval(()=>{V(),L()},3e4);return()=>{X.abort(),clearInterval(W)}},[]);const K=m,oe=X=>{const W=X.productType||"",se=X.description||"";if(W==="balance_recharge")return{title:`余额充值 ¥${typeof X.amount=="number"?X.amount.toFixed(2):parseFloat(String(X.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(se){if(W==="section"&&se.includes("章节")){if(se.includes("-")){const de=se.split("-");if(de.length>=3)return{title:`第${de[1]}章 第${de[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:se,subtitle:"章节购买"}}return W==="fullbook"||se.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:W==="vip"||se.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:W==="match"||se.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:se,subtitle:W==="section"?"单章":W==="fullbook"?"全书":"其他"}}return W==="section"?{title:`章节 ${X.productId||""}`,subtitle:"单章购买"}:W==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:W==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:W==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:W||"其他"}},Y=[{title:"总用户数",value:e?null:K,sub:null,icon:cr,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(j??0).toFixed(2)}`,sub:C>0?`含代付 ¥${C.toFixed(2)}`:null,icon:Tl,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:Lg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${k.toFixed(1)}%`,sub:null,icon:Tl,color:"text-amber-400",bg:"bg-amber-500/20",link:"/users"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),P&&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:P}),s.jsx("button",{type:"button",onClick:()=>V(),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-6",children:Y.map((X,W)=>s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>X.link&&t(X.link),children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(Qe,{className:"text-sm font-medium text-gray-400",children:X.title}),s.jsx("div",{className:`p-2 rounded-lg ${X.bg}`,children:s.jsx(X.icon,{className:`w-4 h-4 ${X.color}`})})]}),s.jsx(Ie,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-8 flex items-center",children:X.value!=null?X.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(He,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),X.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:X.sub})]}),s.jsx(lo,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},W))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between",children:[s.jsx(Qe,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>V(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(He,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(He,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(Ie,{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(He,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,H?10:4).map(X=>{var ye,Le;const W=X.referrerId?c.find(Pe=>Pe.id===X.referrerId):void 0,se=X.referralCode||(W==null?void 0:W.referralCode)||(W==null?void 0:W.nickname)||(X.referrerId?String(X.referrerId).slice(0,8):""),de=oe(X),ce=X.userNickname||((ye=c.find(Pe=>Pe.id===X.userId))==null?void 0:ye.nickname)||_u((Le=c.find(Pe=>Pe.id===X.userId))==null?void 0:Le.phone)||"匿名用户";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:[X.userAvatar?s.jsx("img",{src:ps(X.userAvatar),alt:ce,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:Pe=>{Pe.currentTarget.style.display="none";const at=Pe.currentTarget.nextElementSibling;at&&at.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] shrink-0 mt-0.5 ${X.userAvatar?"hidden":""}`,children:ce.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:()=>{X.userId&&(R(X.userId),_(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:ce}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:de.title,children:de.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[de.subtitle&&de.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:de.subtitle}),s.jsx("span",{children:new Date(X.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),se&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",se]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(X.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:X.paymentMethod||"微信"})]})]},X.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Lg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]}),h.length>4&&s.jsxs("button",{type:"button",onClick:()=>I(!H),className:"w-full py-2 text-xs text-gray-400 hover:text-[#38bdac] transition-colors flex items-center justify-center gap-1",children:[s.jsx(lo,{className:`w-3.5 h-3.5 transition-transform ${H?"rotate-90":"rotate-270"}`}),H?"收起":`展开更多(共 ${h.length} 条)`]})]})})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"新注册用户"})}),s.jsx(Ie,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{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(X=>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:(X.nickname||_u(X.phone)||"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{R(X.id),_(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:X.nickname||_u(X.phone)||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:_u(X.phone)||"未填写手机号"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:X.createdAt?new Date(X.createdAt).toLocaleDateString():"-"})]},X.id)),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mt-8",children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between",children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Ag,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(X=>s.jsx("button",{type:"button",onClick:()=>{ne(X),L(X)},className:`px-3 py-1 text-xs rounded-full transition-colors ${re===X?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[X]},X))})]}),s.jsx(Ie,{children:z&&!he?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):he&&Object.keys(he.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:he.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(he.byModule).sort((X,W)=>W[1].reduce((se,de)=>se+de.count,0)-X[1].reduce((se,de)=>se+de.count,0)).map(([X,W])=>{const se=W.reduce((ce,ye)=>ce+ye.count,0),de={home:"首页",chapters:"目录",read:"阅读",my:"我的",vip:"VIP",wallet:"钱包",match:"找伙伴",referral:"推广",search:"搜索",settings:"设置",about:"关于",other:"其他"};return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:de[X]||X}),s.jsxs("span",{className:"text-xs text-gray-500",children:[se," 次"]})]}),s.jsx("div",{className:"space-y-2",children:W.sort((ce,ye)=>ye.count-ce.count).slice(0,8).map((ce,ye)=>{const Le={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",rule_trigger:"规则触发",view_chapter:"浏览章节",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元"},Pe={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节"},at=Le[ce.target]||ce.target||Pe[ce.action]||ce.action;return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:`${ce.action}: ${ce.target}`,children:at}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${se>0?ce.count/se*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:ce.count})]})]},ye)})})]},X)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ag,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),s.jsx(s0,{open:O,onClose:()=>{_(!1),R(null)},userId:D,onUserUpdated:()=>V()})]})}const ur=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Et("w-full caption-bottom text-sm",t),...e})}));ur.displayName="Table";const hr=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Et("[&_tr]:border-b",t),...e}));hr.displayName="TableHeader";const fr=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Et("[&_tr:last-child]:border-0",t),...e}));fr.displayName="TableBody";const ot=b.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Et("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ot.displayName="TableRow";const ke=b.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Et("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableHead";const be=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Et("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));be.displayName="TableCell";function a0(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function us({page:t,totalPages:e,total:n,pageSize:r,onPageChange:a,onPageSizeChange:i,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!i?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," 条"]}),i&&s.jsx("select",{value:r,onChange:c=>i(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:()=>a(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:()=>a(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:()=>a(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:()=>a(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 mP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[N,j]=b.useState(""),v=a0(N,300),[k,E]=b.useState("all"),[C,T]=b.useState(!0),[P,F]=b.useState(null),[D,R]=b.useState(null),[O,_]=b.useState(""),[re,ne]=b.useState(!1);async function he(){T(!0),F(null);try{const V=k==="all"?"":k==="completed"?"completed":k,L=new URLSearchParams({page:String(f),pageSize:String(g),...V&&{status:V},...v&&{search:v}}),[K,oe]=await Promise.all([Oe(`/api/admin/orders?${L}`),Oe("/api/db/users?page=1&pageSize=500")]);K!=null&&K.success&&(e(K.orders||[]),i(K.total??0),c(K.totalRevenue??0),h(K.todayRevenue??0)),oe!=null&&oe.success&&oe.users&&r(oe.users)}catch(V){console.error("加载订单失败",V),F("加载订单失败,请检查网络后重试")}finally{T(!1)}}b.useEffect(()=>{m(1)},[v,k]),b.useEffect(()=>{he()},[f,g,v,k]);const xe=V=>{var L;return V.userNickname||((L=n.find(K=>K.id===V.userId))==null?void 0:L.nickname)||"匿名用户"},z=V=>{var L;return((L=n.find(K=>K.id===V))==null?void 0:L.phone)||"-"},U=V=>{const L=V.productType||V.type||"",K=V.description||"";if(L==="balance_recharge")return{name:`余额充值 ¥${Number(V.amount||0).toFixed(2)}`,type:"余额充值"};if(K){if(L==="section"&&K.includes("章节")){if(K.includes("-")){const oe=K.split("-");if(oe.length>=3)return{name:`第${oe[1]}章 第${oe[2]}节`,type:"《一场Soul的创业实验》"}}return{name:K,type:"章节购买"}}return L==="fullbook"||K.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:L==="vip"||K.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:L==="match"||K.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:K,type:"其他"}}return L==="section"?{name:`章节 ${V.productId||V.sectionId||""}`,type:"单章"}:L==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:L==="vip"?{name:"超级个体开通费用",type:"超级个体"}:L==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:L||"其他"}},H=Math.ceil(a/g)||1;async function I(){var V;if(!(!(D!=null&&D.orderSn)&&!(D!=null&&D.id))){ne(!0),F(null);try{const L=await Dt("/api/admin/orders/refund",{orderSn:D.orderSn||D.id,reason:O||void 0});L!=null&&L.success?(R(null),_(""),he()):F((L==null?void 0:L.error)||"退款失败")}catch(L){const K=L;F(((V=K==null?void 0:K.data)==null?void 0:V.error)||"退款失败,请检查网络后重试")}finally{ne(!1)}}}function q(){if(t.length===0){ae.info("暂无数据可导出");return}const V=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],L=t.map(W=>{const se=U(W);return[W.orderSn||W.id||"",xe(W),z(W.userId),se.name,Number(W.amount||0).toFixed(2),W.paymentMethod==="wechat"?"微信支付":W.paymentMethod==="balance"?"余额支付":W.paymentMethod==="alipay"?"支付宝":W.paymentMethod||"微信支付",W.status==="refunded"?"已退款":W.status==="paid"||W.status==="completed"?"已完成":W.status==="pending"||W.status==="created"?"待支付":"已失败",W.status==="refunded"&&W.refundReason?W.refundReason:"-",W.referrerEarnings?Number(W.referrerEarnings).toFixed(2):"-",W.createdAt?new Date(W.createdAt).toLocaleString("zh-CN"):""].join(",")}),K="\uFEFF"+[V.join(","),...L].join(` +`),oe=new Blob([K],{type:"text/csv;charset=utf-8"}),Y=URL.createObjectURL(oe),X=document.createElement("a");X.href=Y,X.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,X.click(),URL.revokeObjectURL(Y)}return s.jsxs("div",{className:"p-8 w-full",children:[P&&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:P}),s.jsx("button",{type:"button",onClick:()=>F(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(ee,{variant:"outline",onClick:he,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${C?"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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ie,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:N,onChange:V=>j(V.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Xw,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:V=>E(V.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(ee,{variant:"outline",onClick:q,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(mM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:C?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{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(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"订单号"}),s.jsx(ke,{className:"text-gray-400",children:"用户"}),s.jsx(ke,{className:"text-gray-400",children:"商品"}),s.jsx(ke,{className:"text-gray-400",children:"金额"}),s.jsx(ke,{className:"text-gray-400",children:"支付方式"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-gray-400",children:"退款原因"}),s.jsx(ke,{className:"text-gray-400",children:"分销佣金"}),s.jsx(ke,{className:"text-gray-400",children:"下单时间"}),s.jsx(ke,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(fr,{children:[t.map(V=>{const L=U(V);return s.jsxs(ot,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(be,{className:"font-mono text-xs text-gray-400",children:[(V.orderSn||V.id||"").slice(0,12),"..."]}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[xe(V),V.payerUserId&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:z(V.userId)}),V.payerUserId&&V.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:["代付人:",V.payerNickname]})]})}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[L.name,(V.productType||V.type)==="vip"&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.type})]})}),s.jsxs(be,{className:"text-[#38bdac] font-bold",children:["¥",Number(V.amount||0).toFixed(2)]}),s.jsx(be,{className:"text-gray-300",children:V.paymentMethod==="wechat"?"微信支付":V.paymentMethod==="balance"?"余额支付":V.paymentMethod==="alipay"?"支付宝":V.paymentMethod||"微信支付"}),s.jsx(be,{children:V.status==="refunded"?s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):V.status==="paid"||V.status==="completed"?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):V.status==="pending"||V.status==="created"?s.jsx(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ke,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),s.jsx(be,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:V.refundReason,children:V.status==="refunded"&&V.refundReason?V.refundReason:"-"}),s.jsx(be,{className:"text-[#FFD700]",children:V.referrerEarnings?`¥${Number(V.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(be,{className:"text-gray-400 text-sm",children:new Date(V.createdAt).toLocaleString("zh-CN")}),s.jsx(be,{children:(V.status==="paid"||V.status==="completed")&&V.paymentMethod!=="balance"&&s.jsxs(ee,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{R(V),_("")},children:[s.jsx(sj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},V.id)}),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(us,{page:f,totalPages:H,total:a,pageSize:g,onPageChange:m,onPageSizeChange:V=>{y(V),m(1)}})]})})}),s.jsx(Rt,{open:!!D,onOpenChange:V=>!V&&R(null),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Pt,{children:s.jsx(Ot,{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(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:O,onChange:V=>_(V.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>R(null),disabled:re,children:"取消"}),s.jsx(ee,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:I,disabled:re,children:re?"退款中...":"确认退款"})]})]})})]})}const Hl=b.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Et("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}));Hl.displayName="Textarea";const Mc=[{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 gP(){var Fo,Bo,aa,ia,_s,oa;const[t,e]=Kw(),n=t.get("pool"),[r,a]=b.useState([]),[i,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=a0(m,300),N=n==="vip"?"vip":n==="complete"?"complete":"all",[j,v]=b.useState(N),[k,E]=b.useState(!0),[C,T]=b.useState(!1),[P,F]=b.useState(null),[D,R]=b.useState(!1),[O,_]=b.useState("desc");b.useEffect(()=>{n==="vip"?v("vip"):n==="complete"?v("complete"):n==="all"&&v("all")},[n]);const[re,ne]=b.useState(!1),[he,xe]=b.useState(null),[z,U]=b.useState(!1),[H,I]=b.useState(!1),[q,V]=b.useState({referrals:[],stats:{}}),[L,K]=b.useState(!1),[oe,Y]=b.useState(null),[X,W]=b.useState(!1),[se,de]=b.useState(null),[ce,ye]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Le,Pe]=b.useState([]),[at,Mt]=b.useState(!1),[on,bt]=b.useState(!1),[nn,In]=b.useState(null),[At,Jt]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[rn,Rn]=b.useState([]),[xr,Pn]=b.useState(!1),[Un,G]=b.useState(null),[We,qe]=b.useState(null),[yt,ct]=b.useState({}),[tt,gt]=b.useState(!1),[Yt,ln]=b.useState(null),[tr,nr]=b.useState([]),[Ps,Or]=b.useState(!1),[Os,pe]=b.useState(!1);async function ge($=!1){var Te;E(!0),$&&T(!0),F(null);try{if(D){const Je=new URLSearchParams({search:y,limit:String(h*5)}),ut=await Oe(`/api/db/users/rfm?${Je}`);if(ut!=null&&ut.success){let vn=ut.users||[];O==="asc"&&(vn=[...vn].reverse());const Cn=(c-1)*h;a(vn.slice(Cn,Cn+h)),o(((Te=ut.users)==null?void 0:Te.length)??0),vn.length===0&&(R(!1),F("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else R(!1),F((ut==null?void 0:ut.error)||"RFM 加载失败,已切回普通模式")}else{const Je=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...j==="vip"&&{vip:"true"},...j==="complete"&&{pool:"complete"}}),ut=await Oe(`/api/db/users?${Je}`);ut!=null&&ut.success?(a(ut.users||[]),o(ut.total??0)):F((ut==null?void 0:ut.error)||"加载失败")}}catch(Je){console.error("Load users error:",Je),F("网络错误")}finally{E(!1),$&&T(!1)}}b.useEffect(()=>{u(1)},[y,j,D]),b.useEffect(()=>{ge()},[c,h,y,j,D,O]);const cn=Math.ceil(i/h)||1,On=()=>{D?O==="desc"?_("asc"):(R(!1),_("desc")):(R(!0),_("desc"))},Zs=$=>({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"})[$||""]||"bg-gray-500/20 text-gray-400";async function ea($){if(confirm("确定要删除这个用户吗?"))try{const Te=await Ws(`/api/db/users?id=${encodeURIComponent($)}`);Te!=null&&Te.success?ge():ae.error("删除失败: "+((Te==null?void 0:Te.error)||""))}catch{ae.error("删除失败")}}const ms=$=>{xe($),ye({phone:$.phone||"",nickname:$.nickname||"",password:"",isAdmin:!!($.isAdmin??!1),hasFullBook:!!($.hasFullBook??!1)}),ne(!0)},ta=()=>{xe(null),ye({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),ne(!0)};async function xt(){if(!ce.phone||!ce.nickname){ae.error("请填写手机号和昵称");return}U(!0);try{if(he){const $=await Dt("/api/db/users",{id:he.id,phone:ce.phone||void 0,nickname:ce.nickname,isAdmin:ce.isAdmin,hasFullBook:ce.hasFullBook,...ce.password&&{password:ce.password}});if(!($!=null&&$.success)){ae.error("更新失败: "+(($==null?void 0:$.error)||""));return}}else{const $=await Nt("/api/db/users",{phone:ce.phone,nickname:ce.nickname,password:ce.password,isAdmin:ce.isAdmin});if(!($!=null&&$.success)){ae.error("创建失败: "+(($==null?void 0:$.error)||""));return}}ne(!1),ge()}catch{ae.error("保存失败")}finally{U(!1)}}async function Dn($){Y($),I(!0),K(!0);try{const Te=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent($.id)}`);Te!=null&&Te.success?V({referrals:Te.referrals||[],stats:Te.stats||{}}):V({referrals:[],stats:{}})}catch{V({referrals:[],stats:{}})}finally{K(!1)}}const yr=b.useCallback(async()=>{Mt(!0);try{const $=await Oe("/api/db/user-rules");$!=null&&$.success&&Pe($.rules||[])}catch{}finally{Mt(!1)}},[]);async function Ds(){if(!At.title){ae.error("请填写规则标题");return}U(!0);try{if(nn){const $=await Dt("/api/db/user-rules",{id:nn.id,...At});if(!($!=null&&$.success)){ae.error("更新失败: "+(($==null?void 0:$.error)||"未知错误"));return}ae.success("规则已更新")}else{const $=await Nt("/api/db/user-rules",At);if(!($!=null&&$.success)){ae.error("创建失败: "+(($==null?void 0:$.error)||"未知错误"));return}ae.success("规则已创建")}bt(!1),yr()}catch($){const Te=$;(Te==null?void 0:Te.status)===401?ae.error("登录已过期,请重新登录"):(Te==null?void 0:Te.status)===404?ae.error("接口不存在,请确认后端已部署最新版本"):ae.error("保存失败: "+((Te==null?void 0:Te.message)||"网络错误"))}finally{U(!1)}}async function na($){if(confirm("确定删除?"))try{const Te=await Ws(`/api/db/user-rules?id=${$}`);Te!=null&&Te.success&&yr()}catch{}}async function Kn($){try{await Dt("/api/db/user-rules",{id:$.id,enabled:!$.enabled}),yr()}catch{}}const rr=b.useCallback(async()=>{Pn(!0);try{const $=await Oe("/api/db/vip-members?limit=500");if($!=null&&$.success&&$.data){const Te=[...$.data].map((Je,ut)=>({...Je,vipSort:typeof Je.vipSort=="number"?Je.vipSort:ut+1}));Te.sort((Je,ut)=>(Je.vipSort??999999)-(ut.vipSort??999999)),Rn(Te)}else $&&$.error&&ae.error($.error)}catch{ae.error("加载超级个体列表失败")}finally{Pn(!1)}},[]),[gs,Dr]=b.useState(!1),[qr,Ln]=b.useState(null),[Gr,Di]=b.useState(""),[Jr,Li]=b.useState(!1),_i=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],Jl=$=>{Ln($),Di($.vipRole||""),Dr(!0)},zi=async $=>{const Te=$.trim();if(qr){if(!Te){ae.error("请选择或输入标签");return}Li(!0);try{const Je=await Dt("/api/db/users",{id:qr.id,vipRole:Te});if(!(Je!=null&&Je.success)){ae.error((Je==null?void 0:Je.error)||"更新超级个体标签失败");return}ae.success("已更新超级个体标签"),Dr(!1),Ln(null),await rr()}catch{ae.error("更新超级个体标签失败")}finally{Li(!1)}}},[Yr,br]=b.useState(!1),[Qr,$i]=b.useState(null),[Ls,It]=b.useState(""),[Fi,xs]=b.useState(!1),zo=$=>{$i($),It($.vipSort!=null?String($.vipSort):""),br(!0)},ra=async()=>{if(!Qr)return;const $=Number(Ls);if(!Number.isFinite($)){ae.error("请输入有效的数字序号");return}xs(!0);try{const Te=await Dt("/api/db/users",{id:Qr.id,vipSort:$});if(!(Te!=null&&Te.success)){ae.error((Te==null?void 0:Te.error)||"更新排序序号失败");return}ae.success("已更新排序序号"),br(!1),$i(null),await rr()}catch{ae.error("更新排序序号失败")}finally{xs(!1)}},$o=($,Te)=>{$.dataTransfer.effectAllowed="move",$.dataTransfer.setData("text/plain",Te),G(Te)},Bi=($,Te)=>{$.preventDefault(),We!==Te&&qe(Te)},sa=()=>{G(null),qe(null)},Sr=async($,Te)=>{$.preventDefault();const Je=$.dataTransfer.getData("text/plain")||Un;if(G(null),qe(null),!Je||Je===Te)return;const ut=rn.find(Ut=>Ut.id===Je),vn=rn.find(Ut=>Ut.id===Te);if(!ut||!vn)return;const Cn=ut.vipSort??rn.findIndex(Ut=>Ut.id===Je)+1,Hi=vn.vipSort??rn.findIndex(Ut=>Ut.id===Te)+1;Rn(Ut=>{const it=[...Ut],la=it.findIndex(me=>me.id===Je),ca=it.findIndex(me=>me.id===Te);if(la===-1||ca===-1)return Ut;const Xr=[...it],[M,Q]=[Xr[la],Xr[ca]];return Xr[la]={...Q,vipSort:Cn},Xr[ca]={...M,vipSort:Hi},Xr});try{const[Ut,it]=await Promise.all([Dt("/api/db/users",{id:Je,vipSort:Hi}),Dt("/api/db/users",{id:Te,vipSort:Cn})]);if(!(Ut!=null&&Ut.success)||!(it!=null&&it.success)){ae.error((Ut==null?void 0:Ut.error)||(it==null?void 0:it.error)||"更新排序失败"),await rr();return}ae.success("已更新排序"),await rr()}catch{ae.error("更新排序失败"),await rr()}},Vi=b.useCallback(async()=>{gt(!0);try{const $=await Oe("/api/db/users/journey-stats");$!=null&&$.success&&$.stats&&ct($.stats)}catch{}finally{gt(!1)}},[]);async function _n($){ln($),Or(!0);try{const Te=await Oe(`/api/db/users/journey-users?stage=${encodeURIComponent($)}&limit=20`);Te!=null&&Te.success&&Te.users?nr(Te.users):nr([])}catch{nr([])}finally{Or(!1)}}async function Yl($){if(!$.hasFullBook){ae.error("仅 VIP 用户可置顶到超级个体");return}if(confirm("确定将该用户置顶到首页超级个体位?(最多4位)"))try{const Te=await Dt("/api/db/users",{id:$.id,vipSort:1});if(!(Te!=null&&Te.success)){ae.error((Te==null?void 0:Te.error)||"置顶失败");return}ae.success("已置顶到超级个体"),ge()}catch{ae.error("置顶失败")}}return s.jsxs("div",{className:"p-8 w-full",children:[P&&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:P}),s.jsx("button",{type:"button",onClick:()=>F(null),children:"×"})]}),s.jsx("div",{className:"flex justify-between items-center mb-6",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>pe(!0),className:"text-gray-500 hover:text-[#38bdac] h-8 w-8 p-0",title:"RFM 算法说明",children:s.jsx(Oc,{className:"w-4 h-4"})})]}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",i," 位注册用户",D&&" · RFM 排序中"]})]})}),s.jsxs(jd,{defaultValue:"users",className:"w-full",children:[s.jsxs(Vl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(Zt,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(cr,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(Zt,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Vi,children:[s.jsx(Nl,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(Zt,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:yr,children:[s.jsx(mo,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(Zt,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:rr,children:[s.jsx(jl,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(en,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(ee,{variant:"outline",onClick:()=>ge(!0),disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:j,onChange:$=>{const Te=$.target.value;v(Te),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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ie,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:$=>g($.target.value)})]}),s.jsxs(ee,{onClick:ta,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(zg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{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(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"用户信息"}),s.jsx(ke,{className:"text-gray-400",children:"绑定信息"}),s.jsx(ke,{className:"text-gray-400",children:"购买状态"}),s.jsx(ke,{className:"text-gray-400",children:"分销收益"}),s.jsx(ke,{className:"text-gray-400",children:"余额/提现"}),s.jsxs(ke,{className:"text-gray-400 cursor-pointer select-none",onClick:On,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Tl,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),D?O==="desc"?s.jsx(rd,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Gw,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Tm,{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(ke,{className:"text-gray-400",children:"注册时间"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(fr,{children:[r.map($=>{var Te,Je,ut;return s.jsxs(ot,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{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:$.avatar?s.jsx("img",{src:ps($.avatar),className:"w-full h-full rounded-full object-cover",alt:""}):((Te=$.nickname)==null?void 0:Te.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{de($.id),W(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:$.nickname}),$.isAdmin&&s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),$.openId&&!((Je=$.id)!=null&&Je.startsWith("user_"))&&s.jsx(Ke,{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:$.openId?$.openId.slice(0,12)+"...":(ut=$.id)==null?void 0:ut.slice(0,12)})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[$.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:$.phone})]}),$.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:$.wechatId})]}),$.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:$.openId,children:[$.openId.slice(0,12),"..."]})]}),!$.phone&&!$.wechatId&&!$.openId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(be,{children:$.hasFullBook?s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String($.earnings||0)).toFixed(2)]}),parseFloat(String($.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String($.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Dn($),role:"button",tabIndex:0,onKeyDown:vn=>vn.key==="Enter"&&Dn($),children:[s.jsx(cr,{className:"w-3 h-3"})," 绑定",$.referralCount||0,"人"]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String($.walletBalance||0)).toFixed(2)]}),parseFloat(String($.withdrawnEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-gray-400",children:["已提现: ¥",parseFloat(String($.withdrawnEarnings||0)).toFixed(2)]})]})}),s.jsx(be,{children:$.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:$.rfmScore}),s.jsx(Ke,{className:`border-0 text-xs ${Zs($.rfmLevel)}`,children:$.rfmLevel})]})}):s.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",s.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),s.jsx(be,{className:"text-gray-400",children:$.createdAt?new Date($.createdAt).toLocaleDateString():"-"}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>{de($.id),W(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(Pg,{className:"w-4 h-4"})}),$.hasFullBook&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Yl($),className:"text-gray-400 hover:text-orange-400 hover:bg-orange-400/10",title:"置顶超级个体",children:s.jsx(co,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>ms($),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(Vt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>ea($.id),title:"删除",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},$.id)}),r.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(us,{page:c,totalPages:cn,total:i,pageSize:h,onPageChange:u,onPageSizeChange:$=>{f($),u(1)}})]})})})]}),s.jsxs(en,{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(ee,{variant:"outline",onClick:Vi,disabled:tt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${tt?"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:Mc.map(($,Te)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{role:"button",tabIndex:0,className:`relative w-full p-3 rounded-xl border ${$.color} text-center cursor-pointer`,onClick:()=>_n($.id),onKeyDown:Je=>Je.key==="Enter"&&_n($.id),children:[s.jsx("div",{className:"text-2xl mb-1",children:$.icon}),s.jsx("div",{className:`text-xs font-medium ${$.color.split(" ").find(Je=>Je.startsWith("text-"))}`,children:$.label}),yt[$.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:yt[$.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:Te+1})]}),Te$.id===Yt))==null?void 0:Fo.label," — 用户列表"]}),s.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ln(null),className:"text-gray-500 hover:text-white",children:[s.jsx(Zn,{className:"w-4 h-4"})," 关闭"]})]}),Ps?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):tr.length>0?s.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:tr.map($=>s.jsxs("div",{className:"flex items-center justify-between py-2 px-3 bg-[#0a1628] rounded-lg hover:bg-[#0a1628]/80 cursor-pointer",onClick:()=>{de($.id),W(!0)},onKeyDown:Te=>Te.key==="Enter"&&(de($.id),W(!0)),role:"button",tabIndex:0,children:[s.jsx("span",{className:"text-white font-medium",children:$.nickname}),s.jsx("span",{className:"text-gray-400 text-sm",children:$.phone||"—"}),s.jsx("span",{className:"text-gray-500 text-xs",children:$.createdAt?new Date($.createdAt).toLocaleDateString():"—"})]},$.id))}):s.jsx("p",{className:"text-gray-500 text-sm py-4",children:"暂无用户"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[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(Nl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"旅程关键节点"})]}),s.jsx("div",{className:"space-y-2 text-sm",children:[{step:"① 注册",action:"微信 OAuth 或手机号注册",next:"引导填写头像"},{step:"② 浏览",action:"点击章节/阅读免费内容",next:"触发绑定手机"},{step:"③ 首付",action:"购买单章或全书",next:"推送分销功能"},{step:"④ VIP",action:"¥1980 购买全书",next:"进入 VIP 私域群"},{step:"⑤ 分销",action:"推广好友购买",next:"提现分销收益"}].map($=>s.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:$.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:$.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",$.next]})]})]},$.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(Wr,{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:"实时更新"})]}),tt?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(yt).length>0?s.jsx("div",{className:"space-y-2",children:Mc.map($=>{const Te=yt[$.id]||0,Je=Math.max(...Mc.map(vn=>yt[vn.id]||0),1),ut=Math.round(Te/Je*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:[$.icon," ",$.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:`${ut}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Te})]},$.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),s.jsxs(en,{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(ee,{variant:"outline",onClick:yr,disabled:at,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${at?"animate-spin":""}`})," 刷新"]}),s.jsxs(ee,{onClick:()=>{In(null),Jt({title:"",description:"",trigger:"",sort:0,enabled:!0}),bt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(fn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),at?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Le.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Wr,{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(ee,{onClick:yr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(He,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Le.map($=>s.jsx("div",{className:`p-4 rounded-lg border transition-all ${$.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(Vt,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium",children:$.title}),$.trigger&&s.jsxs(Ke,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",$.trigger]}),s.jsx(Ke,{className:`text-xs border-0 ${$.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:$.enabled?"启用":"禁用"})]}),$.description&&s.jsx("p",{className:"text-gray-400 text-sm ml-6",children:$.description})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[s.jsx(kt,{checked:$.enabled,onCheckedChange:()=>Kn($)}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>{In($),Jt({title:$.title,description:$.description,trigger:$.trigger,sort:$.sort,enabled:$.enabled}),bt(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Vt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>na($.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Yn,{className:"w-4 h-4"})})]})]})},$.id))})]}),s.jsxs(en,{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(ee,{variant:"outline",onClick:rr,disabled:xr,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${xr?"animate-spin":""}`})," ","刷新"]})})]}),xr?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):rn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(jl,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400 w-16",children:"序号"}),s.jsx(ke,{className:"text-gray-400",children:"成员"}),s.jsx(ke,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),s.jsx(ke,{className:"text-gray-400 w-24",children:"排序值"}),s.jsx(ke,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),s.jsx(fr,{children:rn.map(($,Te)=>{var vn;const Je=Un===$.id,ut=We===$.id;return s.jsxs(ot,{draggable:!0,onDragStart:Cn=>$o(Cn,$.id),onDragOver:Cn=>Bi(Cn,$.id),onDrop:Cn=>Sr(Cn,$.id),onDragEnd:sa,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Je?"opacity-60":""} ${ut?"bg-[#38bdac]/10":""}`,children:[s.jsx(be,{className:"text-gray-300",children:Te+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[$.avatar?s.jsx("img",{src:ps($.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:((vn=$.name)==null?void 0:vn[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:$.name})})]})}),s.jsx(be,{className:"text-gray-300 whitespace-nowrap",children:$.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(be,{className:"text-gray-300",children:$.vipSort??Te+1}),s.jsx(be,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>Jl($),title:"设置超级个体标签",children:s.jsx(Hc,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{de($.id),W(!0)},title:"编辑资料",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>zo($),title:"设置排序序号",children:s.jsx(Tm,{className:"w-3.5 h-3.5"})})]})})]},$.id)})})]})})})]})]}),s.jsx(Rt,{open:Yr,onOpenChange:$=>{br($),$||$i(null)},children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Tm,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",Qr==null?void 0:Qr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:Ls,onChange:$=>It($.target.value)})]}),s.jsxs(Xt,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>br(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:ra,disabled:Fi,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),Fi?"保存中...":"保存"]})]})]})}),s.jsx(Rt,{open:gs,onOpenChange:$=>{Dr($),$||Ln(null)},children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(jl,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",qr==null?void 0:qr.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:_i.map($=>s.jsx(ee,{variant:Gr===$?"default":"outline",size:"sm",className:Gr===$?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Di($),children:$},$))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:Gr,onChange:$=>Di($.target.value)})]})]}),s.jsxs(Xt,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>Dr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:()=>zi(Gr),disabled:Jr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),Jr?"保存中...":"保存"]})]})]})}),s.jsx(Rt,{open:re,onOpenChange:ne,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[he?s.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(zg,{className:"w-5 h-5 text-[#38bdac]"}),he?"编辑用户":"添加用户"]})}),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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ce.phone,onChange:$=>ye({...ce,phone:$.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ce.nickname,onChange:$=>ye({...ce,nickname:$.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:he?"新密码 (留空则不修改)":"密码"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:he?"留空则不修改":"请输入密码",value:ce.password,onChange:$=>ye({...ce,password:$.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"管理员权限"}),s.jsx(kt,{checked:ce.isAdmin,onCheckedChange:$=>ye({...ce,isAdmin:$})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"已购全书"}),s.jsx(kt,{checked:ce.hasFullBook,onCheckedChange:$=>ye({...ce,hasFullBook:$})})]})]}),s.jsxs(Xt,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>ne(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:xt,disabled:z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),z?"保存中...":"保存"]})]})]})}),s.jsx(Rt,{open:on,onOpenChange:bt,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}),nn?"编辑规则":"添加规则"]})}),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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:At.title,onChange:$=>Jt({...At,title:$.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则描述"}),s.jsx(Hl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:At.description,onChange:$=>Jt({...At,description:$.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"触发条件"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:At.trigger,onChange:$=>Jt({...At,trigger:$.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(kt,{checked:At.enabled,onCheckedChange:$=>Jt({...At,enabled:$})})]})]}),s.jsxs(Xt,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>bt(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:Ds,disabled:z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),z?"保存中...":"保存"]})]})]})}),s.jsx(Rt,{open:H,onOpenChange:I,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(cr,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",oe==null?void 0:oe.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:((Bo=q.stats)==null?void 0:Bo.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:((aa=q.stats)==null?void 0:aa.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:["¥",(((ia=q.stats)==null?void 0:ia.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:["¥",(((_s=q.stats)==null?void 0:_s.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),L?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((oa=q.referrals)==null?void 0:oa.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(q.referrals??[]).map(($,Te)=>{var ut;const Je=$;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:((ut=Je.nickname)==null?void 0:ut.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Je.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Je.phone||(Je.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Je.status==="vip"&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Je.status==="paid"&&s.jsxs(Ke,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Je.purchasedSections,"章"]}),Je.status==="free"&&s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Je.createdAt?new Date(Je.createdAt).toLocaleDateString():""})]})]},Je.id||Te)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(Xt,{children:s.jsx(ee,{variant:"outline",onClick:()=>I(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(Rt,{open:Os,onOpenChange:pe,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Tl,{className:"w-5 h-5 text-[#38bdac]"}),"RFM 算法说明"]})}),s.jsxs("div",{className:"space-y-3 py-4 text-sm text-gray-300",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"R(Recency)"}),":距最近购买天数,越近分越高,权重 40%"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"F(Frequency)"}),":购买频次,越多分越高,权重 30%"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"M(Monetary)"}),":消费金额,越高分越高,权重 30%"]}),s.jsx("p",{className:"text-gray-400",children:"综合分 = R×40% + F×30% + M×30%,归一化到 0-100"}),s.jsxs("p",{className:"text-gray-400",children:["等级:",s.jsx("span",{className:"text-amber-400",children:"S"}),"(≥85)、",s.jsx("span",{className:"text-green-400",children:"A"}),"(≥70)、",s.jsx("span",{className:"text-blue-400",children:"B"}),"(≥50)、",s.jsx("span",{className:"text-gray-400",children:"C"}),"(≥30)、",s.jsx("span",{className:"text-red-400",children:"D"}),"(<30)"]})]}),s.jsx(Xt,{children:s.jsx(ee,{variant:"outline",onClick:()=>pe(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(s0,{open:X,onClose:()=>W(!1),userId:se,onUserUpdated:ge})]})}function xh(t,[e,n]){return Math.min(n,Math.max(e,t))}var Sk=["PageUp","PageDown"],Ck=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ek={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Wl="Slider",[Hg,xP,yP]=e0(Wl),[Tk]=Mi(Wl,[yP]),[bP,jf]=Tk(Wl),Mk=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:N,...j}=t,v=b.useRef(new Set),k=b.useRef(0),C=o==="horizontal"?vP:NP,[T=[],P]=jo({prop:f,defaultProp:h,onChange:re=>{var he;(he=[...v.current][k.current])==null||he.focus(),m(re)}}),F=b.useRef(T);function D(re){const ne=CP(T,re);_(re,ne)}function R(re){_(re,k.current)}function O(){const re=F.current[k.current];T[k.current]!==re&&g(T)}function _(re,ne,{commit:he}={commit:!1}){const xe=AP(i),z=IP(Math.round((re-r)/i)*i+r,xe),U=xh(z,[r,a]);P((H=[])=>{const I=kP(H,U,ne);if(MP(I,u*i)){k.current=I.indexOf(U);const q=String(I)!==String(H);return q&&he&&g(I),q?I:H}else return H})}return s.jsx(bP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:v.current,values:T,orientation:o,form:N,children:s.jsx(Hg.Provider,{scope:t.__scopeSlider,children:s.jsx(Hg.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:lt(j.onPointerDown,()=>{c||(F.current=T)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:D,onSlideMove:c?void 0:R,onSlideEnd:c?void 0:O,onHomeKeyDown:()=>!c&&_(r,0,{commit:!0}),onEndKeyDown:()=>!c&&_(a,T.length-1,{commit:!0}),onStepKeyDown:({event:re,direction:ne})=>{if(!c){const z=Sk.includes(re.key)||re.shiftKey&&Ck.includes(re.key)?10:1,U=k.current,H=T[U],I=i*z*ne;_(H+I,U,{commit:!0})}}})})})})});Mk.displayName=Wl;var[Ak,Ik]=Tk(Wl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),vP=b.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=Ct(e,C=>g(C)),N=b.useRef(void 0),j=vf(a),v=j==="ltr",k=v&&!i||!v&&i;function E(C){const T=N.current||m.getBoundingClientRect(),P=[0,T.width],D=i0(P,k?[n,r]:[r,n]);return N.current=T,D(C-T.left)}return s.jsx(Ak,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(Rk,{dir:j,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const T=E(C.clientX);o==null||o(T)},onSlideMove:C=>{const T=E(C.clientX);c==null||c(T)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:C=>{const P=Ek[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:P?-1:1})}})})}),NP=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=Ct(e,f),g=b.useRef(void 0),y=!a;function N(j){const v=g.current||f.current.getBoundingClientRect(),k=[0,v.height],C=i0(k,y?[r,n]:[n,r]);return g.current=v,C(j-v.top)}return s.jsx(Ak,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(Rk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const v=N(j.clientY);i==null||i(v)},onSlideMove:j=>{const v=N(j.clientY);o==null||o(v)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=Ek[y?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),Rk=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=jf(Wl,n);return s.jsx(ft.span,{...h,ref:e,onKeyDown:lt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):Sk.concat(Ck).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:lt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:lt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:lt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),Pk="SliderTrack",Ok=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=jf(Pk,n);return s.jsx(ft.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});Ok.displayName=Pk;var Wg="SliderRange",Dk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=jf(Wg,n),i=Ik(Wg,n),o=b.useRef(null),c=Ct(e,o),u=a.values.length,h=a.values.map(g=>zk(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(ft.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});Dk.displayName=Wg;var Ug="SliderThumb",Lk=b.forwardRef((t,e)=>{const n=xP(t.__scopeSlider),[r,a]=b.useState(null),i=Ct(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(wP,{...t,ref:i,index:o})}),wP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=jf(Ug,n),c=Ik(Ug,n),[u,h]=b.useState(null),f=Ct(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,g=r0(u),y=o.values[r],N=y===void 0?0:zk(y,o.min,o.max),j=SP(r,o.values.length),v=g==null?void 0:g[c.size],k=v?EP(v,N,c.direction):0;return b.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(${N}% + ${k}px)`},children:[s.jsx(Hg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(ft.span,{role:"slider","aria-label":t["aria-label"]||j,"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,...i,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:lt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(_k,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Lk.displayName=Ug;var jP="RadioBubbleInput",_k=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=Ct(a,r),o=n0(e);return b.useEffect(()=>{const c=a.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(ft.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});_k.displayName=jP;function kP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function zk(t,e,n){const i=100/(n-e)*(t-e);return xh(i,[0,100])}function SP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function CP(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),r=Math.min(...n);return n.indexOf(r)}function EP(t,e,n){const r=t/2,i=i0([0,50],[0,r]);return(r-i(e)*n)*n}function TP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function MP(t,e){if(e>0){const n=TP(t);return Math.min(...n)>=e}return!0}function i0(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 AP(t){return(String(t).split(".")[1]||"").length}function IP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var RP=Mk,PP=Ok,OP=Dk,DP=Lk;function LP({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(RP,{defaultValue:e,value:n,min:r,max:a,className:Et("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(PP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(OP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(DP,{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 _P={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function $k(t){const[e,n]=b.useState(_P),[r,a]=b.useState(!0),[i,o]=b.useState(!1);b.useEffect(()=>{Oe("/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(()=>a(!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 Nt("/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(Ml,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),s.jsxs(ee,{onClick:c,disabled:i||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"flex items-center gap-2 text-white",children:[s.jsx(mA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Lt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ie,{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(Oc,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(ie,{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(cr,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(LP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(ie,{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(Oc,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(ie,{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(Oc,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(ie,{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(cr,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(ie,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"flex items-center gap-2 text-white",children:[s.jsx(Ml,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Lt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ie,{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(ie,{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(Ke,{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(kt,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(Ye,{children:s.jsxs(Qe,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(Oc,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ie,{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 zP(){var Un;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[N,j]=b.useState(null),[v,k]=b.useState(""),[E,C]=b.useState("all"),[T,P]=b.useState(1),[F,D]=b.useState(10),[R,O]=b.useState(0),[_,re]=b.useState(new Set),[ne,he]=b.useState(null),[xe,z]=b.useState(""),[U,H]=b.useState(!1),[I,q]=b.useState(null),[V,L]=b.useState(""),[K,oe]=b.useState(!1),[Y,X]=b.useState([]),[W,se]=b.useState(1),[de,ce]=b.useState(0),[ye,Le]=b.useState("");b.useEffect(()=>{Pe()},[]),b.useEffect(()=>{P(1)},[t,E]),b.useEffect(()=>{at(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&at(t,!0),t==="giftPay"&&at("giftPay",!0)},[T,F,E,v,W,ye]);async function Pe(){j(null);try{const G=await Oe("/api/admin/distribution/overview");G!=null&&G.success&&G.overview&&i(G.overview)}catch(G){console.error("[Admin] 概览接口异常:",G),j("加载概览失败")}try{const G=await Oe("/api/db/users");m((G==null?void 0:G.users)||[])}catch(G){console.error("[Admin] 用户数据加载失败:",G)}}async function at(G,We=!1){var qe;if(!(!We&&_.has(G))){y(!0);try{const yt=f;switch(G){case"overview":break;case"orders":{try{const ct=new URLSearchParams({page:String(T),pageSize:String(F),...E!=="all"&&{status:E},...v&&{search:v}}),tt=await Oe(`/api/admin/orders?${ct}`);if(tt!=null&&tt.success&&tt.orders){const gt=tt.orders.map(Yt=>{const ln=yt.find(nr=>nr.id===Yt.userId),tr=Yt.referrerId?yt.find(nr=>nr.id===Yt.referrerId):null;return{...Yt,amount:parseFloat(String(Yt.amount))||0,userNickname:(ln==null?void 0:ln.nickname)||Yt.userNickname||"未知用户",userPhone:(ln==null?void 0:ln.phone)||Yt.userPhone||"-",referrerNickname:(tr==null?void 0:tr.nickname)||null,referrerCode:(tr==null?void 0:tr.referralCode)??null,type:Yt.productType||Yt.type}});r(gt),O(tt.total??gt.length)}else r([]),O(0)}catch(ct){console.error(ct),j("加载订单失败"),r([])}break}case"bindings":{try{const ct=new URLSearchParams({page:String(T),pageSize:String(F),...E!=="all"&&{status:E}}),tt=await Oe(`/api/db/distribution?${ct}`);c((tt==null?void 0:tt.bindings)||[]),O((tt==null?void 0:tt.total)??((qe=tt==null?void 0:tt.bindings)==null?void 0:qe.length)??0)}catch(ct){console.error(ct),j("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const ct=E==="completed"?"success":E==="rejected"?"failed":E,tt=new URLSearchParams({...ct&&ct!=="all"&&{status:ct},page:String(T),pageSize:String(F)}),gt=await Oe(`/api/admin/withdrawals?${tt}`);if(gt!=null&>.success&>.withdrawals){const Yt=gt.withdrawals.map(ln=>({...ln,account:ln.account??"未绑定微信号",status:ln.status==="success"?"completed":ln.status==="failed"?"rejected":ln.status}));h(Yt),O((gt==null?void 0:gt.total)??Yt.length)}else gt!=null&>.success||j(`获取提现记录失败: ${(gt==null?void 0:gt.error)||"未知错误"}`),h([])}catch(ct){console.error(ct),j("加载提现数据失败"),h([])}break}case"giftPay":{try{const ct=new URLSearchParams({page:String(W),pageSize:"20",...ye&&{status:ye}}),tt=await Oe(`/api/admin/gift-pay-requests?${ct}`);tt!=null&&tt.success&&tt.data?(X(tt.data),ce(tt.total??tt.data.length)):(X([]),ce(0))}catch(ct){console.error(ct),j("加载代付请求失败"),X([])}break}}re(ct=>new Set(ct).add(G))}catch(yt){console.error(yt)}finally{y(!1)}}}async function Mt(){j(null),re(G=>{const We=new Set(G);return We.delete(t),We}),t==="overview"&&Pe(),await at(t,!0)}async function on(G){if(confirm("确认审核通过并打款?"))try{const We=await Dt("/api/admin/withdrawals",{id:G,action:"approve"});if(!(We!=null&&We.success)){const qe=(We==null?void 0:We.message)||(We==null?void 0:We.error)||"操作失败";ae.error(qe);return}await Mt()}catch(We){console.error(We),ae.error("操作失败")}}function bt(G){q(G),L("")}async function nn(){const G=I;if(!G)return;const We=V.trim();if(!We){ae.error("请填写拒绝原因");return}oe(!0);try{const qe=await Dt("/api/admin/withdrawals",{id:G,action:"reject",errorMessage:We});if(!(qe!=null&&qe.success)){ae.error((qe==null?void 0:qe.error)||"操作失败");return}ae.success("已拒绝该提现申请"),q(null),L(""),await Mt()}catch(qe){console.error(qe),ae.error("操作失败")}finally{oe(!1)}}function In(){I&&ae.info("已取消操作"),q(null),L("")}async function At(){var G;if(!(!(ne!=null&&ne.orderSn)&&!(ne!=null&&ne.id))){H(!0),j(null);try{const We=await Dt("/api/admin/orders/refund",{orderSn:ne.orderSn||ne.id,reason:xe||void 0});We!=null&&We.success?(he(null),z(""),await at("orders",!0)):j((We==null?void 0:We.error)||"退款失败")}catch(We){const qe=We;j(((G=qe==null?void 0:qe.data)==null?void 0:G.error)||"退款失败,请检查网络后重试")}finally{H(!1)}}}function Jt(G){const We={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(Ke,{className:`${We[G]||"bg-gray-500/20 text-gray-400"} border-0`,children:qe[G]||G})}const rn=Math.ceil(R/F)||1,Rn=n,xr=o.filter(G=>{var qe,yt,ct,tt;if(!v)return!0;const We=v.toLowerCase();return((qe=G.refereeNickname)==null?void 0:qe.toLowerCase().includes(We))||((yt=G.refereePhone)==null?void 0:yt.includes(We))||((ct=G.referrerName)==null?void 0:ct.toLowerCase().includes(We))||((tt=G.referrerCode)==null?void 0:tt.toLowerCase().includes(We))}),Pn=u.filter(G=>{var qe;if(!v)return!0;const We=v.toLowerCase();return((qe=G.userName)==null?void 0:qe.toLowerCase().includes(We))||G.account&&G.account.toLowerCase().includes(We)});return s.jsxs("div",{className:"p-8 w-full",children:[N&&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:N}),s.jsx("button",{type:"button",onClick:()=>j(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(ee,{onClick:Mt,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(He,{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:Tl},{key:"orders",label:"订单管理",icon:hh},{key:"bindings",label:"绑定管理",icon:Ts},{key:"withdrawals",label:"提现审核",icon:Ml},{key:"giftPay",label:"代付请求",icon:Zw},{key:"settings",label:"推广设置",icon:mo}].map(G=>s.jsxs("button",{type:"button",onClick:()=>{e(G.key),C("all"),k(""),G.key==="giftPay"&&(Le(""),se(1))},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===G.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[s.jsx(G.icon,{className:"w-4 h-4"}),G.label]},G.key))}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{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"&&a&&s.jsxs("div",{className:"space-y-5",children:[s.jsx("div",{className:"grid grid-cols-6 gap-3",children:[{label:"今日点击",value:a.todayClicks,icon:Pg,color:"blue"},{label:"独立用户",value:a.todayUniqueVisitors??0,icon:cr,color:"cyan"},{label:"人均点击",value:(a.todayClickRate??0).toFixed(1),icon:Tl,color:"amber"},{label:"今日绑定",value:a.todayBindings,icon:Ts,color:"green"},{label:"今日转化",value:a.todayConversions,icon:Bv,color:"purple"},{label:"今日佣金",value:`¥${a.todayEarnings.toFixed(2)}`,icon:hh,color:"teal",isMoney:!0}].map(G=>s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:G.label}),s.jsx(G.icon,{className:`w-4 h-4 text-${G.color}-400 opacity-60`})]}),s.jsx("p",{className:`text-xl font-bold ${G.isMoney?"text-[#38bdac]":"text-white"}`,children:G.value})]})},G.label))}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 col-span-2",children:s.jsxs(Ie,{className:"p-4",children:[s.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-1.5",children:[s.jsx(Pg,{className:"w-4 h-4 text-[#38bdac]"})," 今日文章点击分布"]}),(((Un=a.todayClicksByPage)==null?void 0:Un.length)??0)>0?s.jsx("div",{className:"space-y-1.5 max-h-[200px] overflow-y-auto",children:[...a.todayClicksByPage??[]].sort((G,We)=>We.clicks-G.clicks).map((G,We)=>s.jsxs("div",{className:"flex items-center justify-between text-xs py-1 border-b border-gray-700/30 last:border-0",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",children:G.page||"(未区分)"}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("span",{className:"text-white font-medium",children:G.clicks}),s.jsxs("span",{className:"text-gray-500 w-12 text-right",children:[a.todayClicks>0?(G.clicks/a.todayClicks*100).toFixed(1):0,"%"]})]})]},We))}):s.jsx("p",{className:"text-gray-500 text-xs",children:"今日暂无点击数据"})]})}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ae,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ie,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Rg,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-orange-300 text-xs font-medium",children:"即将过期"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[a.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/50 text-[10px]",children:"7天内到期"})]})]})})}),s.jsx(Ae,{className:"bg-blue-500/10 border-blue-500/30 cursor-pointer",onClick:()=>e("withdrawals"),children:s.jsx(Ie,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ml,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-blue-300 text-xs font-medium",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[a.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/50 text-[10px]",children:["共 ¥",a.pendingWithdrawAmount.toFixed(2)," →"]})]})]})})})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{className:"p-4",children:[s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-gray-400 text-xs",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"点击量"}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.monthClicks}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.totalClicks.toLocaleString()})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"绑定数"}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.monthBindings}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.totalBindings.toLocaleString()})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"转化数"}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.monthConversions}),s.jsx("td",{className:"py-2.5 text-right font-medium",children:a.totalConversions})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"佣金"}),s.jsxs("td",{className:"py-2.5 text-right font-medium text-[#38bdac]",children:["¥",a.monthEarnings.toFixed(2)]}),s.jsxs("td",{className:"py-2.5 text-right font-medium text-[#38bdac]",children:["¥",a.totalEarnings.toFixed(2)]})]}),s.jsxs("tr",{children:[s.jsx("td",{className:"py-2.5 text-gray-300",children:"转化率"}),s.jsx("td",{className:"py-2.5 text-right",children:"—"}),s.jsxs("td",{className:"py-2.5 text-right font-medium text-[#38bdac]",children:[a.conversionRate,"%"]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-6 mt-4 pt-3 border-t border-gray-700/30 text-xs",children:[s.jsxs("span",{className:"text-gray-400",children:["推广用户 ",s.jsx("span",{className:"text-white font-medium ml-1",children:a.totalDistributors})]}),s.jsxs("span",{className:"text-gray-400",children:["有收益 ",s.jsx("span",{className:"text-green-400 font-medium ml-1",children:a.activeDistributors})]}),s.jsxs("span",{className:"text-gray-400",children:["佣金比例 ",s.jsx("span",{className:"text-[#38bdac] font-medium ml-1",children:"90%"})]}),s.jsxs("span",{className:"text-gray-400",children:["绑定有效期 ",s.jsx("span",{className:"text-orange-400 font-medium ml-1",children:"30天"})]})]})]})})]}),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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:v,onChange:G=>k(G.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:E,onChange:G=>C(G.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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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:Rn.map(G=>{var We,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:[(We=G.id)==null?void 0:We.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:G.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:G.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const yt=G.productType||G.type,ct=G.description||"",tt=String(G.productId||G.sectionId||""),gt=yt==="vip"||ct.includes("VIP")||ct.toLowerCase().includes("vip")||tt.toLowerCase().includes("vip");return yt==="balance_recharge"?`余额充值 ¥${typeof G.amount=="number"?G.amount.toFixed(2):parseFloat(String(G.amount||"0")).toFixed(2)}`:gt?"超级个体开通费用":yt==="fullbook"?`${G.bookName||"《底层逻辑》"} - 全本`:yt==="match"?"匹配次数购买":`${G.bookName||"《底层逻辑》"} - ${G.sectionTitle||G.chapterTitle||`章节${G.productId||G.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const yt=G.productType||G.type,ct=G.description||"",tt=String(G.productId||G.sectionId||""),gt=yt==="vip"||ct.includes("VIP")||ct.toLowerCase().includes("vip")||tt.toLowerCase().includes("vip");return yt==="balance_recharge"?"余额充值":gt?"超级个体":yt==="fullbook"?"全书解锁":yt==="match"?"功能权益":G.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof G.amount=="number"?G.amount.toFixed(2):parseFloat(String(G.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="balance"?"余额支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:G.status==="refunded"?s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):G.status==="completed"||G.status==="paid"?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):G.status==="pending"||G.status==="created"?s.jsx(Ke,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ke,{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:G.refundReason,children:G.status==="refunded"&&G.refundReason?G.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:G.referrerId||G.referralCode?s.jsxs("span",{title:G.referralCode||G.referrerCode||G.referrerId||"",children:[G.referrerNickname||G.referralCode||G.referrerCode||((qe=G.referrerId)==null?void 0:qe.slice(0,8)),(G.referralCode||G.referrerCode)&&` (${G.referralCode||G.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:G.referrerEarnings?`¥${(typeof G.referrerEarnings=="number"?G.referrerEarnings:parseFloat(String(G.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:G.createdAt?new Date(G.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(G.status==="paid"||G.status==="completed")&&s.jsxs(ee,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{he(G),z("")},children:[s.jsx(sj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},G.id)})})]})}),t==="orders"&&s.jsx(us,{page:T,totalPages:rn,total:R,pageSize:F,onPageChange:P,onPageSizeChange:G=>{D(G),P(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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:v,onChange:G=>k(G.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:E,onChange:G=>C(G.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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{className:"p-0",children:[xr.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:xr.map(G=>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:G.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:G.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:G.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:G.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:G.boundAt?new Date(G.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:G.expiresAt?new Date(G.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Jt(G.status)}),s.jsx("td",{className:"p-4",children:G.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",G.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},G.id))})]})}),t==="bindings"&&s.jsx(us,{page:T,totalPages:rn,total:R,pageSize:F,onPageChange:P,onPageSizeChange:G=>{D(G),P(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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:v,onChange:G=>k(G.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:E,onChange:G=>C(G.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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{className:"p-0",children:[Pn.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:Pn.map(G=>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:[G.userAvatar?s.jsx("img",{src:ps(G.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:(G.userName||G.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:G.userName||G.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",G.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ke,{className:G.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:G.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:G.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:G.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:G.createdAt?new Date(G.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Jt(G.status)}),s.jsx("td",{className:"p-4 text-right",children:G.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(ee,{size:"sm",onClick:()=>on(G.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Bv,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>bt(G.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Qw,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},G.id))})]})}),t==="withdrawals"&&s.jsx(us,{page:T,totalPages:rn,total:R,pageSize:F,onPageChange:P,onPageSizeChange:G=>{D(G),P(1)}})]})})]}),t==="giftPay"&&s.jsx("div",{className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(Ye,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(Qe,{className:"text-white",children:"代付请求列表"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:ye,onChange:G=>{Le(G.target.value),se(1)},children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"paid",children:"已支付"}),s.jsx("option",{value:"cancelled",children:"已取消"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>at("giftPay",!0),className:"border-gray-600 text-gray-300",children:[s.jsx(He,{className:"w-4 h-4 mr-1"}),"刷新"]})]})]})}),s.jsxs(Ie,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"请求号"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"发起人"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"商品/金额"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"代付人"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Y.map(G=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-4 font-mono text-xs text-gray-400",children:G.requestSn}),s.jsx("td",{className:"p-4",children:s.jsx("p",{className:"text-white text-sm",children:G.initiatorNick||G.initiatorUserId})}),s.jsxs("td",{className:"p-4",children:[s.jsxs("p",{className:"text-white",children:[G.productType," · ¥",G.amount.toFixed(2)]}),G.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:G.description})]}),s.jsx("td",{className:"p-4 text-gray-400",children:G.payerNick||(G.payerUserId?G.payerUserId:"-")}),s.jsx("td",{className:"p-4",children:s.jsx(Ke,{className:G.status==="paid"?"bg-green-500/20 text-green-400 border-0":G.status==="pending"?"bg-amber-500/20 text-amber-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:G.status==="paid"?"已支付":G.status==="pending"?"待支付":G.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:G.createdAt?new Date(G.createdAt).toLocaleString("zh-CN"):"-"})]},G.id))})]})}),Y.length===0&&!g&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),de>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(us,{page:W,totalPages:Math.ceil(de/20),total:de,pageSize:20,onPageChange:se,onPageSizeChange:()=>{}})})]})]})})]}),s.jsx(Rt,{open:!!ne,onOpenChange:G=>!G&&he(null),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Pt,{children:s.jsx(Ot,{className:"text-white",children:"订单退款"})}),ne&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ne.orderSn||ne.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ne.amount=="number"?ne.amount.toFixed(2):parseFloat(String(ne.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(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:xe,onChange:G=>z(G.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>he(null),disabled:U,children:"取消"}),s.jsx(ee,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:At,disabled:U,children:U?"退款中...":"确认退款"})]})]})}),s.jsx(Rt,{open:!!I,onOpenChange:G=>!G&&In(),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Pt,{children:s.jsx(Ot,{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(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:V,onChange:G=>L(G.target.value)})})]})]}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:In,disabled:K,children:"取消"}),s.jsx(ee,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:nn,disabled:K||!V.trim(),children:K?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx($k,{embedded:!0})})]})}function $P(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[N,j]=b.useState(0),[v,k]=b.useState(null),[E,C]=b.useState(null),[T,P]=b.useState(""),[F,D]=b.useState(!1);async function R(){var z,U,H,I,q,V,L;i(!0),c(null);try{const K=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),oe=await Oe(`/api/admin/withdrawals?${K}`);if(oe!=null&&oe.success){const Y=oe.withdrawals||[];e(Y),j(oe.total??((z=oe.stats)==null?void 0:z.total)??Y.length),r({total:((U=oe.stats)==null?void 0:U.total)??oe.total??Y.length,pendingCount:((H=oe.stats)==null?void 0:H.pendingCount)??0,pendingAmount:((I=oe.stats)==null?void 0:I.pendingAmount)??0,successCount:((q=oe.stats)==null?void 0:q.successCount)??0,successAmount:((V=oe.stats)==null?void 0:V.successAmount)??0,failedCount:((L=oe.stats)==null?void 0:L.failedCount)??0})}else c("加载提现记录失败")}catch(K){console.error("Load withdrawals error:",K),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{R()},[u,f,g]);const O=Math.ceil(N/g)||1;async function _(z){const U=t.find(H=>H.id===z);if(U!=null&&U.userCommissionInfo&&U.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${U.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 + +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(z);try{const H=await Dt("/api/admin/withdrawals",{id:z,action:"approve"});H!=null&&H.success?R():ae.error("操作失败: "+((H==null?void 0:H.error)??""))}catch{ae.error("操作失败")}finally{k(null)}}function re(z){C(z),P("")}async function ne(){const z=E;if(!z)return;const U=T.trim();if(!U){ae.error("请填写拒绝原因");return}D(!0);try{const H=await Dt("/api/admin/withdrawals",{id:z,action:"reject",errorMessage:U});H!=null&&H.success?(ae.success("已拒绝该提现申请"),C(null),P(""),R()):ae.error("操作失败: "+((H==null?void 0:H.error)??""))}catch{ae.error("操作失败")}finally{D(!1)}}function he(){E&&ae.info("已取消操作"),C(null),P("")}function xe(z){switch(z){case"pending":return s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ke,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ke,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0",children:z})}}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(ee,{variant:"outline",onClick:R,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Ae,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ie,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(hh,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ie,{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(z=>s.jsx(ee,{variant:u===z?"default":"outline",size:"sm",onClick:()=>h(z),className:u===z?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:z==="all"?"全部":z==="pending"?"待处理":z==="success"?"已完成":"已拒绝"},z))}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{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(Ml,{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(z=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(z.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[z.userAvatar?s.jsx("img",{src:ps(z.userAvatar),alt:z.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:(z.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:z.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:z.userPhone??z.referralCode??(z.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(z.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:z.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:["¥",z.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:["¥",z.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:["¥",z.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:z.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",z.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[xe(z.status),z.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:z.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:z.processedAt?new Date(z.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:z.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:z.userConfirmedAt,children:["已确认 ",new Date(z.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(z.status==="pending"||z.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(ee,{size:"sm",onClick:()=>_(z.id),disabled:v===z.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(mf,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>re(z.id),disabled:v===z.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Zn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(z.status==="success"||z.status==="completed")&&z.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:z.transactionId})]})]},z.id))})]})}),s.jsx(us,{page:f,totalPages:O,total:N,pageSize:g,onPageChange:m,onPageSizeChange:z=>{y(z),m(1)}})]})})}),s.jsx(Rt,{open:!!E,onOpenChange:z=>!z&&he(),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Pt,{children:s.jsx(Ot,{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(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:T,onChange:z=>P(z.target.value)})})]})]}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:he,disabled:F,children:"取消"}),s.jsx(ee,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ne,disabled:F||!T.trim(),children:F?"提交中...":"确认拒绝"})]})]})})]})}var Vm={exports:{}},Hm={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var h1;function FP(){if(h1)return Hm;h1=1;var t=yd();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,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),N=r({inst:{value:y,getSnapshot:g}}),j=N[0].inst,v=N[1];return i(function(){j.value=y,j.getSnapshot=g,u(j)&&v({inst:j})},[m,y,g]),a(function(){return u(j)&&v({inst:j}),m(function(){u(j)&&v({inst:j})})},[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 Hm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Hm}var f1;function Fk(){return f1||(f1=1,Vm.exports=FP()),Vm.exports}var Bk=Fk();function Jn(t){this.content=t}Jn.prototype={constructor:Jn,find:function(t){for(var e=0;e>1}};Jn.from=function(t){if(t instanceof Jn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Jn(e)};function Vk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let o=0;a.text[o]==i.text[o];o++)n++;return n}if(a.content.size||i.content.size){let o=Vk(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function Hk(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),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,a+c,i||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,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",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?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=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),a+=c.nodeSize),o=u}return new ve(r,a)}cutByIndex(e,n){return e==n?ve.empty:e==0&&n==this.content.length?this:new ve(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new ve(a,i)}addToStart(e){return new ve([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ve(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 a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?zu(n+1,i):zu(n,r);r=i}}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 ve.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ve(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ve.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};zt.none=[];class bh extends Error{}class Re{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=Uk(this.content,e+this.openStart,n);return r&&new Re(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Re(Wk(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 Re.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Re(ve.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new Re(e,r,a)}}Re.empty=new Re(ve.empty,0,0);function Wk(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(a==e||i.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,i.copy(Wk(i.content,e-a-1,n-a-1)))}function Uk(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),o=t.maybeChild(a);if(i==e||o.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Uk(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function BP(t,e,n){if(n.openStart>t.depth)throw new bh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new bh("Inconsistent open depths");return Kk(t,e,n,0)}function Kk(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Wc(t,e,n,r){let a=(e||t).node(n),i=0,o=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(xo(t.nodeAfter,r),i++));for(let c=i;ca&&qg(t,e,a+1),o=r.depth>a&&qg(n,r,a+1),c=[];return Wc(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(qk(i,o),xo(yo(i,Gk(t,e,n,r,a+1)),c)):(i&&xo(yo(i,vh(t,e,a+1)),c),Wc(e,n,a,c),o&&xo(yo(o,vh(n,r,a+1)),c)),Wc(r,null,a,c),new ve(c)}function vh(t,e,n){let r=[];if(Wc(null,t,n,r),t.depth>n){let a=qg(t,e,n+1);xo(yo(a,vh(t,e,n+1)),r)}return Wc(e,null,n,r),new ve(r)}function VP(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(ve.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class ad{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],a=e.child(n);return r?e.child(n).cut(r):a}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],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;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 Nh(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=[],a=0,i=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(i),h=i-u;if(r.push(o,c,a+u),!h||(o=o.child(c),o.isText))break;i=h-1,a+=u+1}return new ad(n,r,i)}static resolveCached(e,n){let r=p1.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}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()+")"),Jk(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=ve.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;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 a=ve.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};Ma.prototype.text=void 0;class wh extends Ma{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Jk(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 wh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new wh(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 Jk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class So{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new KP(e,n);if(r.next==null)return So.empty;let a=Yk(r);r.next&&r.err("Unexpected trailing text");let i=ZP(XP(a));return eO(i,r),i}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 a=0;a{let i=a+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return i}).join(` +`)}}So.empty=new So(!0);class KP{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 Yk(t){let e=[];do e.push(qP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function qP(t){let e=[];do e.push(GP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function GP(t){let e=QP(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=JP(t,e);else break;return e}function m1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function JP(t,e){let n=m1(t),r=n;return t.eat(",")&&(t.next!="}"?r=m1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function YP(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let i in n){let o=n[i];o.isInGroup(e)&&a.push(o)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function QP(t){if(t.eat("(")){let e=Yk(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=YP(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 XP(t){let e=[[]];return a(i(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 a(o,c){o.forEach(u=>u.to=c)}function i(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(i(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=i(o.exprs[u],c);if(u==o.exprs.length-1)return h;a(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),a(i(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return a(i(o.expr,c),u),a(i(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(i(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||a.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let i=e[r.join(",")]=new So(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:Zk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ma(this,this.computeAttrs(e),ve.from(n),zt.setFrom(r))}createChecked(e=null,n,r){return n=ve.from(n),this.checkContent(n),new Ma(this,this.computeAttrs(e),n,zt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ve.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(ve.empty,!0);return i?new Ma(this,e,n.append(i),zt.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[i]=new nS(i,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function tO(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class nO{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?tO(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class kf{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=tS(e,a.attrs),this.excluded=null;let i=Xk(this.attrs);this.instance=i?new zt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new zt(this,Zk(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new kf(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class rS{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=Jn.from(e.nodes),n.marks=Jn.from(e.marks||{}),this.nodes=x1.compile(this.spec.nodes,this),this.marks=kf.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let i=this.nodes[a],o=i.spec.content||"",c=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=So.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=c=="_"?null:c?y1(this,c.split(" ")):c==""||!i.inlineContent?[]:null}for(let a in this.marks){let i=this.marks[a],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:y1(this,o.split(" "))}this.nodeFromJSON=a=>Ma.fromJSON(this,a),this.markFromJSON=a=>zt.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof x1){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,a)}text(e,n){let r=this.nodes.text;return new wh(r,r.defaultAttrs,e,zt.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 y1(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 rO(t){return t.tag!=null}function sO(t){return t.style!=null}class gi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(rO(a))this.tags.push(a);else if(sO(a)){let i=/[^=]*/.exec(a.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let i=e.nodes[a.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new v1(this,n,!1);return r.addAll(e,zt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new v1(this,n,!0);return r.addAll(e,zt.none,n.from,n.to),Re.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;ae.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(a){let i=a.priority==null?50:a.priority,o=0;for(;o{r(o=N1(o)),o.mark||o.ignore||o.clearMark||(o.mark=a)})}for(let a in e.nodes){let i=e.nodes[a].spec.parseDOM;i&&i.forEach(o=>{r(o=N1(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new gi(e,gi.schemaRules(e)))}}const sS={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},aO={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},aS={ol:!0,ul:!0},id=1,Jg=2,Uc=4;function b1(t,e,n){return e!=null?(e?id:0)|(e==="full"?Jg:0):t&&t.whitespace=="pre"?id|Jg:n&~Uc}class $u{constructor(e,n,r,a,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=zt.none,this.match=i||(o&Uc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ve.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&id)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=ve.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ve.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&&!sS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class v1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,o=b1(null,n.preserveWhitespace,0)|(r?Uc:0);a?i=new $u(a.type,a.attrs,zt.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new $u(null,null,zt.none,!0,null,o):i=new $u(e.schema.topNodeType,null,zt.none,!0,null,o),this.nodes=[i],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,a=this.top,i=a.options&Jg?"full":this.localPreserveWS||(a.options&id)>0,{schema:o}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="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,a){let i,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&&(i=!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(a)this.addElement(e,r,a);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)}i&&this.sync(c)&&this.open--}addAll(e,n,r,a){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=a==null?null:e.childNodes[a];o!=c;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let a,i;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!a||a.length>h.length+c)&&(a=h,i=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!a)return null;this.sync(i);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):w1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new $u(e,n,u,a,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|=id)}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 a=r.length-1;a>=0;a--)e+=r[a].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,a=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(a?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>=i;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&a?this.nodes[u].type:r&&u>=i?r.node(u-i).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 iO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&aS.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function oO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function N1(t){let e={};for(let n in t)e[n]=t[n];return e}function w1(t,e){let n=e.schema.nodes;for(let r in n){let a=n[r];if(!a.allowsMarkType(t))continue;let i=[],o=c=>{i.push(c);for(let u=0;u{if(i.length||o.marks.length){let c=0,u=0;for(;c=0;a--){let i=this.serializeMark(e.marks[a],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let a=this.marks[e.type.name];return a&&rh(Um(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return rh(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Do(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=j1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return j1(e.marks)}}function j1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Um(t){return t.document||window.document}const k1=new WeakMap;function lO(t){let e=k1.get(t);return e===void 0&&k1.set(t,e=cO(t)),e}function cO(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 a=0;a-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=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),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:N}=rh(t,g,n,r);if(u.appendChild(y),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const iS=65535,oS=Math.pow(2,16);function dO(t,e){return t+e*oS}function S1(t){return t&iS}function uO(t){return(t-(t&iS))/oS}const lS=1,cS=2,sh=4,dS=8;class Yg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&dS)>0}get deletedBefore(){return(this.delInfo&(lS|sh))>0}get deletedAfter(){return(this.delInfo&(cS|sh))>0}get deletedAcross(){return(this.delInfo&sh)>0}}class Vr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Vr.empty)return Vr.empty}recover(e){let n=0,r=S1(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+a+(g<0?0:f);if(r)return y;let N=e==(n<0?u:m)?null:dO(c/3,e-u),j=e==u?cS:e==m?lS:sh;return(n<0?e!=u:e!=m)&&(j|=dS),new Yg(y,j,N)}a+=f-h}return r?e+a:new Yg(e+a,0,null)}touches(e,n){let r=0,a=S1(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+i],f=u+h;if(e<=f&&c==a*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 a=0,i=0;a=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?r-a-1:void 0)}}invert(){let e=new od;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,i)}invert(){return new Es(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 ui(n.pos,r.pos,this.mark)}merge(e){return e instanceof ui&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ui(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 ui(n.from,n.to,e.markFromJSON(n.mark))}}gr.jsonID("addMark",ui);class Es extends gr{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 Re(o0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,r)}invert(){return new ui(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 Es(n.pos,r.pos,this.mark)}merge(e){return e instanceof Es&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Es(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 Es(n.from,n.to,e.markFromJSON(n.mark))}}gr.jsonID("removeMark",Es);class hi extends gr{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return jn.fromReplace(e,this.pos,this.pos+1,new Re(ve.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 a=0;ar.pos?null:new Hn(n.pos,r.pos,a,i,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 Hn(n.from,n.to,n.gapFrom,n.gapTo,Re.fromJSON(e,n.slice),n.insert,!!n.structure)}}gr.jsonID("replaceAround",Hn);function Qg(t,e,n){let r=t.resolve(e),a=n-e,i=r.depth;for(;a>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,a--;if(a>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;a>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,a--}}return!1}function hO(t,e,n,r){let a=[],i=[],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),N=r.addToSet(m);for(let j=0;jt.step(u)),i.forEach(u=>t.step(u))}function fO(t,e,n,r){let a=[],i=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;i++;let u=null;if(r instanceof kf){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 Es(o.from,o.to,o.style)))}function l0(t,e,n,r=n.contentMatch,a=!0){let i=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function pO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ul(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;N--)j||r.index(N)>0?(j=!0,f=ve.from(r.node(N).copy(f)),m++):u--;let g=ve.empty,y=0;for(let N=i,j=!1;N>n;N--)j||a.after(N+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=ve.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new Hn(a,i,a,i,new Re(r,0,0),n.length,!0))}function bO(t,e,n,r,a){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof a=="function"?a(o):a;if(o.isTextblock&&!o.hasMarkup(r,u)&&vO(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",N=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!N?h=!1:!y&&N&&(h=!0)}h===!1&&hS(t,o,c,i),l0(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new Hn(m,g,m+1,g-1,new Re(ve.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&uS(t,o,c,i),!1}})}function uS(t,e,n,r){e.forEach((a,i)=>{if(a.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(a.text);){let u=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function hS(t,e,n,r){e.forEach((a,i)=>{if(a.type==a.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function vO(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function NO(t,e,n,r,a){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,a||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Hn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Re(ve.from(o),0,0),1,!0))}function Aa(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),g=a.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),N=r&&r[f+1];N&&(y=y.replaceChild(0,N.type.create(N.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(y))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function wO(t,e,n=1,r){let a=t.doc.resolve(e),i=ve.empty,o=ve.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=ve.from(a.node(c).copy(i));let f=r&&r[h];o=ve.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new Vn(e,e,new Re(i.append(o),n,n),!0))}function Ai(t,e){let n=t.resolve(e),r=n.index();return fS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function jO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let a=0;a0?(i=r.node(a+1),c++,o=r.node(a).maybeChild(c)):(i=r.node(a).maybeChild(c-1),o=r.node(a+1)),i&&!i.isTextblock&&fS(i,o)&&r.node(a).canReplace(c,c+1))return e;if(a==0)break;e=n<0?r.before(a):r.after(a)}}function kO(t,e,n){let r=null,{linebreakReplacement:a}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(a&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(a);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);hS(t,f.node(),f.before(),c)}o.inlineContent&&l0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new Vn(h,u.map(e+n,-1),Re.empty,!0)),r===!0){let f=t.doc.resolve(h);uS(t,f.node(),f.before(),t.steps.length)}return t}function SO(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 a=r.depth-1;a>=0;a--){let i=r.index(a);if(r.node(a).canReplaceWith(i,i,n))return r.before(a+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let a=r.depth-1;a>=0;a--){let i=r.indexAfter(a);if(r.node(a).canReplaceWith(i,i,n))return r.after(a+1);if(i=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(i==1)f=h.canReplace(u,u,a);else{let m=h.contentMatchAt(u).findWrapping(a.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 Cf(t,e,n=e,r=Re.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return mS(a,i,r)?new Vn(e,n,r):new CO(a,i,r).fit()}function mS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class CO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ve.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=ve.from(e.node(a).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,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new Re(i,o,c);return e>-1?new Hn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Vn(r.pos,a.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,a=this.unplaced.openEnd;r1&&(a=0),i.type.spec.isolating&&a<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let a,i=null;r?(i=qm(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.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(ve.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=qm(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Re(e,n+1,Math.max(r,a.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=qm(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new Re(Dc(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Re(Dc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let j=0;j1||u==0||j.content.size)&&(m=v,f.push(gS(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?y:-1)))}let N=h==c.childCount;N||(y=-1),this.placed=Lc(this.placed,n,ve.from(f)),this.frontier[n].match=m,N&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,v=c;j1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Gm(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:i?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=Lc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let a=e.node(r),i=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,i)}return e}openFrontierNode(e,n=null,r){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=Lc(this.placed,this.depth,ve.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ve.empty,!0);n.childCount&&(this.placed=Lc(this.placed,this.frontier.length,n))}}function Dc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Dc(t.firstChild.content,e-1,n)))}function Lc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Lc(t.lastChild.content,e-1,n)))}function qm(t,e){for(let n=0;n1&&(r=r.replaceChild(0,gS(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(ve.empty,!0)))),t.copy(r)}function Gm(t,e,n,r,a){let i=t.node(e),o=a?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let c=r.fillBefore(i.content,!0,o);return c&&!EO(n,i.content,o)?c:null}function EO(t,e,n){for(let r=n;r0;g--,y--){let N=a.node(g).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(g)>-1?c=g:a.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 N=g.firstChild;if(h.push(N),y==r.openStart)break;g=N.content}for(let g=f-1;g>=0;g--){let y=h[g],N=TO(y.type);if(N&&!y.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(N||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),N=h[y];if(N)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=a.before(y),n=i.after(y))}}function xS(t,e,n,r,a){if(er){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(ve.empty,!0))}return t}function AO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=SO(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Re(ve.from(r),0,0))}function IO(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=yS(r,a);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),a.indexAfter(c-1))))return t.delete(r.before(c),a.after(c))}for(let o=1;o<=r.depth&&o<=a.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&a.end(o)-n!=a.depth-o&&r.start(o-1)==a.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),a.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function yS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let a=r;a>=0;a--){let i=t.start(a);if(ie.pos+(e.depth-a)||t.node(a).type.spec.isolating||e.node(a).type.spec.isolating)break;(i==e.start(a)||a==t.depth&&a==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&a&&e.start(a-1)==i-1)&&n.push(a)}return n}class Sl extends gr{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 jn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return jn.fromReplace(e,this.pos,this.pos+1,new Re(ve.from(a),0,n.isLeaf?0:1))}getMap(){return Vr.empty}invert(e){return new Sl(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 Sl(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 Sl(n.pos,n.attr,n.value)}}gr.jsonID("attr",Sl);class ld extends gr{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jn.ok(r)}getMap(){return Vr.empty}invert(e){return new ld(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 ld(n.attr,n.value)}}gr.jsonID("docAttr",ld);let Al=class extends Error{};Al=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Al.prototype=Object.create(Error.prototype);Al.prototype.constructor=Al;Al.prototype.name="TransformError";class d0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new od}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Al(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=Re.empty){let a=Cf(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new Re(ve.from(r),0,0))}delete(e,n){return this.replace(e,n,Re.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return MO(this,e,n,r),this}replaceRangeWith(e,n,r){return AO(this,e,n,r),this}deleteRange(e,n){return IO(this,e,n),this}lift(e,n){return mO(this,e,n),this}join(e,n=1){return kO(this,e,n),this}wrap(e,n){return yO(this,e,n),this}setBlockType(e,n=e,r,a=null){return bO(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return NO(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new Sl(e,n,r)),this}setDocAttribute(e,n){return this.step(new ld(e,n)),this}addNodeMark(e,n){return this.step(new hi(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 zt)n.isInSet(r.marks)&&this.step(new Co(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Co(e,i)),a=i.removeFromSet(a);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return wO(this,e,n,r),this}addMark(e,n,r){return hO(this,e,n,r),this}removeMark(e,n,r){return fO(this,e,n,r),this}clearIncompatible(e,n,r){return l0(this,e,n,r),this}}const Jm=Object.create(null);class nt{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new bS(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;i--){let o=n<0?gl(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):gl(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ur(e.node(0))}static atStart(e){return gl(e,e,0,0,1)||new Ur(e)}static atEnd(e){return gl(e,e,e.content.size,e.childCount,-1)||new Ur(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Jm[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 Jm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Jm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Xe.between(this.$anchor,this.$head).getBookmark()}}nt.prototype.visible=!0;class bS{constructor(e,n){this.$from=e,this.$to=n}}let E1=!1;function T1(t){!E1&&!t.parent.inlineContent&&(E1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Xe extends nt{constructor(e,n=e){T1(e),T1(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 nt.near(r);let a=e.resolve(n.map(this.anchor));return new Xe(a.parent.inlineContent?a:r,r)}replace(e,n=Re.empty){if(super.replace(e,n),n==Re.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Xe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ef(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 Xe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=nt.findFrom(n,r,!0)||nt.findFrom(n,-r,!0);if(i)n=i.$head;else return nt.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(nt.findFrom(e,-r,!0)||nt.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&Ge.isSelectable(c))return Ge.create(t,n-(a<0?c.nodeSize:0))}else{let u=gl(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function M1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(nt.near(t.doc.resolve(o),n))}const A1=1,Fu=2,I1=4;class PO extends d0{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|=Fu,this}ensureMarks(e){return zt.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&Fu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fu,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)||zt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,a.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(nt.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|=I1,this}get scrolledIntoView(){return(this.updated&I1)>0}}function R1(t,e){return!e||!t?t:t.bind(e)}class _c{constructor(e,n,r){this.name=e,this.init=R1(n.init,r),this.apply=R1(n.apply,r)}}const OO=[new _c("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new _c("selection",{init(t,e){return t.selection||nt.atStart(e.doc)},apply(t){return t.selection}}),new _c("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new _c("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ym{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=OO.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 _c(r.key,r.spec.state,r))})}}class wl{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 a=e[r],i=a.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(a,this[a.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 a=new Ym(e.schema,e.plugins),i=new wl(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Ma.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=nt.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.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)){i[o.name]=h.fromJSON.call(u,e,n[c],i);return}}i[o.name]=o.init(e,i)}}),i}}function vS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=vS(a,e,{})),n[r]=a}return n}class Wt{constructor(e){this.spec=e,this.props={},e.props&&vS(e.props,this,this.props),this.key=e.key?e.key.key:NS("plugin")}getState(e){return e[this.key]}}const Qm=Object.create(null);function NS(t){return t in Qm?t+"$"+ ++Qm[t]:(Qm[t]=0,t+"$")}class tn{constructor(e="key"){this.key=NS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const h0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function wS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const jS=(t,e,n)=>{let r=wS(t,n);if(!r)return!1;let a=f0(r);if(!a){let o=r.blockRange(),c=o&&Ul(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(RS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(Il(i,"end")||Ge.isSelectable(i)))for(let o=r.depth;;o--){let c=Cf(t.doc,r.before(o),r.after(o),Re.empty);if(c&&c.slice.size1)break}return i.isAtom&&a.depth==r.depth-1?(e&&e(t.tr.delete(a.pos-i.nodeSize,a.pos).scrollIntoView()),!0):!1},DO=(t,e,n)=>{let r=wS(t,n);if(!r)return!1;let a=f0(r);return a?kS(t,a,e):!1},LO=(t,e,n)=>{let r=CS(t,n);if(!r)return!1;let a=p0(r);return a?kS(t,a,e):!1};function kS(t,e,n){let r=e.nodeBefore,a=r,i=e.pos-1;for(;!a.isTextblock;i--){if(a.type.spec.isolating)return!1;let f=a.lastChild;if(!f)return!1;a=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=Cf(t.doc,i,u,Re.empty);if(!h||h.from!=i||h instanceof Vn&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(Xe.create(f.doc,i)),n(f.scrollIntoView())}return!0}function Il(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 SS=(t,e,n)=>{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=f0(r)}let o=i&&i.nodeBefore;return!o||!Ge.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ge.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function f0(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 CS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=CS(t,n);if(!r)return!1;let a=p0(r);if(!a)return!1;let i=a.nodeAfter;if(RS(t,a,e,1))return!0;if(r.parent.content.size==0&&(Il(i,"start")||Ge.isSelectable(i))){let o=Cf(t.doc,r.before(),r.after(),Re.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)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 Ge,a;if(r){if(n.node.isTextblock||!Ai(t.doc,n.from))return!1;a=n.from}else if(a=Sf(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(Ge.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},zO=(t,e)=>{let n=t.selection,r;if(n instanceof Ge){if(n.node.isTextblock||!Ai(t.doc,n.to))return!1;r=n.to}else if(r=Sf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},$O=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&Ul(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},MS=(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 m0(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 a=n.node(-1),i=n.indexAfter(-1),o=m0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(nt.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},AS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Ur||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=m0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Aa(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Ul(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function BO(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof Ge&&e.selection.node.isBlock)return!r.parentOffset||!Aa(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],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=m0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),i.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof Xe||e.selection instanceof Ur)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Aa(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Aa(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),N=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const VO=BO(),HO=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(Ge.create(t.doc,a))),!0)};function WO(t,e,n){let r=e.nodeBefore,a=e.nodeAfter,i=e.index();return!r||!a||!r.type.compatibleContent(a.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(a.isTextblock||Ai(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function RS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&WO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let y=e.pos+i.nodeSize,N=ve.empty;for(let k=o.length-1;k>=0;k--)N=ve.from(o[k].create(null,N));N=ve.from(a.copy(N));let j=t.tr.step(new Hn(e.pos-1,y,e.pos,y,new Re(N,1,0),o.length,!0)),v=j.doc.resolve(y+2*o.length);v.nodeAfter&&v.nodeAfter.type==a.type&&Ai(j.doc,v.pos)&&j.join(v.pos),n(j.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:nt.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&Ul(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Il(i,"start",!0)&&Il(a,"end")){let y=a,N=[];for(;N.push(y),!y.isTextblock;)y=y.lastChild;let j=i,v=1;for(;!j.isTextblock;j=j.firstChild)v++;if(y.canReplace(y.childCount,y.childCount,j.content)){if(n){let k=ve.empty;for(let C=N.length-1;C>=0;C--)k=ve.from(N[C].copy(k));let E=t.tr.step(new Hn(e.pos-N.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new Re(k,N.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function PS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(Xe.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const UO=PS(-1),KO=PS(1);function qO(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&c0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function P1(t,e=null){return function(n,r){let a=!1;for(let i=0;i{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)a=!0;else{let f=n.doc.resolve(h),m=f.index();a=f.parent.canReplaceWith(m,m+1,t)}})}if(!a)return!1;if(r){let i=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);i=new Nh(u,u,e.depth),e.endIndex=0;f--)i=ve.from(n[f].type.create(n[f].attrs,i));t.step(new Hn(e.start-(r?2:0),e.end,e.start,e.end,new Re(i,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?XO(e,n,t,i):ZO(e,n,i):!0:!1}}function XO(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);ij;N--)y-=a.child(N).nodeSize,r.delete(y-1,y+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?ve.empty:ve.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new Hn(m-(c?1:0),g+(u?1:0),m+1,g-1,new Re((c?ve.empty:ve.from(a.copy(ve.empty))).append(u?ve.empty:ve.from(a.copy(ve.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function eD(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=ve.from(h?t.create():null),m=new Re(ve.from(t.create(null,ve.from(c.type.create(null,f)))),h?3:1,0),g=i.start,y=i.end;n(e.tr.step(new Hn(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Qn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Rl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Xg=null;const Sa=function(t,e,n){let r=Xg||(Xg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},tD=function(){Xg=null},Eo=function(t,e,n,r){return n&&(O1(t,e,n,r,-1)||O1(t,e,n,r,1))},nD=/^(img|br|input|textarea|hr)$/i;function O1(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:ds(t))){let o=t.parentNode;if(!o||o.nodeType!=1||kd(t)||nD.test(t.nodeName)||t.contentEditable=="false")return!1;e=Qn(t)+(a<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(a<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=a;else return!1;else t=o,e=a<0?ds(t):0}else return!1}}function ds(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function rD(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=ds(t)}else if(t.parentNode&&!kd(t))e=Qn(t),t=t.parentNode;else return null}}function sD(t,e){for(;;){if(t.nodeType==3&&e2),cs=Pl||(Gs?/Mac/.test(Gs.platform):!1),LS=Gs?/Win/.test(Gs.platform):!1,Ea=/Android \d/.test(Ii),Sd=!!D1&&"webkitFontSmoothing"in D1.documentElement.style,lD=Sd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cD(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 va(t,e){return typeof t=="number"?t:t[e]}function dD(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 L1(t,e,n){let r=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Rl(o);continue}let c=o,u=c==i.body,h=u?cD(i):dD(c),f=0,m=0;if(e.toph.bottom-va(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+va(a,"top")-h.top:e.bottom-h.bottom+va(a,"bottom")),e.lefth.right-va(r,"right")&&(f=e.right-h.right+va(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,N=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-y,v=c.scrollTop-N;e={left:e.left-j,top:e.top-v,right:e.right-j,bottom:e.bottom-v}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:Rl(o)}}function uD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,a;for(let i=(e.left+e.right)/2,o=n+1;o=n-20){r=c,a=u.top;break}}return{refDOM:r,refTop:a,stack:_S(t.dom)}}function _S(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Rl(r));return e}function hD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;zS(n,r==0?0:r-e)}function zS(t,e){for(let n=0;n=c){o=Math.max(N.bottom,o),c=Math.min(N.top,c);let j=N.left>e.left?N.left-e.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>e.top&&!u&&N.left<=e.left&&N.right>=e.left&&(u=f,h={left:Math.max(N.left,Math.min(N.right,e.left)),top:N.top});!n&&(e.left>=N.right&&e.top>=N.top||e.left>=N.left&&e.top>=N.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?pD(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:$S(n,a)}function pD(t,e){let n=t.nodeValue.length,r=document.createRange(),a;for(let i=0;i=(o.left+o.right)/2?1:0)};break}}return r.detach(),a||{node:t,offset:0}}function x0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function mD(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,a,i)}function xD(t,e,n,r){let a=-1;for(let i=e,o=!1;i!=t.dom;){let c=t.docView.nearestDesc(i,!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?a=c.posBefore:(!o&&u.right-1?a:t.docView.posFromDOM(e,n,-1)}function FS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Sd&&a&&r.nodeType==1&&(h=r.childNodes[a-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&a--,r==t.dom&&a==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(a==0||r.nodeType!=1||r.childNodes[a-1].nodeName!="BR")&&(c=xD(t,r,a,e))}c==null&&(c=gD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function _1(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Ac(ni(Sa(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==ds(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return Xm(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==ds(r))){let u=r.childNodes[a-1],h=u.nodeType==3?Sa(u,ds(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Ac(ni(h,1),!1)}if(i==null&&a=0)}function Ac(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 Xm(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 VS(t,e,n){let r=t.state,a=t.root.activeElement;r!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),a!=t.dom&&a&&a.focus()}}function vD(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return VS(t,e,()=>{let{node:i}=t.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(i,!0);if(!c)break;if(c.node.isBlock){i=c.contentDOM||c.dom;break}i=c.dom.parentNode}let o=BS(t,a.pos,1);for(let c=i.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Sa(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 ND=/[\u0590-\u08ac]/;function wD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let a=r.parentOffset,i=!a,o=a==r.parent.content.size,c=t.domSelection();return c?!ND.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:VS(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:N,focusOffset:j}=t.domSelectionRange(),v=N&&!y.contains(N.nodeType==1?N:N.parentNode)||u==N&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),v}):r.pos==r.start()||r.pos==r.end()}let z1=null,$1=null,F1=!1;function jD(t,e,n){return z1==e&&$1==n?F1:(z1=e,$1=n,F1=n=="up"||n=="down"?vD(t,e,n):wD(t,e,n))}const fs=0,B1=1,uo=2,Js=3;class Cd{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=fs,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;nQn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!1;break}if(i.previousSibling)break}if(a==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!0;break}if(i.nextSibling)break}}return a??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,a=e;a;a=a.parentNode){let i=this.getDesc(a),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}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 a=e;a;a=a.parentNode){let i=this.getDesc(a);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof WS){a=e-i;break}i=c}if(a)return this.children[r].domFromPos(a-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof HS&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Qn(i.dom)+1:0}}else{let i,o=!0;for(;i=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)){a=Qn(g.dom)+1;break}e-=g.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fN&&on){let N=c;c=u,u=N}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,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?uo:B1,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Js:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?uo:Js}r=o}this.dirty=uo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?uo:B1;n.dirty{if(!i)return a;if(i.parent)return i.parent.posBeforeChild(i)})),!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,i=this}matchesWidget(e){return this.dirty==fs&&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 kD extends Cd{constructor(e,n,r,a){super(e,[],n,null),this.textDOM=r,this.text=a}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 To extends Cd{constructor(e,n,r,a,i){super(e,[],r,a),this.mark=n,this.spec=i}static create(e,n,r,a){let i=a.nodeViews[n.type.name],o=i&&i(n,a,r);return(!o||!o.dom)&&(o=Do.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new To(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Js||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Js&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=fs){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=rx(i,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,a),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}=Do.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=qS(f,r,n),h?u=new SD(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new Mf(e,n,r,a,f,g,i):new yi(e,n,r,a,f,m||null,g,i,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=()=>ve.empty)}return e}matchesNode(e,n,r){return this.dirty==fs&&e.eq(this.node)&&jh(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,a=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,c=i&&i.pos<0,u=new ED(this,o&&o.node,e);AD(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?zt.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==uo)&&(o&&this.protectLocalComposition(e,o),US(this.contentDOM,this.children,e),Pl&&ID(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof Xe)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=RD(this.node.content,o,r-n,a-n);return c<0?null:{node:i,pos:c,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:a}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new kD(this,i,n,a);e.input.compositionNodes.push(o),this.children=rx(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Js||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=fs}updateOuterDeco(e){if(jh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=KS(this.dom,this.nodeDOM,nx(this.outerDeco,this.node,n),nx(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 V1(t,e,n,r,a){qS(r,e,t);let i=new yi(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class Mf extends yi{constructor(e,n,r,a,i,o,c){super(e,n,r,a,i,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,a){return this.dirty==Js||this.dirty!=fs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=fs||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=fs,!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 a=this.node.cut(e,n),i=document.createTextNode(a.text);return new Mf(this.parent,a,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Js)}get domAtom(){return!1}isText(e){return this.node.text==e}}class WS extends Cd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==fs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class SD extends yi{constructor(e,n,r,a,i,o,c,u,h,f){super(e,n,r,a,i,o,c,h,f),this.spec=u}update(e,n,r,a){if(this.dirty==Js)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,a),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,a){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,a)}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 US(t,e,n){let r=t.firstChild,a=!1;for(let i=0;i>1,c=Math.min(o,e.length);for(;i-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=To.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,a){let i=-1,o;if(a>=this.preMatch.index&&(o=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=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 To)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(a-1))break;--a,i.set(c,a),o.push(c)}}return{index:a,matched:i,matches:o.reverse()}}function MD(t,e){return t.type.side-e.type.side}function AD(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let N=i+g.nodeSize;if(g.isText){let v=N;o!v.inline):c.slice();r(g,j,e.forChild(i,g),y),i=N}}function ID(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 RD(t,e,n,r){for(let a=0,i=0;a=n){if(i>=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 rx(t,e,n,r,a){let i=[];for(let o=0,c=0;o=n||f<=e?i.push(u):(hn&&i.push(u.slice(n-h,u.size,r)))}return i}function y0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),i=a&&a.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(Tf(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&Ge.isSelectable(m)&&a.parent&&!(m.isInline&&aD(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new Ge(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!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!GS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function OD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Qn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Pr&&xi<=11&&(n.disabled=!0,n.disabled=!1)}function JS(t,e){if(e instanceof Ge){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(q1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else q1(t)}function q1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function b0(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||Xe.between(e,n,r)}function G1(t){return t.editable&&!t.hasFocus()?!1:YS(t)}function YS(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 DD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Eo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function sx(t,e){let{$anchor:n,$head:r}=t.selection,a=e>0?n.max(r):n.min(r),i=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return i&&nt.findFrom(i,e)}function ri(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function J1(t,e,n){let r=t.state.selection;if(r instanceof Xe)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return ri(t,new Xe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=sx(t.state,e);return a&&a instanceof Ge?ri(t,a):!1}else if(!(cs&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ge.isSelectable(i)?ri(t,new Ge(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Sd?ri(t,new Xe(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ge&&r.node.isInline)return ri(t,new Xe(e>0?r.$to:r.$from));{let a=sx(t.state,e);return a?ri(t,a):!1}}}function kh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ml(t,e){return e<0?LD(t):_D(t)}function LD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(hs&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(qc(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(QS(n))break;{let c=n.previousSibling;for(;c&&qc(c,-1);)a=n.parentNode,i=Qn(c),c=c.previousSibling;if(c)n=c,r=kh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?ax(t,n,r):a&&ax(t,a,i)}function _D(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=kh(n),i,o;for(;;)if(r{t.state==a&&Ia(t)},50)}function Y1(t,e){let n=t.state.doc.resolve(e);if(!(er||LS)&&n.parent.inlineContent){let a=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>a.top&&o1)return i.lefta.top&&o1)return i.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Q1(t,e,n){let r=t.state.selection;if(r instanceof Xe&&!r.empty||n.indexOf("s")>-1||cs&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=sx(t.state,e);if(o&&o instanceof Ge)return ri(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Ur?nt.near(o,e):nt.findFrom(o,e);return c?ri(t,c):!1}return!1}function X1(t,e){if(!(t.state.selection instanceof Xe))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Z1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function FD(t){if(!pr||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;Z1(t,r,"true"),setTimeout(()=>Z1(t,r,"false"),20)}return!1}function BD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function VD(t,e){let n=e.keyCode,r=BD(e);if(n==8||cs&&n==72&&r=="c")return X1(t,-1)||ml(t,-1);if(n==46&&!e.shiftKey||cs&&n==68&&r=="c")return X1(t,1)||ml(t,1);if(n==13||n==27)return!0;if(n==37||cs&&n==66&&r=="c"){let a=n==37?Y1(t,t.state.selection.from)=="ltr"?-1:1:-1;return J1(t,a,r)||ml(t,a)}else if(n==39||cs&&n==70&&r=="c"){let a=n==39?Y1(t,t.state.selection.from)=="ltr"?1:-1:1;return J1(t,a,r)||ml(t,a)}else{if(n==38||cs&&n==80&&r=="c")return Q1(t,-1,r)||ml(t,-1);if(n==40||cs&&n==78&&r=="c")return FD(t)||Q1(t,1,r)||ml(t,1);if(r==(cs?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function v0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:a,openEnd:i}=e;for(;a>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,i--;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")||Do.fromSchema(t.state.schema),c=r2(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=n2[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let N=c.createElement(f[y]);for(;u.firstChild;)N.appendChild(u.firstChild);u.appendChild(N),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` + +`);return{dom:u,text:g,slice:e}}function XS(t,e,n,r,a){let i=a.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,i||r,t)}),i)return c=new Re(ve.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,r,t));if(m)c=m;else{let g=a.marks(),{schema:y}=t.state,N=Do.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let v=o.appendChild(document.createElement("p"));j&&v.appendChild(N.serializeNode(y.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=KD(n),Sd&&qD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||gi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!HD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=GD(eN(c,+f[1],+f[2]),f[4]);else if(c=Re.maxOpen(WD(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const HD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function WD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(c=>{if(!o)return;let u=a.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&i.length&&e2(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=t2(o[o.length-1],i.length));let f=ZS(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return ve.from(o)}return t}function ZS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ve.from(t));return t}function e2(t,e,n,r,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(ve.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function eN(t,e,n){return en})),eg.createHTML(t)):t}function KD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=r2().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&n2[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=UD(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=ve.from(u.create(r[c+1],a)),i++,o++}return new Re(a,i,o)}const jr={},kr={},JD={touchstart:!0,touchmove:!0};class YD{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function QD(t){for(let e in jr){let n=jr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{ZD(t,r)&&!N0(t,r)&&(t.editable||!(r.type in kr))&&n(t,r)},JD[e]?{passive:!0}:void 0)}pr&&t.dom.addEventListener("input",()=>null),ox(t)}function fi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function XD(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ox(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>N0(t,r))})}function N0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function ZD(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function eL(t,e){!N0(t,e)&&jr[e.type]&&(t.editable||!(e.type in kr))&&jr[e.type](t,e)}kr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!a2(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ea&&er&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Pl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",a=>a(t,ao(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||VD(t,n)?n.preventDefault():fi(t,"key")};kr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};kr.keypress=(t,e)=>{let n=e;if(a2(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||cs&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Xe)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Af(t){return{left:t.clientX,top:t.clientY}}function tL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function w0(t,e,n,r,a){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,c=>o>i.depth?c(t,n,i.nodeAfter,i.before(o),a,!0):c(t,n,i.node(o),i.before(o),a,!1)))return!0;return!1}function Cl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function nL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ge.isSelectable(r)?(Cl(t,new Ge(n)),!0):!1}function rL(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof Ge&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(Ge.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(Cl(t,Ge.create(t.state.doc,a)),!0):!1}function sL(t,e,n,r,a){return w0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?rL(t,n):nL(t,n))}function aL(t,e,n,r){return w0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function iL(t,e,n,r){return w0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||oL(t,n,r)}function oL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Cl(t,Xe.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)Cl(t,Xe.create(r,c+1,c+1+o.content.size));else if(Ge.isSelectable(o))Cl(t,Ge.create(r,c));else continue;return!0}}function j0(t){return Sh(t)}const s2=cs?"metaKey":"ctrlKey";jr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=j0(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&tL(n,t.input.lastClick)&&!n[s2]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Af(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new lL(t,o,n,!!r)):(i=="doubleClick"?aL:iL)(t,o.pos,o.inside,n)?n.preventDefault():fi(t,"pointer"))};class lL{constructor(e,n,r,a){this.view=e,this.pos=n,this.event=r,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[s2],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof Ge&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&hs&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),fi(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ia(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Af(e))),this.updateAllowDefault(e),this.allowDefault||!n?fi(this.view,"pointer"):sL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pr&&this.mightDrag&&!this.mightDrag.node.isAtom||er&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Cl(this.view,nt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):fi(this.view,"pointer")}move(e){this.updateAllowDefault(e),fi(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}jr.touchstart=t=>{t.input.lastTouch=Date.now(),j0(t),fi(t,"pointer")};jr.touchmove=t=>{t.input.lastTouch=Date.now(),fi(t,"pointer")};jr.contextmenu=t=>j0(t);function a2(t,e){return t.composing?!0:pr&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const cL=Ea?5e3:-1;kr.compositionstart=kr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Xe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||er&&LS&&dL(t)))t.markCursor=t.state.storedMarks||n.marks(),Sh(t,!0),t.markCursor=null;else if(Sh(t,!e.selection.empty),hs&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let a=r.focusNode,i=r.focusOffset;a&&a.nodeType==1&&i!=0;){let o=i<0?a.lastChild:a.childNodes[i-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else a=o,i=-1}}t.input.composing=!0}i2(t,cL)};function dL(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}kr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,i2(t,20))};function i2(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Sh(t),e))}function o2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=hL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function uL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=rD(e.focusNode,e.focusOffset),r=sD(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let a=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!a||!a.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function hL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Sh(t,e=!1){if(!(Ea&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),o2(t),e||t.docView&&t.docView.dirty){let n=y0(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function fL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),a=document.createRange();a.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const cd=Pr&&xi<15||Pl&&lD<604;jr.copy=kr.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=cd?null:n.clipboardData,o=r.content(),{dom:c,text:u}=v0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):fL(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function pL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function mL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?dd(t,r.value,null,a,e):dd(t,r.textContent,r.innerHTML,a,e)},50)}function dd(t,e,n,r,a){let i=XS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||Re.empty)))return!0;if(!i)return!1;let o=pL(i),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function l2(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}kr.paste=(t,e)=>{let n=e;if(t.composing&&!Ea)return;let r=cd?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&dd(t,l2(r),r.getData("text/html"),a,n)?n.preventDefault():mL(t,n)};class c2{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const gL=cs?"altKey":"ctrlKey";function d2(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[gL]}jr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let a=t.state.selection,i=a.empty?null:t.posAtCoords(Af(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof Ge?a.to-1:a.to))){if(r&&r.mightDrag)o=Ge.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Ge.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=v0(t,c);(!n.dataTransfer.files.length||!er||DS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(cd?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",cd||n.dataTransfer.setData("text/plain",h),t.dragging=new c2(f,d2(t,n),o)};jr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};kr.dragover=kr.dragenter=(t,e)=>e.preventDefault();kr.drop=(t,e)=>{try{xL(t,e,t.dragging)}finally{t.dragging=null}};function xL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Af(e));if(!r)return;let a=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=XS(t,l2(e.dataTransfer),cd?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&d2(t,e));if(t.someProp("handleDrop",y=>y(t,e,i||Re.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?pS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&Ge.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new Ge(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((N,j,v,k)=>y=k),u.setSelection(b0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}jr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ia(t)},20))};jr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};jr.beforeinput=(t,e)=>{if(er&&Ea&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,ao(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in kr)jr[t]=kr[t];function ud(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ch{constructor(e,n){this.toDOM=e,this.spec=n||bo,this.side=this.spec.side||0}map(e,n,r,a){let{pos:i,deleted:o}=e.mapResult(n.from+a,this.side<0?-1:1);return o?null:new An(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ch&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ud(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class bi{constructor(e,n){this.attrs=e,this.spec=n||bo}map(e,n,r,a){let i=e.map(n.from+a,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+a,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new An(i,o,this)}valid(e,n){return n.from=e&&(!i||i(c.spec))&&r.push(c.copy(c.from+a,c.to+a))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,a+c,i)}}map(e,n,r){return this==lr||e.maps.length==0?this:this.mapInner(e,n,0,0,r||bo)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=h2(n,c,h)){for(a||(a=this.children.slice());ic&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let i=e+1,o=i+n.content.size;for(let c=0;ci&&u.type instanceof bi){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,bo));return ii.from(r)}forChild(e,n){if(n.isLeaf)return _t.empty;let r=[];for(let a=0;an instanceof _t)?e:e.reduce((n,r)=>n.concat(r instanceof _t?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let v=j-N-(y-g);for(let k=0;kE+f-m)continue;let C=c[k]+f-m;y>=C?c[k+1]=g<=C?-2:-1:g>=f&&v&&(c[k]+=v,c[k+1]+=v)}m+=v}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),y=g-a,{index:N,offset:j}=r.content.findIndex(m),v=r.maybeChild(N);if(v&&j==m&&j+v.nodeSize==y){let k=c[h+2].mapInner(n,v,f+1,t[h]+i+1,o);k!=lr?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=bL(c,t,e,n,a,i,o),f=Eh(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=h2(t,c,u+n);if(h){i=!0;let f=Eh(h,c,n+u+1,r);f!=lr&&a.push(u,u+c.nodeSize,f)}});let o=u2(i?f2(t):t,-n).sort(vo);for(let c=0;c0;)e++;t.splice(e,0,n)}function tg(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=lr&&e.push(r)}),t.cursorWrapper&&e.push(_t.create(t.state.doc,[t.cursorWrapper.deco])),ii.from(e)}const vL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},NL=Pr&&xi<=11;class wL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class jL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new wL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():pr&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),NL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,vL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(G1(this.view)){if(this.suppressingSelectionUpdates)return Ia(this.view);if(Pr&&xi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Eo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Rl(i))n.add(i);for(let i=e.anchorNode;i;i=Rl(i))if(n.has(i)){r=i;break}let a=r&&this.view.docView.nearestDesc(r);if(a&&a.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&G1(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(hs&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||CL(e,m)!=y)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),kL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,EL(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ia(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;v--){let k=r.childNodes[v-1],E=k.pmViewDesc;if(k.nodeName=="BR"&&!E){i=v;break}if(!E||E.size)break}let m=t.state.doc,g=t.someProp("domParser")||gi.fromSchema(t.state.schema),y=m.resolve(o),N=null,j=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:a,to:i,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:ML,context:y});if(h&&h[0].pos!=null){let v=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=v),N={anchor:v+o,head:k+o}}return{doc:j,sel:N,from:o,to:c}}function ML(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(pr&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||pr&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const AL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function IL(t,e,n,r,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,R=y0(t,D);if(R&&!t.state.selection.eq(R)){if(er&&Ea&&t.input.lastKeyCode===13&&Date.now()-100_(t,ao(13,"Enter"))))return;let O=t.state.tr.setSelection(R);D=="pointer"?O.setMeta("pointer",!0):D=="key"&&O.scrollIntoView(),i&&O.setMeta("composition",i),t.dispatch(O)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=TL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Ea)&&a.some(D=>D.nodeType==1&&!AL.test(D.nodeName))&&(!N||N.endA>=N.endB)&&t.someProp("handleKeyDown",D=>D(t,ao(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!N)if(r&&u instanceof Xe&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))N={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let D=iN(t,t.state.doc,h.sel);if(D&&!D.eq(t.state.selection)){let R=t.state.tr.setSelection(D);i&&R.setMeta("composition",i),t.dispatch(R)}}return}t.state.selection.fromt.state.selection.from&&N.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?N.start=t.state.selection.from:N.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(N.endB+=t.state.selection.to-N.endA,N.endA=t.state.selection.to)),Pr&&xi<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>h.from&&h.doc.textBetween(N.start-h.from-1,N.start-h.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let j=h.doc.resolveNoCache(N.start-h.from),v=h.doc.resolveNoCache(N.endB-h.from),k=f.resolve(N.start),E=j.sameParent(v)&&j.parent.inlineContent&&k.end()>=N.endA;if((Pl&&t.input.lastIOSEnter>Date.now()-225&&(!E||a.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!E&&j.posD(t,ao(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>N.start&&PL(f,N.start,N.endA,j,v)&&t.someProp("handleKeyDown",D=>D(t,ao(8,"Backspace")))){Ea&&er&&t.domObserver.suppressSelectionUpdates();return}er&&N.endB==N.start&&(t.input.lastChromeDelete=Date.now()),Ea&&!E&&j.start()!=v.start()&&v.parentOffset==0&&j.depth==v.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==N.endA&&(N.endB-=2,v=h.doc.resolveNoCache(N.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,ao(13,"Enter"))})},20));let C=N.start,T=N.endA,P=D=>{let R=D||t.state.tr.replace(C,T,h.doc.slice(N.start-h.from,N.endB-h.from));if(h.sel){let O=iN(t,R.doc,h.sel);O&&!(er&&t.composing&&O.empty&&(N.start!=N.endB||t.input.lastChromeDeleteIa(t),20));let D=P(t.state.tr.delete(C,T)),R=f.resolve(N.start).marksAcross(f.resolve(N.endA));R&&D.ensureMarks(R),t.dispatch(D)}else if(N.endA==N.endB&&(F=RL(j.parent.content.cut(j.parentOffset,v.parentOffset),k.parent.content.cut(k.parentOffset,N.endA-k.start())))){let D=P(t.state.tr);F.type=="add"?D.addMark(C,T,F.mark):D.removeMark(C,T,F.mark),t.dispatch(D)}else if(j.parent.child(j.index()).isText&&j.index()==v.index()-(v.textOffset?0:1)){let D=j.parent.textBetween(j.parentOffset,v.parentOffset),R=()=>P(t.state.tr.insertText(D,C,T));t.someProp("handleTextInput",O=>O(t,C,T,D,R))||t.dispatch(R())}else t.dispatch(P());else t.dispatch(P())}function iN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:b0(t,e.resolve(n.anchor),e.resolve(n.head))}function RL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,a=n,i=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(a.length==0&&i.length==1)c=i[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||ng(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,a++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,a++}return a}function OL(t,e,n,r,a){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let u=Math.max(0,i-Math.min(o,c));r-=o+u-i}if(o=o?i-r:0;i-=u,i&&i=c?i-r:0;i-=u,i&&i=56320&&e<=57343&&n>=55296&&n<=56319}class p2{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new YD,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(hN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=dN(this),cN(this),this.nodeViews=uN(this),this.docView=V1(this.state.doc,lN(this),tg(this),this.dom,this),this.domObserver=new jL(this,(r,a,i,o)=>IL(this,r,a,i,o)),this.domObserver.start(),QD(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ox(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(hN),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let a=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(o2(this),o=!0),this.state=e;let c=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=uN(this);LL(y,this.nodeViews)&&(this.nodeViews=y,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&ox(this),this.editable=dN(this),cN(this);let u=tg(this),h=lN(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&uD(this);if(o){this.domObserver.stop();let y=m&&(Pr||er)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&DL(a.selection,e.selection);if(m){let N=er?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=uL(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=V1(e.doc,h,u,this.dom,this)),N&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&DD(this))?Ia(this,y):(JS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&hD(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ge){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&L1(this,n.getBoundingClientRect(),e)}else L1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(i))==r.node&&(a=i)}this.dragging=new c2(e.slice,e.move,a<0?void 0:Ge.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return yD(this,e)}coordsAtPos(e,n=1){return BS(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let a=this.docView.posFromDOM(e,n,r);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,n){return jD(this,n||this.state,e)}pasteHTML(e,n){return dd(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return dd(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return v0(this,e)}destroy(){this.docView&&(XD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],tg(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,tD())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return eL(this,e)}domSelectionRange(){let e=this.domSelection();return e?pr&&this.root.nodeType===11&&iD(this.dom.ownerDocument)==this.dom&&SL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}p2.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function lN(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[An.node(0,t.state.doc.content.size,e)]}function cN(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:An.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function dN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function DL(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function uN(t){let e=Object.create(null);function n(r){for(let a in r)Object.prototype.hasOwnProperty.call(e,a)||(e[a]=r[a])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function LL(t,e){let n=0,r=0;for(let a in t){if(t[a]!=e[a])return!0;n++}for(let a in e)r++;return n!=r}function hN(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var wi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Th={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_L=typeof navigator<"u"&&/Mac/.test(navigator.platform),zL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Xn=0;Xn<10;Xn++)wi[48+Xn]=wi[96+Xn]=String(Xn);for(var Xn=1;Xn<=24;Xn++)wi[Xn+111]="F"+Xn;for(var Xn=65;Xn<=90;Xn++)wi[Xn]=String.fromCharCode(Xn+32),Th[Xn]=String.fromCharCode(Xn);for(var rg in wi)Th.hasOwnProperty(rg)||(Th[rg]=wi[rg]);function $L(t){var e=_L&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||zL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Th:wi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const FL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),BL=typeof navigator<"u"&&/Win/.test(navigator.platform);function VL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,a,i,o;for(let c=0;c{for(var n in e)UL(t,n,{get:e[n],enumerable:!0})};function If(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:a}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return a},get tr(){return r=n.selection,a=n.doc,i=n.storedMarks,n}}}var Rf=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...N)=>{const j=this.buildProps(u,e),v=g(...N)(j);return o.push(v),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,i=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:If({state:a,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},m2={};E0(m2,{blur:()=>KL,clearContent:()=>qL,clearNodes:()=>GL,command:()=>JL,createParagraphNear:()=>YL,cut:()=>QL,deleteCurrentNode:()=>XL,deleteNode:()=>ZL,deleteRange:()=>e8,deleteSelection:()=>t8,enter:()=>n8,exitCode:()=>r8,extendMarkRange:()=>s8,first:()=>a8,focus:()=>o8,forEach:()=>l8,insertContent:()=>c8,insertContentAt:()=>h8,joinBackward:()=>m8,joinDown:()=>p8,joinForward:()=>g8,joinItemBackward:()=>x8,joinItemForward:()=>y8,joinTextblockBackward:()=>b8,joinTextblockForward:()=>v8,joinUp:()=>f8,keyboardShortcut:()=>w8,lift:()=>j8,liftEmptyBlock:()=>k8,liftListItem:()=>S8,newlineInCode:()=>C8,resetAttributes:()=>E8,scrollIntoView:()=>T8,selectAll:()=>M8,selectNodeBackward:()=>A8,selectNodeForward:()=>I8,selectParentNode:()=>R8,selectTextblockEnd:()=>P8,selectTextblockStart:()=>O8,setContent:()=>D8,setMark:()=>t6,setMeta:()=>n6,setNode:()=>r6,setNodeSelection:()=>s6,setTextDirection:()=>a6,setTextSelection:()=>i6,sinkListItem:()=>o6,splitBlock:()=>l6,splitListItem:()=>c6,toggleList:()=>d6,toggleMark:()=>u6,toggleNode:()=>h6,toggleWrap:()=>f6,undoInputRule:()=>p6,unsetAllMarks:()=>m6,unsetMark:()=>g6,unsetTextDirection:()=>x6,updateAttributes:()=>y6,wrapIn:()=>b6,wrapInList:()=>v6});var KL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),qL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),GL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const N=Ul(y);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,j)}(N||N===0)&&e.lift(y,N)})}),!0},JL=t=>e=>t(e),YL=()=>({state:t,dispatch:e})=>AS(t,e),QL=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Xe(r.doc.resolve(Math.max(o-1,0)))),!0},XL=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===r.type){if(e){const c=a.before(i),u=a.after(i);t.delete(c,u).scrollIntoView()}return!0}return!1};function kn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var ZL=t=>({tr:e,state:n,dispatch:r})=>{const a=kn(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===a){if(r){const u=i.before(o),h=i.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},e8=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},t8=()=>({state:t,dispatch:e})=>h0(t,e),n8=()=>({commands:t})=>t.keyboardShortcut("Enter"),r8=()=>({state:t,dispatch:e})=>FO(t,e);function T0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Mh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:T0(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function g2(t,e,n={}){return t.find(r=>r.type===e&&Mh(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function fN(t,e,n={}){return!!g2(t,e,n)}function M0(t,e,n){var r;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(f=>f.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(f=>f.type===e)||(n=n||((r=a.node.marks[0])==null?void 0:r.attrs),!g2([...a.node.marks],e,n)))return;let o=a.index,c=t.start()+a.offset,u=o+1,h=c+a.node.nodeSize;for(;o>0&&fN([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:a})=>{const i=La(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=M0(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=Xe.create(o,m.from,m.to);n.setSelection(g)}}return!0},a8=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:a,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Ah()||pN())&&r.dom.focus(),i8()&&!Ah()&&!pN()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!x2(n.state.selection))return o(),!0;const c=y2(a.doc,t)||n.state.selection,u=n.state.selection.eq(c);return i&&(u||a.setSelection(c),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),o()),!0},l8=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),c8=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),b2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&b2(r)}return t};function Bu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return b2(n)}function hd(t,e,n){if(t instanceof Ma||t instanceof ve)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ve.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),hd("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new rS({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?gi.fromSchema(u).parseSlice(Bu(t),n.parseOptions):gi.fromSchema(u).parse(Bu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=gi.fromSchema(e);return n.slice?i.parseSlice(Bu(t),n.parseOptions).content:i.parse(Bu(t),n.parseOptions)}return hd("",e,n)}function d8(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(nt.near(t.doc.resolve(o),n))}var u8=t=>!("type"in t),h8=(t,e,n)=>({tr:r,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{hd(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(v){u(v)}try{c=hd(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((u8(c)?c:[c]).forEach(v=>{v.check(),g=g?v.isText&&v.marks.length===0:!1,y=y?v.isBlock:!1}),f===m&&y){const{parent:v}=r.doc.resolve(f);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(v=>v.text||"").join("");else if(e instanceof ve){let v="";e.forEach(k=>{k.text&&(v+=k.text)}),j=v}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const v=r.doc.resolve(f),k=v.node(),E=v.parentOffset===0,C=k.isText||k.isTextblock,T=k.content.size>0;E&&C&&T&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&d8(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},f8=()=>({state:t,dispatch:e})=>_O(t,e),p8=()=>({state:t,dispatch:e})=>zO(t,e),m8=()=>({state:t,dispatch:e})=>jS(t,e),g8=()=>({state:t,dispatch:e})=>ES(t,e),x8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Sf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},y8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Sf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},b8=()=>({state:t,dispatch:e})=>DO(t,e),v8=()=>({state:t,dispatch:e})=>LO(t,e);function v2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function N8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,a,i,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:a})=>{const i=N8(t).split(/-(?!$)/),o=i.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&a&&r.maybeStep(f)}),!0};function ji(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?kn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),N=Math.min(a,g+m.nodeSize);c.push({node:m,from:y,to:N})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Mh(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var j8=(t,e={})=>({state:n,dispatch:r})=>{const a=kn(t,n.schema);return ji(n,a,e)?$O(n,r):!1},k8=()=>({state:t,dispatch:e})=>IS(t,e),S8=t=>({state:e,dispatch:n})=>{const r=kn(t,e.schema);return QO(r)(e,n)},C8=()=>({state:t,dispatch:e})=>MS(t,e);function Pf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function mN(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,a)=>(n.includes(a)||(r[a]=t[a]),r),{})}var E8=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Pf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=kn(t,r.schema)),c==="mark"&&(o=La(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{i&&i===f.type&&(u=!0,a&&n.setNodeMarkup(m,void 0,mN(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(mN(g.attrs,e))))})})}),u},T8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),M8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ur(t.doc);t.setSelection(n)}return!0},A8=()=>({state:t,dispatch:e})=>SS(t,e),I8=()=>({state:t,dispatch:e})=>TS(t,e),R8=()=>({state:t,dispatch:e})=>HO(t,e),P8=()=>({state:t,dispatch:e})=>KO(t,e),O8=()=>({state:t,dispatch:e})=>UO(t,e);function lx(t,e,n={},r={}){return hd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var D8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:a,tr:i,dispatch:o,commands:c})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const h=lx(t,a.schema,r,{errorOnInvalidContent:e??a.options.enableContentCheck});return o&&i.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??a.options.enableContentCheck})};function N2(t,e){const n=La(e,t.schema),{from:r,to:a,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,a,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function w2(t,e){const n=new d0(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function L8(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function j2(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Of(t){return e=>j2(e.$from,t)}function Ue(t,e,n){return t.config[e]===void 0&&t.parent?Ue(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Ue(t.parent,e,n):null}):t.config[e]}function A0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Ue(e,"addExtensions",n);return r?[e,...A0(r())]:e}).flat(10)}function I0(t,e){const n=Do.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function k2(t){return typeof t=="function"}function jt(t,e=void 0,...n){return k2(t)?e?t.bind(e)(...n):t(...n):t}function z8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Ol(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),r=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function S2(t){const e=[],{nodeExtensions:n,markExtensions:r}=Ol(t),a=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:a},m=Ue(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let N;Array.isArray(y.types)?N=y.types:y.types==="*"?N=u:y.types==="nodes"?N=o:y.types==="marks"?N=c:N=[],N.forEach(j=>{Object.entries(y.attributes).forEach(([v,k])=>{e.push({type:j,name:v,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=Ue(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,N])=>{const j={...i,...N};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:y,attribute:j})})}),e}function $8(t){const e=[];let n="",r=!1,a=!1,i=0;const o=t.length;for(let c=0;c0){i-=1,n+=u;continue}if(u===";"&&i===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function gN(t){const e=[],n=$8(t||""),r=n.length;for(let a=0;a!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([a,i])=>{if(!r[a]){r[a]=i;return}if(a==="class"){const c=i?String(i).split(" "):[],u=r[a]?r[a].split(" "):[],h=c.filter(f=>!u.includes(f));r[a]=[...u,...h].join(" ")}else if(a==="style"){const c=new Map([...gN(r[a]),...gN(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function fd(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>St(n,r),{})}function F8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function xN(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const a=e.reduce((i,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):F8(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function yN(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&z8(n)?!1:n!=null))}function bN(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function B8(t,e){var n;const r=S2(t),{nodeExtensions:a,markExtensions:i}=Ol(t),o=(n=a.find(h=>Ue(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(a.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,E)=>{const C=Ue(E,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),y=yN({...g,content:jt(Ue(h,"content",m)),marks:jt(Ue(h,"marks",m)),group:jt(Ue(h,"group",m)),inline:jt(Ue(h,"inline",m)),atom:jt(Ue(h,"atom",m)),selectable:jt(Ue(h,"selectable",m)),draggable:jt(Ue(h,"draggable",m)),code:jt(Ue(h,"code",m)),whitespace:jt(Ue(h,"whitespace",m)),linebreakReplacement:jt(Ue(h,"linebreakReplacement",m)),defining:jt(Ue(h,"defining",m)),isolating:jt(Ue(h,"isolating",m)),attrs:Object.fromEntries(f.map(bN))}),N=jt(Ue(h,"parseHTML",m));N&&(y.parseDOM=N.map(k=>xN(k,f)));const j=Ue(h,"renderHTML",m);j&&(y.toDOM=k=>j({node:k,HTMLAttributes:fd(k,f)}));const v=Ue(h,"renderText",m);return v&&(y.toText=v),[h.name,y]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(v=>v.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((v,k)=>{const E=Ue(k,"extendMarkSchema",m);return{...v,...E?E(h):{}}},{}),y=yN({...g,inclusive:jt(Ue(h,"inclusive",m)),excludes:jt(Ue(h,"excludes",m)),group:jt(Ue(h,"group",m)),spanning:jt(Ue(h,"spanning",m)),code:jt(Ue(h,"code",m)),attrs:Object.fromEntries(f.map(bN))}),N=jt(Ue(h,"parseHTML",m));N&&(y.parseDOM=N.map(v=>xN(v,f)));const j=Ue(h,"renderHTML",m);return j&&(y.toDOM=v=>j({mark:v,HTMLAttributes:fd(v,f)})),[h.name,y]}));return new rS({topNode:o,nodes:c,marks:u})}function V8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Gc(t){return t.sort((n,r)=>{const a=Ue(n,"priority")||100,i=Ue(r,"priority")||100;return a>i?-1:ar.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function E2(t,e,n){const{from:r,to:a}=e,{blockSeparator:i=` + +`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,a,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=i);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,a-h))}),c}function H8(t,e){const n={from:0,to:t.content.size};return E2(t,n,e)}function T2(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function W8(t,e){const n=kn(e,t.schema),{from:r,to:a}=t.selection,i=[];t.doc.nodesBetween(r,a,c=>{i.push(c)});const o=i.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function M2(t,e){const n=Pf(typeof e=="string"?e:e.name,t.schema);return n==="node"?W8(t,e):n==="mark"?N2(t,e):{}}function U8(t,e=JSON.stringify){const n={};return t.filter(r=>{const a=e(r);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function K8(t){const e=U8(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function A2(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((a,i)=>{const o=[];if(a.ranges.length)a.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[i];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(i).map(c,-1),f=e.slice(i).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),K8(r)}function R0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=M0(i,a.type);o&&r.push({mark:a,...o})}):n.nodesBetween(t,e,(a,i)=>{!a||(a==null?void 0:a.nodeSize)===void 0||r.push(...a.marks.map(o=>({from:i,to:i+a.nodeSize,mark:o})))}),r}var q8=(t,e,n,r=20)=>{const a=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const c=a.node(i);(c==null?void 0:c.type.name)===e?o=c:i-=1}return[o,i]};function Ic(t,e){return e.nodes[t]||e.marks[t]||null}function ah(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const a=t.find(i=>i.type===e&&i.name===r);return a?a.attribute.keepOnSplit:!1}))}var G8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(a,i,o,c)=>{var u,h;const f=((h=(u=a.type.spec).toText)==null?void 0:h.call(u,{node:a,pos:i,parent:o,index:c}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?f:f.slice(0,Math.max(0,r-i))}),n};function cx(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?La(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Mh(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const y=m.pos,N=g.pos;t.doc.nodesBetween(y,N,(j,v)=>{if(i&&j.inlineContent&&!j.type.allowsMarkType(i))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(y,v),E=Math.min(N,v+j.nodeSize),C=E-k;o+=C,c.push(...j.marks.map(T=>({mark:T,from:k,to:E})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Mh(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function J8(t,e,n={}){if(!e)return ji(t,null,n)||cx(t,null,n);const r=Pf(e,t.schema);return r==="node"?ji(t,e,n):r==="mark"?cx(t,e,n):!1}var Y8=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=Of(c=>c.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return a.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function vN(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function NN(t,e){const{nodeExtensions:n}=Ol(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=jt(Ue(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Df(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let a=!0;return t.content.forEach(i=>{a!==!1&&(Df(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function I2(t){return t instanceof Ge}var R2=class P2{constructor(e){this.position=e}static fromJSON(e){return new P2(e.position)}toJSON(){return{position:this.position}}};function X8(t,e){const n=e.mapping.mapResult(t.position);return{position:new R2(n.pos),mapResult:n}}function Z8(t){return new R2(t)}function e6(t,e,n){var r;const{selection:a}=e;let i=null;if(x2(a)&&(i=a.$cursor),i){const c=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=a;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),N=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=y&&N}return!h}),h})}var t6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=La(t,r.schema);if(a)if(o){const h=N2(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,y)=>{const N=Math.max(y,f),j=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(N,j,u.create({...k.attrs,...e}))}):n.addMark(N,j,u.create(e))})});return e6(r,n,u)},n6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),r6=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=kn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?a().command(({commands:c})=>P1(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>P1(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},s6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=fo(t,0,r.content.size),i=Ge.create(r,a);e.setSelection(i)}return!0},a6=(t,e)=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=i.from,c=i.to),a&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},i6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Xe.atStart(r).from,c=Xe.atEnd(r).to,u=fo(a,o,c),h=fo(i,o,c),f=Xe.create(r,u,h);e.setSelection(f)}return!0},o6=t=>({state:e,dispatch:n})=>{const r=kn(t,e.schema);return eD(r)(e,n)};function wN(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(a=>e==null?void 0:e.includes(a.type.name));t.tr.ensureMarks(r)}}var l6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:a})=>{const{selection:i,doc:o}=e,{$from:c,$to:u}=i,h=a.extensionManager.attributes,f=ah(h,c.node().type.name,c.node().attrs);if(i instanceof Ge&&i.node.isBlock)return!c.parentOffset||!Aa(o,c.pos)?!1:(r&&(t&&wN(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:L8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,N=Aa(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!N&&Aa(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(N=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(N&&(i instanceof Xe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),v=e.doc.resolve(j);c.node(-1).canReplaceWith(v.index(),v.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&wN(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return N},c6=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=kn(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let k=ve.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let R=u.depth-E;R>=u.depth-3;R-=1)k=ve.from(u.node(R).copy(k));const C=u.indexAfter(-1){if(D>-1)return!1;R.isTextblock&&R.content.size===0&&(D=O+1)}),D>-1&&n.setSelection(Xe.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,N={...ah(g,m.type.name,m.attrs),...e},j={...ah(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const v=y?[{type:c,attrs:N},{type:y,attrs:j}]:[{type:c,attrs:N}];if(!Aa(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:E}=r,{splittableMarks:C}=i.extensionManager,T=E||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!T||!a)return!0;const P=T.filter(F=>C.includes(F.type.name));n.ensureMarks(P)}return!0},ag=(t,e)=>{const n=Of(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===(a==null?void 0:a.type)&&Ai(t.doc,n.pos)&&t.join(n.pos),!0},ig=(t,e)=>{const n=Of(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===(a==null?void 0:a.type)&&Ai(t.doc,r)&&t.join(r),!0},d6=(t,e,n,r={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=a.extensionManager,y=kn(t,o.schema),N=kn(e,o.schema),{selection:j,storedMarks:v}=o,{$from:k,$to:E}=j,C=k.blockRange(E),T=v||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const P=Of(F=>NN(F.type.name,m))(j);if(C.depth>=1&&P&&C.depth-P.depth<=1){if(P.node.type===y)return h.liftListItem(N);if(NN(P.node.type.name,m)&&y.validContent(P.node.content)&&c)return u().command(()=>(i.setNodeMarkup(P.pos,y),!0)).command(()=>ag(i,y)).command(()=>ig(i,y)).run()}return!n||!T||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>ag(i,y)).command(()=>ig(i,y)).run():u().command(()=>{const F=f().wrapInList(y,r),D=T.filter(R=>g.includes(R.type.name));return i.ensureMarks(D),F?!0:h.clearNodes()}).wrapInList(y,r).command(()=>ag(i,y)).command(()=>ig(i,y)).run()},u6=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=La(t,r.schema);return cx(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},h6=(t,e,n={})=>({state:r,commands:a})=>{const i=kn(t,r.schema),o=kn(e,r.schema),c=ji(r,i,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?a.setNode(o,u):a.setNode(i,{...u,...n})},f6=(t,e={})=>({state:n,commands:r})=>{const a=kn(t,n.schema);return ji(n,a,e)?r.lift(a):r.wrapIn(a,e)},p6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(i.text){const u=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else o.delete(i.from,i.to)}return!0}}return!1},m6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:a}=n;return r||e&&a.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},g6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=La(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:y}=c;const N=(i=h.marks().find(v=>v.type===u))==null?void 0:i.attrs,j=M0(h,u,N);j&&(g=j.from,y=j.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},x6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:a}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=a.from,o=a.to),r&&e.doc.nodesBetween(i,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},y6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Pf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=kn(t,r.schema)),c==="mark"&&(o=La(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,N,j;n.selection.empty?r.doc.nodesBetween(f,m,(v,k)=>{i&&i===v.type&&(u=!0,N=Math.max(k,f),j=Math.min(k+v.nodeSize,m),g=k,y=v)}):r.doc.nodesBetween(f,m,(v,k)=>{k=f&&k<=m&&(i&&i===v.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(E=>{if(o===E.type&&(u=!0,a)){const C=Math.max(k,f),T=Math.min(k+v.nodeSize,m);n.addMark(C,T,o.create({...E.attrs,...e}))}}))}),y&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(v=>{o===v.type&&a&&n.addMark(N,j,o.create({...v.attrs,...e}))}))}),u},b6=(t,e={})=>({state:n,dispatch:r})=>{const a=kn(t,n.schema);return qO(a,e)(n,r)},v6=(t,e={})=>({state:n,dispatch:r})=>{const a=kn(t,n.schema);return GO(a,e)(n,r)},N6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Lf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},w6=(t,e)=>{if(T0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Vu(t){var e;const{editor:n,from:r,to:a,text:i,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=G8(h)+i;return o.forEach(g=>{if(f)return;const y=w6(m,g.find);if(!y)return;const N=u.state.tr,j=If({state:u.state,transaction:N}),v={from:r-(y[0].length-i.length),to:a},{commands:k,chain:E,can:C}=new Rf({editor:n,state:j});g.handler({state:j,range:v,match:y,commands:k,chain:E,can:C})===null||!N.steps.length||(g.undoable&&N.setMeta(c,{transform:N,from:r,to:a,text:i}),u.dispatch(N),f=!0)}),f}function j6(t){const{editor:e,rules:n}=t,r=new Wt({state:{init(){return null},apply(a,i,o){const c=a.getMeta(r);if(c)return c;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=I0(ve.from(f),o.schema);const{from:m}=u,g=m+f.length;Vu({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return Vu({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&Vu({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(a,i){if(i.key!=="Enter")return!1;const{$cursor:o}=a.state.selection;return o?Vu({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function k6(t){return Object.prototype.toString.call(t).slice(8,-1)}function Hu(t){return k6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function O2(t,e){const n={...t};return Hu(t)&&Hu(e)&&Object.keys(e).forEach(r=>{Hu(e[r])&&Hu(t[r])?n[r]=O2(t[r],e[r]):n[r]=e[r]}),n}var P0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...jt(Ue(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...jt(Ue(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>O2(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Lo=class D2 extends P0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new D2(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const o=a.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",a.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function S6(t){return typeof t=="number"}var C6=class{constructor(t){this.find=t.find,this.handler=t.handler}},E6=(t,e,n)=>{if(T0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(a=>{const i=[a.text];return i.index=a.index,i.input=t,i.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(a.replaceWith)),i}):[]};function T6(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Rf({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(y,N)=>{var j,v,k,E,C;if((v=(j=y.type)==null?void 0:j.spec)!=null&&v.code||!(y.isText||y.isTextblock||y.isInline))return;const T=(C=(E=(k=y.content)==null?void 0:k.size)!=null?E:y.nodeSize)!=null?C:0,P=Math.max(r,N),F=Math.min(a,N+T);if(P>=F)return;const D=y.isText?y.text||"":y.textBetween(P-N,F-N,void 0,"");E6(D,i.find,o).forEach(O=>{if(O.index===void 0)return;const _=P+O.index+1,re=_+O[0].length,ne={from:n.tr.mapping.map(_),to:n.tr.mapping.map(re)},he=i.handler({state:n,range:ne,match:O,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(he)})}),m.every(y=>y!==null)}var Wu=null,M6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function A6(t){const{editor:e,rules:n}=t;let r=null,a=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:N})=>{const j=f.tr,v=If({state:f,transaction:j});if(!(!T6({editor:e,state:v,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:N,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new Wt({view(m){const g=N=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(N.target)?m.dom.parentElement:null,r&&(Wu=e)},y=()=>{Wu&&(Wu=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=r===m.dom.parentElement,c=g,!i){const y=Wu;y!=null&&y.isEditable&&setTimeout(()=>{const N=y.state.selection;N&&y.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(m,g)=>{var y;const N=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const N=m[0],j=N.getMeta("uiEvent")==="paste"&&!a,v=N.getMeta("uiEvent")==="drop"&&!i,k=N.getMeta("applyPasteRules"),E=!!k;if(!j&&!v&&!E)return;if(E){let{text:P}=k;typeof P=="string"?P=P:P=I0(ve.from(P),y.schema);const{from:F}=k,D=F+P.length,R=M6(P);return u({rule:f,state:y,from:F,to:{b:D},pasteEvt:R})}const C=g.doc.content.findDiffStart(y.doc.content),T=g.doc.content.findDiffEnd(y.doc.content);if(!(!S6(C)||!T||C===T.b))return u({rule:f,state:y,from:C,to:T,pasteEvt:o})}}))}var _f=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=C2(t),this.schema=B8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ic(e.name,this.schema)},r=Ue(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Gc([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Ic(r.name,this.schema)},i=[],o=Ue(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&Ue(r,"exitable",a)&&(c.ArrowRight=()=>Lo.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,N])=>[y,()=>N({editor:t})]));c={...c,...g}}const u=WL(c);i.push(u);const h=Ue(r,"addInputRules",a);if(vN(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=j6({editor:t,rules:g}),N=Array.isArray(y)?y:[y];i.push(...N)}}const f=Ue(r,"addPasteRules",a);if(vN(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=A6({editor:t,rules:g});i.push(...y)}}const m=Ue(r,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return S2(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Ol(this.extensions);return Object.fromEntries(e.filter(n=>!!Ue(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:kn(n.name,this.schema)},i=Ue(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const y=fd(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return Gc([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Ic(a.name,this.schema)},o=Ue(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Gc([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Ic(a.name,this.schema)},o=Ue(a,"transformPastedHTML",i);return o?(c,u)=>{const h=r(c,u);return o.call(i,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Ol(this.extensions);return Object.fromEntries(e.filter(n=>!!Ue(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:La(n.name,this.schema)},i=Ue(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=fd(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{U6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ic(e.name,this.schema)};e.type==="mark"&&((n=jt(Ue(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=Ue(e,"onBeforeCreate",r),i=Ue(e,"onCreate",r),o=Ue(e,"onUpdate",r),c=Ue(e,"onSelectionUpdate",r),u=Ue(e,"onTransaction",r),h=Ue(e,"onFocus",r),f=Ue(e,"onBlur",r),m=Ue(e,"onDestroy",r);a&&this.editor.on("beforeCreate",a),i&&this.editor.on("create",i),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};_f.resolve=C2;_f.sort=Gc;_f.flatten=A0;var I6={};E0(I6,{ClipboardTextSerializer:()=>_2,Commands:()=>z2,Delete:()=>$2,Drop:()=>F2,Editable:()=>B2,FocusEvents:()=>H2,Keymap:()=>W2,Paste:()=>U2,Tabindex:()=>K2,TextDirection:()=>q2,focusEventsPluginKey:()=>V2});var gn=class L2 extends P0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new L2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},_2=gn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Wt({key:new tn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:a}=e,{ranges:i}=a,o=Math.min(...i.map(f=>f.$from.pos)),c=Math.max(...i.map(f=>f.$to.pos)),u=T2(n);return E2(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),z2=gn.create({name:"commands",addCommands(){return{...m2}}}),$2=gn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,a;const i=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=w2(t.before,[t,...e]);A2(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(N,j)=>{const v=j+N.nodeSize-2,k=y.oldRange.from<=j&&v<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:N,from:j,to:v,newFrom:f.mapping.map(j),newTo:f.mapping.map(v),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,N)=>{var j,v;if(y instanceof Es){const k=g.slice(N).map(y.from,-1),E=g.slice(N).map(y.to),C=g.invert().map(k,-1),T=g.invert().map(E),P=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(D=>D.eq(y.mark)),F=(v=f.doc.nodeAt(E))==null?void 0:v.marks.some(D=>D.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:C,to:T},newRange:{from:k,to:E},partial:!!(F||P),editor:this.editor,transaction:t,combinedTransform:f})}})};(a=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||a?setTimeout(i,0):i()}}),F2=gn.create({name:"drop",addProseMirrorPlugins(){return[new Wt({key:new tn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),B2=gn.create({name:"editable",addProseMirrorPlugins(){return[new Wt({key:new tn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),V2=new tn("focusEvents"),H2=gn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Wt({key:V2,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),W2=gn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,N=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=N.parent.type.spec.isolating,v=m.pos-m.parentOffset,k=j&&N.parent.childCount===1?v===m.pos:nt.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ah()||v2()?i:a},addProseMirrorPlugins(){return[new Wt({key:new tn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),a=t.some(j=>j.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=nt.atStart(e.doc).from,h=nt.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Df(n.doc))return;const g=n.tr,y=If({state:n,transaction:g}),{commands:N}=new Rf({editor:this.editor,state:y});if(N.clearNodes(),!!g.steps.length)return g}})]}}),U2=gn.create({name:"paste",addProseMirrorPlugins(){return[new Wt({key:new tn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),K2=gn.create({name:"tabindex",addProseMirrorPlugins(){return[new Wt({key:new tn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),q2=gn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Ol(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Wt({key:new tn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),R6=class zc{constructor(e,n,r=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=a}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new zc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new zc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new zc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const a=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+r+(i?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!a&&!o&&u.depth<=this.depth)return;const h=new zc(u,this.editor,a,a||o?n:null);a&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,a=this.parent;for(;a&&!r;){if(a.node.type.name===e)if(Object.keys(n).length>0){const i=a.node.attrs,o=Object.keys(n);for(let c=0;c{r&&a.length>0||(o.node.type.name===e&&i.every(u=>n[u]===o.node.attrs[u])&&a.push(o),!(r&&a.length>0)&&(a=a.concat(o.querySelectorAll(e,n,r))))}),a}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},P6=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +}`;function O6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const a=document.createElement("style");return e&&a.setAttribute("nonce",e),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}var D6=class extends N6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:X8,createMappablePosition:Z8},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:a,moved:i})=>this.options.onDrop(r,a,i)),this.on("paste",({event:r,slice:a})=>this.options.onPaste(r,a)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=y2(e,this.options.autofocus);this.editorState=wl.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=O6(P6,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=k2(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(a=>{const i=typeof a=="string"?`${a}$`:a.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[B2,_2.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),z2,H2,W2,K2,F2,U2,$2,q2.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a==null?void 0:a.type));this.extensionManager=new _f(r,this)}createCommandManager(){this.commandManager=new Rf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=lx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=lx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),a=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new p2(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:a,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),a=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!a)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return M2(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return J8(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return I0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` + +`,textSerializers:n={}}=t||{};return H8(this.state.doc,{blockSeparator:e,textSerializers:{...T2(this.schema),...n}})}get isEmpty(){return Df(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new R6(e,this)}get $doc(){return this.$pos(0)}};function Dl(t){return new Lf({find:t.find,handler:({state:e,range:n,match:r})=>{const a=jt(t.getAttributes,void 0,r);if(a===!1||a===null)return null;const{tr:i}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(R0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(j=>j===t.type&&j!==y.mark.type)).filter(y=>y.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const g=n.from+u+o.length;i.addMark(n.from+u,g,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function G2(t){return new Lf({find:t.find,handler:({state:e,range:n,match:r})=>{const a=jt(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let c=n.to;const u=t.type.create(a);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];i.insertText(m,o+r[0].length-1),i.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;i.insert(h,t.type.create(a)).delete(i.mapping.map(o),i.mapping.map(c))}i.scrollIntoView()},undoable:t.undoable})}function dx(t){return new Lf({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),i=jt(t.getAttributes,void 0,r)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Ll(t){return new Lf({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const i=jt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&c0(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,N=g||m.$to.parentOffset&&m.$from.marks();if(N){const j=N.filter(v=>y.includes(v.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&Ai(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var L6=t=>"touches"in t,_6=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,a,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(a=t.options)!=null&&a.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),a=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),a&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,L6(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:a}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,a,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,a=this.startHeight;const i=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),c?a=this.startHeight+n:u&&(a=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(a=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,a,t):{width:r,height:a}}applyConstraints(t,e,n){var r,a,i,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(a=this.maxSize)!=null&&a.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",a=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:a?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function z6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ge){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let a=r.depth;for(;a>=0;){const i=r.index(a);if(r.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function $6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var F6={};E0(F6,{createAtomBlockMarkdownSpec:()=>B6,createBlockMarkdownSpec:()=>V6,createInlineMarkdownSpec:()=>J2,parseAttributes:()=>O0,parseIndentedBlocks:()=>ux,renderNestedMarkdownContent:()=>L0,serializeAttributes:()=>D0});function O0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[h]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function D0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function B6(t){const{nodeName:e,name:n,parseAttributes:r=O0,serializeAttributes:a=D0,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...i,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),N=f.match(y);if(!N)return;const j=N[1]||"",v=r(j);if(!o.find(E=>!(E in v)))return{type:e,raw:N[0],attributes:v}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=a(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function V6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=O0,serializeAttributes:i=D0,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const j=r(m);y=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const N={...o,...m.attributes};return g.createNode(e,N,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),N=(g=m.match(y))==null?void 0:g.index;return N!==void 0?N:-1},tokenize(m,g,y){var N;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=m.match(j);if(!v)return;const[k,E=""]=v,C=a(E);let T=1;const P=k.length;let F="";const D=/^:::([\w-]*)(\s.*)?/gm,R=m.slice(P);for(D.lastIndex=0;;){const O=D.exec(R);if(O===null)break;const _=O.index,re=O[1];if(!((N=O[2])!=null&&N.endsWith(":::"))){if(re)T+=1;else if(T-=1,T===0){const ne=R.slice(0,_);F=ne.trim();const he=m.slice(0,P+_+O[0].length);let xe=[];if(F)if(c==="block")for(xe=y.blockTokens(ne),xe.forEach(z=>{z.text&&(!z.tokens||z.tokens.length===0)&&(z.tokens=y.inlineTokens(z.text))});xe.length>0;){const z=xe[xe.length-1];if(z.type==="paragraph"&&(!z.text||z.text.trim()===""))xe.pop();else break}else xe=y.inlineTokens(F);return{type:e,raw:he,attributes:C,content:F,tokens:xe}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),N=i(y),j=N?` {${N}}`:"",v=g.renderChildren(m.content||[],` + +`);return`:::${h}${j} + +${v} + +:::`}}}function H6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r;e[a]=i||o,r=n.exec(t)}return e}function W6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function J2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=H6,serializeAttributes:i=W6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(N=>{const j=typeof N=="string"?N:N.name,v=typeof N=="string"?void 0:N.skipIfDefault;if(j in g){const k=g[j];if(v!==void 0&&k===v)return;y[j]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const N={...o,...g.attributes};if(c)return y.createNode(e,N);const j=r?r(g):g.content||"";return j?y.createNode(e,N,[y.createTextNode(j)]):y.createNode(e,N,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),N=g.match(y),j=N==null?void 0:N.index;return j!==void 0?j:-1},tokenize(g,y,N){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),v=g.match(j);if(!v)return;let k="",E="";if(c){const[,T]=v;E=T}else{const[,T,P]=v;E=T,k=P||""}const C=a(E.trim());return{type:e,raw:v[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const N=f(g.attrs||{}),j=i(N),v=j?` ${j}`:"";return c?`[${h}${v}]`:`[${h}${v}]${y}[/${h}]`}}}function ux(t,e,n){var r,a,i,o;const c=t.split(` +`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} +`;continue}else return}const N=e.extractItemData(y),{indentLevel:j,mainContent:v}=N;h=`${h}${g} +`;const k=[v];for(f+=1;f_.trim()!=="");if(D===-1)break;if((((a=(r=c[f+1+D].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>j){k.push(P),h=`${h}${P} +`,f+=1;continue}else break}if((((o=(i=P.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>j)k.push(P),h=`${h}${P} +`,f+=1;else break}let E;const C=k.slice(1);if(C.length>0){const P=C.map(F=>F.slice(j+m)).join(` +`);P.trim()&&(e.customNestedParser?E=e.customNestedParser(P):E=n.blockTokens(P))}const T=e.createToken(N,E);u.push(T)}if(u.length!==0)return{items:u,raw:h}}function L0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` +`).map(g=>g?e.indent(g):"").join(` +`);u.push(m)}}),u.join(` +`)}function U6(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,y)}}),i.docChanged&&e.view.dispatch(i)}var Sn=class Y2 extends P0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Y2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Mo(t){return new C6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=jt(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(R0(n.from,n.to,e.doc).filter(N=>N.mark.type.excluded.find(v=>v===t.type&&v!==N.mark.type)).filter(N=>N.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:K6,getOwnPropertySymbols:q6}=Object,{hasOwnProperty:G6}=Object.prototype;function og(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function Uu(t){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,a);const{cache:i}=a,o=i.get(n),c=i.get(r);if(o&&c)return o===r&&c===n;i.set(n,r),i.set(r,n);const u=t(n,r,a);return i.delete(n),i.delete(r),u}}function J6(t){return t!=null?t[Symbol.toStringTag]:void 0}function jN(t){return K6(t).concat(q6(t))}const Y6=Object.hasOwn||((t,e)=>G6.call(t,e));function _o(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Q6="__v",X6="__o",Z6="_owner",{getOwnPropertyDescriptor:kN,keys:SN}=Object;function e_(t,e){return t.byteLength===e.byteLength&&Ih(new Uint8Array(t),new Uint8Array(e))}function t_(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function n_(t,e){return t.byteLength===e.byteLength&&Ih(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function r_(t,e){return _o(t.getTime(),e.getTime())}function s_(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function a_(t,e){return t===e}function CN(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const g=o.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const i_=_o;function o_(t,e,n){const r=SN(t);let a=r.length;if(SN(e).length!==a)return!1;for(;a-- >0;)if(!Q2(t,e,n,r[a]))return!1;return!0}function Rc(t,e,n){const r=jN(t);let a=r.length;if(jN(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!Q2(t,e,n,i)||(o=kN(t,i),c=kN(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function l_(t,e){return _o(t.valueOf(),e.valueOf())}function c_(t,e){return t.source===e.source&&t.flags===e.flags}function EN(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.values();let o,c;for(;(o=i.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!a[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=a[f]=!0;break}f++}if(!h)return!1}return!0}function Ih(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function d_(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Q2(t,e,n,r){return(r===Z6||r===X6||r===Q6)&&(t.$$typeof||e.$$typeof)?!0:Y6(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const u_="[object ArrayBuffer]",h_="[object Arguments]",f_="[object Boolean]",p_="[object DataView]",m_="[object Date]",g_="[object Error]",x_="[object Map]",y_="[object Number]",b_="[object Object]",v_="[object RegExp]",N_="[object Set]",w_="[object String]",j_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},k_="[object URL]",S_=Object.prototype.toString;function C_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:N}){return function(v,k,E){if(v===k)return!0;if(v==null||k==null)return!1;const C=typeof v;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(v,k,E):C==="function"?i(v,k,E):!1;const T=v.constructor;if(T!==k.constructor)return!1;if(T===Object)return u(v,k,E);if(Array.isArray(v))return e(v,k,E);if(T===Date)return r(v,k,E);if(T===RegExp)return f(v,k,E);if(T===Map)return o(v,k,E);if(T===Set)return m(v,k,E);const P=S_.call(v);if(P===m_)return r(v,k,E);if(P===v_)return f(v,k,E);if(P===x_)return o(v,k,E);if(P===N_)return m(v,k,E);if(P===b_)return typeof v.then!="function"&&typeof k.then!="function"&&u(v,k,E);if(P===k_)return y(v,k,E);if(P===g_)return a(v,k,E);if(P===h_)return u(v,k,E);if(j_[P])return g(v,k,E);if(P===u_)return t(v,k,E);if(P===p_)return n(v,k,E);if(P===f_||P===y_||P===w_)return h(v,k,E);if(N){let F=N[P];if(!F){const D=J6(v);D&&(F=N[D])}if(F)return F(v,k,E)}return!1}}function E_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:e_,areArraysEqual:n?Rc:t_,areDataViewsEqual:n_,areDatesEqual:r_,areErrorsEqual:s_,areFunctionsEqual:a_,areMapsEqual:n?og(CN,Rc):CN,areNumbersEqual:i_,areObjectsEqual:n?Rc:o_,arePrimitiveWrappersEqual:l_,areRegExpsEqual:c_,areSetsEqual:n?og(EN,Rc):EN,areTypedArraysEqual:n?og(Ih,Rc):Ih,areUrlsEqual:d_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=Uu(r.areArraysEqual),i=Uu(r.areMapsEqual),o=Uu(r.areObjectsEqual),c=Uu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function T_(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function M_({circular:t,comparator:e,createState:n,equals:r,strict:a}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:a})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const i={cache:void 0,equals:r,meta:void 0,strict:a};return function(c,u){return e(c,u,i)}}const A_=Ri();Ri({strict:!0});Ri({circular:!0});Ri({circular:!0,strict:!0});Ri({createInternalComparator:()=>_o});Ri({strict:!0,createInternalComparator:()=>_o});Ri({circular:!0,createInternalComparator:()=>_o});Ri({circular:!0,createInternalComparator:()=>_o,strict:!0});function Ri(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=E_(t),o=C_(i),c=n?n(o):T_(o);return M_({circular:e,comparator:o,createState:r,equals:c,strict:a})}var lg={exports:{}},cg={};/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var TN;function I_(){if(TN)return cg;TN=1;var t=yd(),e=Fk();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return cg.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var N=i(null);if(N.current===null){var j={hasValue:!1,value:null};N.current=j}else j=N.current;N=c(function(){function k(F){if(!E){if(E=!0,C=F,F=g(F),y!==void 0&&j.hasValue){var D=j.value;if(y(D,F))return T=D}return T=F}if(D=T,r(C,F))return D;var R=g(F);return y!==void 0&&y(D,R)?(C=F,D):(C=F,T=R)}var E=!1,C,T,P=m===void 0?null:m;return[function(){return k(f())},P===null?void 0:function(){return k(P())}]},[f,m,g,y]);var v=a(h,N[0],N[1]);return o(function(){j.hasValue=!0,j.value=v},[v]),u(v),v},cg}var MN;function R_(){return MN||(MN=1,lg.exports=I_()),lg.exports}var P_=R_(),O_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},D_=({contentComponent:t})=>{const e=Bk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function L_(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Lw.createPortal(r.reactElement,r.element,n)},t.forEach(a=>a())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(a=>a())}}}var __=class extends wr.Component{constructor(t){var e;super(t),this.editorContentRef=wr.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=L_(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:O_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(D_,{contentComponent:t.contentComponent})]})}},z_=b.forwardRef((t,e)=>{const n=wr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return wr.createElement(__,{key:n,innerRef:e,...t})}),X2=wr.memo(z_),$_=typeof window<"u"?b.useLayoutEffect:b.useEffect,F_=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function B_(t){var e;const[n]=b.useState(()=>new F_(t.editor)),r=P_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:A_);return $_(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var V_=!1,hx=typeof window>"u",H_=hx||!!(typeof window<"u"&&window.next),W_=class Z2{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?hx||H_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onBeforeCreate)==null?void 0:i.call(a,...r)},onBlur:(...r)=>{var a,i;return(i=(a=this.options.current).onBlur)==null?void 0:i.call(a,...r)},onCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onCreate)==null?void 0:i.call(a,...r)},onDestroy:(...r)=>{var a,i;return(i=(a=this.options.current).onDestroy)==null?void 0:i.call(a,...r)},onFocus:(...r)=>{var a,i;return(i=(a=this.options.current).onFocus)==null?void 0:i.call(a,...r)},onSelectionUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onSelectionUpdate)==null?void 0:i.call(a,...r)},onTransaction:(...r)=>{var a,i;return(i=(a=this.options.current).onTransaction)==null?void 0:i.call(a,...r)},onUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onUpdate)==null?void 0:i.call(a,...r)},onContentError:(...r)=>{var a,i;return(i=(a=this.options.current).onContentError)==null?void 0:i.call(a,...r)},onDrop:(...r)=>{var a,i;return(i=(a=this.options.current).onDrop)==null?void 0:i.call(a,...r)},onPaste:(...r)=>{var a,i;return(i=(a=this.options.current).onPaste)==null?void 0:i.call(a,...r)},onDelete:(...r)=>{var a,i;return(i=(a=this.options.current).onDelete)==null?void 0:i.call(a,...r)}};return new D6(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,i)=>{var o;return a===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Z2.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,a)=>r===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function U_(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new W_(n)),a=Bk.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(a),b.useEffect(r.onRender(e)),B_({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var eC=b.createContext({editor:null});eC.Consumer;var K_=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),q_=()=>b.useContext(K_);wr.forwardRef((t,e)=>{const{onDragStart:n}=q_(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});wr.createContext({markViewContentRef:()=>{}});var _0=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});_0.displayName="TiptapContext";var G_=()=>b.useContext(_0);function tC({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=b.useMemo(()=>({editor:r}),[r]),i=b.useMemo(()=>({editor:r}),[r]);return s.jsx(eC.Provider,{value:i,children:s.jsx(_0.Provider,{value:a,children:n})})}tC.displayName="Tiptap";function nC({...t}){const{editor:e}=G_();return s.jsx(X2,{editor:e,...t})}nC.displayName="Tiptap.Content";Object.assign(tC,{Content:nC});var Rh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},J_=/^\s*>\s$/,Y_=Sn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Rh("blockquote",{...St(this.options.HTMLAttributes,t),children:Rh("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(a=>{const c=e.renderChildren([a]).split(` +`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` +`))}),r.join(` +${n} +`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ll({find:J_,type:this.type})]}}),Q_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,X_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Z_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,e7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,t7=Lo.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Rh("strong",{...St(this.options.HTMLAttributes,t),children:Rh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Dl({find:Q_,type:this.type}),Dl({find:Z_,type:this.type})]},addPasteRules(){return[Mo({find:X_,type:this.type}),Mo({find:e7,type:this.type})]}}),n7=/(^|[^`])`([^`]+)`(?!`)$/,r7=/(^|[^`])`([^`]+)`(?!`)/g,s7=Lo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Dl({find:n7,type:this.type})]},addPasteRules(){return[Mo({find:r7,type:this.type})]}}),dg=4,a7=/^```([a-z]+)?[\s\n]$/,i7=/^~~~([a-z]+)?[\s\n]$/,o7=Sn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:dg,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",St(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const a=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${a}`,e.renderChildren(t.content),"```"].join(` +`):r=`\`\`\`${a} + +\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:dg,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;if(i.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=a,y=r.doc.textBetween(h,f,` +`,` +`).split(` +`).map(N=>c+N).join(` +`);return u.replaceWith(h,f,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:dg,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=i,f=i.start(),m=i.end(),y=r.doc.textBetween(f,m,` +`,` +`).split(` +`);let N=0,j=0;const v=h-f;for(let F=0;F=v){N=F;break}j+=y[F].length+1}const E=((u=y[N].match(/^ */))==null?void 0:u[0])||"",C=Math.min(E.length,n);if(C===0)return!0;let T=f;for(let F=0;F{const{from:u,to:h}=a,g=r.doc.textBetween(u,h,` +`,` +`).split(` +`).map(y=>{var N;const j=((N=y.match(/^ */))==null?void 0:N[0])||"",v=Math.min(j.length,n);return y.slice(v)}).join(` +`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!i||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:a,empty:i}=n;if(!i||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const c=a.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(nt.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[dx({find:a7,type:this.type,getAttributes:t=>({language:t[1]})}),dx({find:i7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Wt({key:new tn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` +`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(Xe.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),l7=Sn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` + +`):""}),c7=Sn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",St(this.options.HTMLAttributes,t)]},renderText(){return` +`},renderMarkdown:()=>` +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),d7=Sn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,St(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,a="#".repeat(r);return t.content?`${a} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>dx({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),u7=Sn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",St(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!z6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return I2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Xe.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Ge.create(o.doc,u.pos)):o.setSelection(Xe.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(Xe.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[G2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),h7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,f7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,p7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,m7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,g7=Lo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Dl({find:h7,type:this.type}),Dl({find:p7,type:this.type})]},addPasteRules(){return[Mo({find:f7,type:this.type}),Mo({find:m7,type:this.type})]}});const x7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",y7="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",fx="numeric",px="ascii",mx="alpha",Jc="asciinumeric",$c="alphanumeric",gx="domain",rC="emoji",b7="scheme",v7="slashscheme",ug="whitespace";function N7(t,e){return t in e||(e[t]=[]),e[t]}function po(t,e,n){e[fx]&&(e[Jc]=!0,e[$c]=!0),e[px]&&(e[Jc]=!0,e[mx]=!0),e[Jc]&&(e[$c]=!0),e[mx]&&(e[$c]=!0),e[$c]&&(e[gx]=!0),e[rC]&&(e[gx]=!0);for(const r in e){const a=N7(r,n);a.indexOf(t)<0&&a.push(t)}}function w7(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Rr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Rr.groups={};Rr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,a),hn=(t,e,n,r,a)=>t.tr(e,n,r,a),AN=(t,e,n,r,a)=>t.ts(e,n,r,a),Ce=(t,e,n,r,a)=>t.tt(e,n,r,a),ja="WORD",xx="UWORD",sC="ASCIINUMERICAL",aC="ALPHANUMERICAL",pd="LOCALHOST",yx="TLD",bx="UTLD",ih="SCHEME",yl="SLASH_SCHEME",z0="NUM",vx="WS",$0="NL",Yc="OPENBRACE",Qc="CLOSEBRACE",Ph="OPENBRACKET",Oh="CLOSEBRACKET",Dh="OPENPAREN",Lh="CLOSEPAREN",_h="OPENANGLEBRACKET",zh="CLOSEANGLEBRACKET",$h="FULLWIDTHLEFTPAREN",Fh="FULLWIDTHRIGHTPAREN",Bh="LEFTCORNERBRACKET",Vh="RIGHTCORNERBRACKET",Hh="LEFTWHITECORNERBRACKET",Wh="RIGHTWHITECORNERBRACKET",Uh="FULLWIDTHLESSTHAN",Kh="FULLWIDTHGREATERTHAN",qh="AMPERSAND",Gh="APOSTROPHE",Jh="ASTERISK",si="AT",Yh="BACKSLASH",Qh="BACKTICK",Xh="CARET",oi="COLON",F0="COMMA",Zh="DOLLAR",Vs="DOT",ef="EQUALS",B0="EXCLAMATION",ls="HYPHEN",Xc="PERCENT",tf="PIPE",nf="PLUS",rf="POUND",Zc="QUERY",V0="QUOTE",iC="FULLWIDTHMIDDLEDOT",H0="SEMI",Hs="SLASH",ed="TILDE",sf="UNDERSCORE",oC="EMOJI",af="SYM";var lC=Object.freeze({__proto__:null,ALPHANUMERICAL:aC,AMPERSAND:qh,APOSTROPHE:Gh,ASCIINUMERICAL:sC,ASTERISK:Jh,AT:si,BACKSLASH:Yh,BACKTICK:Qh,CARET:Xh,CLOSEANGLEBRACKET:zh,CLOSEBRACE:Qc,CLOSEBRACKET:Oh,CLOSEPAREN:Lh,COLON:oi,COMMA:F0,DOLLAR:Zh,DOT:Vs,EMOJI:oC,EQUALS:ef,EXCLAMATION:B0,FULLWIDTHGREATERTHAN:Kh,FULLWIDTHLEFTPAREN:$h,FULLWIDTHLESSTHAN:Uh,FULLWIDTHMIDDLEDOT:iC,FULLWIDTHRIGHTPAREN:Fh,HYPHEN:ls,LEFTCORNERBRACKET:Bh,LEFTWHITECORNERBRACKET:Hh,LOCALHOST:pd,NL:$0,NUM:z0,OPENANGLEBRACKET:_h,OPENBRACE:Yc,OPENBRACKET:Ph,OPENPAREN:Dh,PERCENT:Xc,PIPE:tf,PLUS:nf,POUND:rf,QUERY:Zc,QUOTE:V0,RIGHTCORNERBRACKET:Vh,RIGHTWHITECORNERBRACKET:Wh,SCHEME:ih,SEMI:H0,SLASH:Hs,SLASH_SCHEME:yl,SYM:af,TILDE:ed,TLD:yx,UNDERSCORE:sf,UTLD:bx,UWORD:xx,WORD:ja,WS:vx});const Na=/[a-z]/,Pc=new RegExp("\\p{L}","u"),hg=new RegExp("\\p{Emoji}","u"),wa=/\d/,fg=/\s/,IN="\r",pg=` +`,j7="️",k7="‍",mg="";let Ku=null,qu=null;function S7(t=[]){const e={};Rr.groups=e;const n=new Rr;Ku==null&&(Ku=RN(x7)),qu==null&&(qu=RN(y7)),Ce(n,"'",Gh),Ce(n,"{",Yc),Ce(n,"}",Qc),Ce(n,"[",Ph),Ce(n,"]",Oh),Ce(n,"(",Dh),Ce(n,")",Lh),Ce(n,"<",_h),Ce(n,">",zh),Ce(n,"(",$h),Ce(n,")",Fh),Ce(n,"「",Bh),Ce(n,"」",Vh),Ce(n,"『",Hh),Ce(n,"』",Wh),Ce(n,"<",Uh),Ce(n,">",Kh),Ce(n,"&",qh),Ce(n,"*",Jh),Ce(n,"@",si),Ce(n,"`",Qh),Ce(n,"^",Xh),Ce(n,":",oi),Ce(n,",",F0),Ce(n,"$",Zh),Ce(n,".",Vs),Ce(n,"=",ef),Ce(n,"!",B0),Ce(n,"-",ls),Ce(n,"%",Xc),Ce(n,"|",tf),Ce(n,"+",nf),Ce(n,"#",rf),Ce(n,"?",Zc),Ce(n,'"',V0),Ce(n,"/",Hs),Ce(n,";",H0),Ce(n,"~",ed),Ce(n,"_",sf),Ce(n,"\\",Yh),Ce(n,"・",iC);const r=hn(n,wa,z0,{[fx]:!0});hn(r,wa,r);const a=hn(r,Na,sC,{[Jc]:!0}),i=hn(r,Pc,aC,{[$c]:!0}),o=hn(n,Na,ja,{[px]:!0});hn(o,wa,a),hn(o,Na,o),hn(a,wa,a),hn(a,Na,a);const c=hn(n,Pc,xx,{[mx]:!0});hn(c,Na),hn(c,wa,i),hn(c,Pc,c),hn(i,wa,i),hn(i,Na),hn(i,Pc,i);const u=Ce(n,pg,$0,{[ug]:!0}),h=Ce(n,IN,vx,{[ug]:!0}),f=hn(n,fg,vx,{[ug]:!0});Ce(n,mg,f),Ce(h,pg,u),Ce(h,mg,f),hn(h,fg,f),Ce(f,IN),Ce(f,pg),hn(f,fg,f),Ce(f,mg,f);const m=hn(n,hg,oC,{[rC]:!0});Ce(m,"#"),hn(m,hg,m),Ce(m,j7,m);const g=Ce(m,k7);Ce(g,"#"),hn(g,hg,m);const y=[[Na,o],[wa,a]],N=[[Na,null],[Pc,c],[wa,i]];for(let j=0;jj[0]>v[0]?1:-1);for(let j=0;j=0?E[gx]=!0:Na.test(v)?wa.test(v)?E[Jc]=!0:E[px]=!0:E[fx]=!0,AN(n,v,v,E)}return AN(n,"localhost",pd,{ascii:!0}),n.jd=new Rr(af),{start:n,tokens:Object.assign({groups:e},lC)}}function cC(t,e){const n=C7(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function C7(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Za(t,e,n,r,a){let i;const o=e.length;for(let c=0;c=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const md={defaultProtocol:"http",events:null,format:PN,formatHref:PN,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function W0(t,e=null){let n=Object.assign({},md);t&&(n=Object.assign(n,t instanceof W0?t.o:t));const r=n.ignoreTags,a=[];for(let i=0;in?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=md.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),a=t.get("tagName",n,e),i=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:a,attributes:o,content:i,eventListeners:m}}};function zf(t,e){class n extends dC{constructor(a,i){super(a,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const ON=zf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),DN=zf("text"),E7=zf("nl"),Gu=zf("url",{isLink:!0,toHref(t=md.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==pd&&t[1].t===oi}}),is=t=>new Rr(t);function T7({groups:t}){const e=t.domain.concat([qh,Jh,si,Yh,Qh,Xh,Zh,ef,ls,z0,Xc,tf,nf,rf,Hs,af,ed,sf]),n=[Gh,oi,F0,Vs,B0,Xc,Zc,V0,H0,_h,zh,Yc,Qc,Oh,Ph,Dh,Lh,$h,Fh,Bh,Vh,Hh,Wh,Uh,Kh],r=[qh,Gh,Jh,Yh,Qh,Xh,Zh,ef,ls,Yc,Qc,Xc,tf,nf,rf,Zc,Hs,af,ed,sf],a=is(),i=Ce(a,ed);dt(i,r,i),dt(i,t.domain,i);const o=is(),c=is(),u=is();dt(a,t.domain,o),dt(a,t.scheme,c),dt(a,t.slashscheme,u),dt(o,r,i),dt(o,t.domain,o);const h=Ce(o,si);Ce(i,si,h),Ce(c,si,h),Ce(u,si,h);const f=Ce(i,Vs);dt(f,r,i),dt(f,t.domain,i);const m=is();dt(h,t.domain,m),dt(m,t.domain,m);const g=Ce(m,Vs);dt(g,t.domain,m);const y=is(ON);dt(g,t.tld,y),dt(g,t.utld,y),Ce(h,pd,y);const N=Ce(m,ls);Ce(N,ls,N),dt(N,t.domain,m),dt(y,t.domain,m),Ce(y,Vs,g),Ce(y,ls,N);const j=Ce(y,oi);dt(j,t.numeric,ON);const v=Ce(o,ls),k=Ce(o,Vs);Ce(v,ls,v),dt(v,t.domain,o),dt(k,r,i),dt(k,t.domain,o);const E=is(Gu);dt(k,t.tld,E),dt(k,t.utld,E),dt(E,t.domain,o),dt(E,r,i),Ce(E,Vs,k),Ce(E,ls,v),Ce(E,si,h);const C=Ce(E,oi),T=is(Gu);dt(C,t.numeric,T);const P=is(Gu),F=is();dt(P,e,P),dt(P,n,F),dt(F,e,P),dt(F,n,F),Ce(E,Hs,P),Ce(T,Hs,P);const D=Ce(c,oi),R=Ce(u,oi),O=Ce(R,Hs),_=Ce(O,Hs);dt(c,t.domain,o),Ce(c,Vs,k),Ce(c,ls,v),dt(u,t.domain,o),Ce(u,Vs,k),Ce(u,ls,v),dt(D,t.domain,P),Ce(D,Hs,P),Ce(D,Zc,P),dt(_,t.domain,P),dt(_,e,P),Ce(_,Hs,P);const re=[[Yc,Qc],[Ph,Oh],[Dh,Lh],[_h,zh],[$h,Fh],[Bh,Vh],[Hh,Wh],[Uh,Kh]];for(let ne=0;ne=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(gg(DN,e,o)),o=[]),a-=g,f-=g;const y=m.t,N=n.slice(a-f,a);i.push(gg(y,e,N))}}return o.length>0&&i.push(gg(DN,e,o)),i}function gg(t,e,n){const r=n[0].s,a=n[n.length-1].e,i=e.slice(r,a);return new t(i,n)}const A7=typeof console<"u"&&console&&console.warn||(()=>{}),I7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Gt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function R7(){return Rr.groups={},Gt.scanner=null,Gt.parser=null,Gt.tokenQueue=[],Gt.pluginQueue=[],Gt.customSchemes=[],Gt.initialized=!1,Gt}function LN(t,e=!1){if(Gt.initialized&&A7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${I7}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +1. Must only contain digits, lowercase ASCII letters or "-" +2. Cannot start or end with "-" +3. "-" cannot repeat`);Gt.customSchemes.push([t,e])}function P7(){Gt.scanner=S7(Gt.customSchemes);for(let t=0;t{const a=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),i=e.some(h=>h.getMeta("preventAutolink"));if(!a||i)return;const{tr:o}=r,c=w2(n.doc,[...e]);if(A2(c).forEach(({newRange:h})=>{const f=_8(r.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(h.from,h.to," "," ");if(!D7.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(O7).filter(Boolean);if(y.length<=0)return!1;const N=y[y.length-1],j=m.pos+g.lastIndexOf(N);if(!N)return!1;const v=U0(N).map(k=>k.toObject(t.defaultProtocol));if(!_7(v))return!1;v.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{R0(k.from,k.to,r.doc).some(E=>E.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function $7(t){return new Wt({key:new tn("handleClickLink"),props:{handleClick:(e,n,r)=>{var a,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=M2(e.state,t.type.name),h=(a=o.href)!=null?a:u.href,f=(i=o.target)!=null?i:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function F7(t){return new Wt({key:new tn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:a}=t,{state:i}=e,{selection:o}=i,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=uC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||a!==void 0&&!a(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function so(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const a=typeof r=="string"?r:r.scheme;a&&n.push(a)}),!t||t.replace(L7,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var B7=Lo.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){LN(t);return}LN(t.scheme,t.optionalSlashes)})},onDestroy(){R7()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!so(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const a=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(a)||!/\./.test(a))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!so(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!so(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,a,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(i=(a=t.attrs)==null?void 0:a.title)!=null?i:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!so(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!so(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Mo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=uC(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!so(o,n),protocols:n,defaultProtocol:r}));a.length&&a.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(z7({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!so(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push($7({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(F7({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),V7=Object.defineProperty,H7=(t,e)=>{for(var n in e)V7(t,n,{get:e[n],enumerable:!0})},W7="listItem",_N="textStyle",zN=/^\s*([-+*])\s$/,hC=Sn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(W7,this.editor.getAttributes(_N)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ll({find:zN,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ll({find:zN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(_N),editor:this.editor})),[t]}}),fC=Sn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(a=>a.type==="paragraph"))n=e.parseChildren(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>L0(t,e,r=>{var a,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(a=r.meta)==null?void 0:a.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),U7={};H7(U7,{findListItemPos:()=>Ed,getNextListDepth:()=>q0,handleBackspace:()=>Nx,handleDelete:()=>wx,hasListBefore:()=>pC,hasListItemAfter:()=>K7,hasListItemBefore:()=>mC,listItemHasSubList:()=>gC,nextListIsDeeper:()=>xC,nextListIsHigher:()=>yC});var Ed=(t,e)=>{const{$from:n}=e.selection,r=kn(t,e.schema);let a=null,i=n.depth,o=n.pos,c=null;for(;i>0&&c===null;)a=n.node(i),a.type===r?c=i:(i-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},q0=(t,e)=>{const n=Ed(t,e);if(!n)return!1;const[,r]=q8(e,t,n.$pos.pos+4);return r},pC=(t,e,n)=>{const{$anchor:r}=t.selection,a=Math.max(0,r.pos-2),i=t.doc.resolve(a).node();return!(!i||!n.includes(i.type.name))},mC=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-2);return!(a.index()===0||((n=a.nodeBefore)==null?void 0:n.type.name)!==t)},gC=(t,e,n)=>{if(!n)return!1;const r=kn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},Nx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ji(t.state,e)&&pC(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,y)=>{g.type.name===e&&h.push({node:g,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!ji(t.state,e)||!Q8(t.state))return!1;const r=Ed(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=gC(e,t.state,i);return mC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},xC=(t,e)=>{const n=q0(t,e),r=Ed(t,e);return!r||!n?!1:n>r.depth},yC=(t,e)=>{const n=q0(t,e),r=Ed(t,e);return!r||!n?!1:n{if(!ji(t.state,e)||!Y8(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:xC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():yC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},K7=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-r.parentOffset-2);return!(a.index()===a.parent.childCount-1||((n=a.nodeAfter)==null?void 0:n.type.name)!==t)},bC=gn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&wx(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&wx(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Nx(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Nx(t,n,r)&&(e=!0)}),e}}}}),$N=/^(\s*)(\d+)\.\s+(.*)$/,q7=/^\s/;function G7(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(j=>j.indent)),N=vC(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:N,raw:g.map(j=>j.raw).join(` +`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function J7(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(a=>{if(a.type==="paragraph"||a.type==="list"||a.type==="blockquote"||a.type==="code")r.push(...e.parseChildren([a]));else if(a.type==="text"&&a.tokens){const i=e.parseChildren([a]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([a]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var Y7="listItem",FN="textStyle",BN=/^(\d+)\.\s$/,NC=Sn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",St(this.options.HTMLAttributes,n),0]:["ol",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?J7(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const a=t.split(` +`),[i,o]=G7(a);if(i.length===0)return;const c=vC(i,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:c,raw:a.slice(0,o).join(` +`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Y7,this.editor.getAttributes(FN)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ll({find:BN,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ll({find:BN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(FN)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Q7=/^\s*(\[([( |x])?\])\s$/,X7=Sn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const a=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return L0(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const N=n();if(typeof N!="number")return!1;const j=y.doc.nodeAt(N);return y.setNodeMarkup(N,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{a.setAttribute(m,g)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,g])=>{a.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=fd(m,g),N=new Set(Object.keys(y)),j=this.options.HTMLAttributes;return f.forEach(v=>{N.has(v)||(v in j?a.setAttribute(v,j[v]):a.removeAttribute(v))}),Object.entries(y).forEach(([v,k])=>{k==null?v in j?a.setAttribute(v,j[v]):a.removeAttribute(v):a.setAttribute(v,k)}),f=N,!0}}}},addInputRules(){return[Ll({find:Q7,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Z7=Sn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=ux(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},a=ux(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});gn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(hC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(fC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(bC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(NC.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(X7.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Z7.configure(this.options.taskList)),t}});var VN=" ",ez=" ",tz=Sn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",St(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===VN||r[0].text===ez)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?VN:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),nz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,rz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sz=Lo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",St(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Dl({find:nz,type:this.type})]},addPasteRules(){return[Mo({find:rz,type:this.type})]}}),az=Sn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),iz=Lo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",St(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const i=a[2].trim();return{type:"underline",raw:a[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function oz(t={}){return new Wt({view(e){return new lz(e,t)}})}class lz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let N=y.getBoundingClientRect(),j=m?N.bottom:N.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*c;r={left:N.left,right:N.right,top:j-v,bottom:j+v}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*y}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=pS(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class pn extends nt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return pn.valid(r)?new pn(r):nt.near(r)}content(){return Re.empty}eq(e){return e instanceof pn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new pn(e.resolve(n.pos))}getBookmark(){return new G0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!cz(e)||!dz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&pn.valid(e))return e;let a=e.pos,i=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){i=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;a+=n;let u=e.doc.resolve(a);if(pn.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Ge.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(pn.valid(c))return c}return null}}}pn.prototype.visible=!1;pn.findFrom=pn.findGapCursorFrom;nt.jsonID("gapcursor",pn);class G0{constructor(e){this.pos=e}map(e){return new G0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return pn.valid(n)?new pn(n):nt.near(n)}}function wC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function cz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||wC(a.type))return!0;if(a.inlineContent)return!1}}return!0}function dz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||wC(a.type))return!0;if(a.inlineContent)return!1}}return!0}function uz(){return new Wt({props:{decorations:mz,createSelectionBetween(t,e,n){return e.pos==n.pos&&pn.valid(n)?new pn(n):null},handleClick:fz,handleKeyDown:hz,handleDOMEvents:{beforeinput:pz}}})}const hz=C0({ArrowLeft:Ju("horiz",-1),ArrowRight:Ju("horiz",1),ArrowUp:Ju("vert",-1),ArrowDown:Ju("vert",1)});function Ju(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof Xe){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=pn.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new pn(h))),!0):!1}}function fz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!pn.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&Ge.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new pn(r))),!0)}function pz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof pn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=ve.empty;for(let o=r.length-1;o>=0;o--)a=ve.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Re(a,0,0));return i.setSelection(Xe.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function mz(t){if(!(t.selection instanceof pn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",_t.create(t.doc,[An.widget(t.selection.head,e,{key:"gapcursor"})])}var of=200,Wn=function(){};Wn.prototype.append=function(e){return e.length?(e=Wn.from(e),!this.length&&e||e.length=n?Wn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Wn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Wn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Wn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var a=[];return this.forEach(function(i,o){return a.push(e(i,o))},n,r),a};Wn.from=function(e){return e instanceof Wn?e:e&&e.length?new jC(e):Wn.empty};var jC=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,i){return a==0&&i==this.length?this:new e(this.values.slice(a,i))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,i,o,c){for(var u=i;u=o;u--)if(a(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=of)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=of)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Wn);Wn.empty=new jC([]);var gz=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(a-c,0),Math.min(this.length,i)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,i,o){var c=this.left.length;if(a>c&&this.right.forEachInvertedInner(r,a-c,Math.max(i,c)-c,o+c)===!1||i=i?this.right.slice(r-i,a-i):this.left.slice(r,i).append(this.right.slice(0,a-i))},e.prototype.leafAppend=function(r){var a=this.right.leafAppend(r);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(r){var a=this.left.leafPrepend(r);if(a)return new e(a,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Wn);const xz=500;class Cs{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){a||(a=this.remapping(r,g+1),i=a.maps.length),i--,f.push(m);return}if(a){f.push(new ei(m.map));let y=m.step.map(a.slice(i)),N;y&&o.maybeStep(y).doc&&(N=o.mapping.maps[o.mapping.maps.length-1],h.push(new ei(N,void 0,void 0,h.length+f.length))),i--,N&&a.appendMap(N,i)}else o.maybeStep(m.step);if(m.selection)return c=a?m.selection.map(a.slice(i)):m.selection,u=new Cs(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,a){let i=[],o=this.eventCount,c=this.items,u=!a&&c.length?c.get(c.length-1):null;for(let f=0;fbz&&(c=yz(c,h),o-=h),new Cs(c.append(i),o)}remapping(e,n){let r=new od;return this.items.forEach((a,i)=>{let o=a.mirrorOffset!=null&&i-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Cs(this.items.append(e.map(n=>new ei(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},a);let u=n;this.items.forEach(g=>{let y=i.getMirror(--u);if(y==null)return;o=Math.min(o,y);let N=i.maps[y];if(g.step){let j=e.steps[y].invert(e.docs[y]),v=g.selection&&g.selection.map(i.slice(u+1,y));v&&c++,r.push(new ei(N,j,v))}else r.push(new ei(N))},a);let h=[];for(let g=n;gxz&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,a=[],i=0;return this.items.forEach((o,c)=>{if(c>=e)a.push(o),o.selection&&i++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&i++;let m=new ei(h.invert(),u,f),g,y=a.length-1;(g=a.length&&a[y].merge(m))?a[y]=g:a.push(m)}}else o.map&&r--},this.items.length,0),new Cs(Wn.from(a.reverse()),i)}}Cs.empty=new Cs(Wn.empty,0);function yz(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let ei=class kC{constructor(e,n,r,a){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new kC(n.getMap().invert(),n,this.selection)}}};class ai{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const bz=20;function vz(t,e,n,r){let a=n.getMeta(No),i;if(a)return a.historyState;n.getMeta(jz)&&(t=new ai(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(No))return o.getMeta(No).redo?new ai(t.done.addTransform(n,void 0,r,oh(e)),t.undone,HN(n.mapping.maps),t.prevTime,t.prevComposition):new ai(t.done,t.undone.addTransform(n,void 0,r,oh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Nz(n,t.prevRanges)),h=o?xg(t.prevRanges,n.mapping):HN(n.mapping.maps);return new ai(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,oh(e)),Cs.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new ai(t.done.rebased(n,i),t.undone.rebased(n,i),xg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ai(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),xg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Nz(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,a)=>{for(let i=0;i=e[i]&&(n=!0)}),n}function HN(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,a,i,o)=>e.push(i,o));return e}function xg(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=No.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=wz(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const CC=SC(!1,!0),EC=SC(!0,!0);gn.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Wt({key:new tn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const o=i-a,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=i-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var Sz=gn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[oz(this.options)]}});gn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Wt({key:new tn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return _t.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(a>=h&&a<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(a>=h&&a<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";i.push(An.node(h,h+u.nodeSize,{class:this.options.className}))}),_t.create(t,i)}}})]}});var Cz=gn.create({name:"gapCursor",addProseMirrorPlugins(){return[uz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=jt(Ue(t,"allowGapCursor",n)))!=null?e:null}}}),UN="placeholder";function Ez(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Tz=gn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:UN,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${Ez(this.options.dataAttribute)}`:`data-${UN}`;return[new Wt({key:new tn("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,i=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=a>=u&&a<=u+c.nodeSize,f=!c.isLeaf&&Df(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=An.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});i.push(g)}return this.options.includeChildren}),_t.create(e,i)}}})]}});gn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Wt({key:new tn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||I2(n.selection)||t.view.dragging?null:_t.create(n.doc,[An.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function KN({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var Mz=gn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new tn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new Wt({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!KN({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!KN({node:o,types:r})}}})]}}),Az=gn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>CC(t,e),redo:()=>({state:t,dispatch:e})=>EC(t,e)}},addProseMirrorPlugins(){return[kz(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Iz=gn.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(t7.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(Y_.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(hC.configure(this.options.bulletList)),this.options.code!==!1&&a.push(s7.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(o7.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(l7.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(Sz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(Cz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(c7.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(d7.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(Az.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(u7.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(g7.configure(this.options.italic)),this.options.listItem!==!1&&a.push(fC.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(bC.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(B7.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(NC.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(tz.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(sz.configure(this.options.strike)),this.options.text!==!1&&a.push(az.configure(this.options.text)),this.options.underline!==!1&&a.push(iz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(Mz.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),Rz=Iz,Pz=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Oz=Sn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",St(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,i,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",h=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:i,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new _6({element:u,editor:c,node:a,getPos:i,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const y=i();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,y)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[G2({find:Pz,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),Dz=Oz;function Lz(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=$6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=a?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),N=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!N)return null;const j=c.pos-N.length,v=Array.from(N.matchAll(y)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const k=v.input.slice(Math.max(0,v.index-1),v.index),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!E)return null;const C=j+v.index;let T=C+v[0].length;return u&&f.test(N.slice(T-1,T+1))&&(v[0]+=" ",T+=1),C=c.pos?{range:{from:C,to:T},query:v[0].slice(n.length),text:v[0]}:null}var _z=new tn("suggestion");function zz({pluginKey:t=_z,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:y=()=>({}),allow:N=()=>!0,findSuggestionMatch:j=Lz,shouldShow:v}){let k;const E=y==null?void 0:y(),C=()=>{const D=e.state.selection.$anchor.pos,R=e.view.coordsAtPos(D),{top:O,right:_,bottom:re,left:ne}=R;try{return new DOMRect(ne,O,_-ne,re-O)}catch{return null}},T=(D,R)=>R?()=>{const O=t.getState(e.state),_=O==null?void 0:O.decorationId,re=D.dom.querySelector(`[data-decoration-id="${_}"]`);return(re==null?void 0:re.getBoundingClientRect())||null}:C;function P(D,R){var O;try{const re=t.getState(D.state),ne=re!=null&&re.decorationId?D.dom.querySelector(`[data-decoration-id="${re.decorationId}"]`):null,he={editor:e,range:(re==null?void 0:re.range)||{from:0,to:0},query:(re==null?void 0:re.query)||null,text:(re==null?void 0:re.text)||null,items:[],command:xe=>m({editor:e,range:(re==null?void 0:re.range)||{from:0,to:0},props:xe}),decorationNode:ne,clientRect:T(D,ne)};(O=E==null?void 0:E.onExit)==null||O.call(E,he)}catch{}const _=D.state.tr.setMeta(R,{exit:!0});D.dispatch(_)}const F=new Wt({key:t,view(){return{update:async(D,R)=>{var O,_,re,ne,he,xe,z;const U=(O=this.key)==null?void 0:O.getState(R),H=(_=this.key)==null?void 0:_.getState(D.state),I=U.active&&H.active&&U.range.from!==H.range.from,q=!U.active&&H.active,V=U.active&&!H.active,L=!q&&!V&&U.query!==H.query,K=q||I&&L,oe=L||I,Y=V||I&&L;if(!K&&!oe&&!Y)return;const X=Y&&!K?U:H,W=D.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);k={editor:e,range:X.range,query:X.query,text:X.text,items:[],command:se=>m({editor:e,range:X.range,props:se}),decorationNode:W,clientRect:T(D,W)},K&&((re=E==null?void 0:E.onBeforeStart)==null||re.call(E,k)),oe&&((ne=E==null?void 0:E.onBeforeUpdate)==null||ne.call(E,k)),(oe||K)&&(k.items=await g({editor:e,query:X.query})),Y&&((he=E==null?void 0:E.onExit)==null||he.call(E,k)),oe&&((xe=E==null?void 0:E.onUpdate)==null||xe.call(E,k)),K&&((z=E==null?void 0:E.onStart)==null||z.call(E,k))},destroy:()=>{var D;k&&((D=E==null?void 0:E.onExit)==null||D.call(E,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(D,R,O,_){const{isEditable:re}=e,{composing:ne}=e.view,{selection:he}=D,{empty:xe,from:z}=he,U={...R},H=D.getMeta(t);if(H&&H.exit)return U.active=!1,U.decorationId=null,U.range={from:0,to:0},U.query=null,U.text=null,U;if(U.composing=ne,re&&(xe||e.view.composing)){(zR.range.to)&&!ne&&!R.composing&&(U.active=!1);const I=j({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:he.$from}),q=`id_${Math.floor(Math.random()*4294967295)}`;I&&N({editor:e,state:_,range:I.range,isActive:R.active})&&(!v||v({editor:e,range:I.range,query:I.query,text:I.text,transaction:D}))?(U.active=!0,U.decorationId=R.decorationId?R.decorationId:q,U.range=I.range,U.query=I.query,U.text=I.text):U.active=!1}else U.active=!1;return U.active||(U.decorationId=null,U.range={from:0,to:0},U.query=null,U.text=null),U}},props:{handleKeyDown(D,R){var O,_,re,ne;const{active:he,range:xe}=F.getState(D.state);if(!he)return!1;if(R.key==="Escape"||R.key==="Esc"){const U=F.getState(D.state),H=(O=k==null?void 0:k.decorationNode)!=null?O:null,I=H??(U!=null&&U.decorationId?D.dom.querySelector(`[data-decoration-id="${U.decorationId}"]`):null);if(((_=E==null?void 0:E.onKeyDown)==null?void 0:_.call(E,{view:D,event:R,range:U.range}))||!1)return!0;const V={editor:e,range:U.range,query:U.query,text:U.text,items:[],command:L=>m({editor:e,range:U.range,props:L}),decorationNode:I,clientRect:I?()=>I.getBoundingClientRect()||null:null};return(re=E==null?void 0:E.onExit)==null||re.call(E,V),P(D,t),!0}return((ne=E==null?void 0:E.onKeyDown)==null?void 0:ne.call(E,{view:D,event:R,range:xe}))||!1},decorations(D){const{active:R,range:O,decorationId:_,query:re}=F.getState(D);if(!R)return null;const ne=!(re!=null&&re.length),he=[u];return ne&&he.push(f),_t.create(D.doc,[An.inline(O.from,O.to,{nodeName:c,class:he.join(" "),"data-decoration-id":_,"data-decoration-content":h})])}}});return F}function $z({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new tn;return{editor:t,char:r,pluginKey:a,command:({editor:i,range:o,props:c})=>{var u,h,f;const m=i.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=i.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:i,range:o})=>{const c=i.doc.resolve(o.from),u=i.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function TC(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>$z({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function qN(t,e){const n=TC(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var Fz=Sn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,a;return["span",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(a=e.attrs.label)!=null?a:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=qN(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...J2({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r,c=i??o;e[a==="char"?"mentionSuggestionChar":a]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:qN(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:a,anchor:i}=r;if(!a)return!1;let o=new Ma,c=0;return e.doc.nodesBetween(i-1,i,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return TC(this).map(zz)}}),Bz=Fz,Vz=Tz;let jx,kx;if(typeof WeakMap<"u"){let t=new WeakMap;jx=e=>t.get(e),kx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;jx=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var mn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:k-C});break}const T=a+C*e;for(let P=0;Pr&&(i+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Uz(t,e,n){t.problems||(t.problems=[]);const r={};for(let a=0;a0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function qz(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Rs(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function $f(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Ao(e.$head)||Gz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Gz(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Sx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Jz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function J0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function MC(t,e,n){const r=t.node(-1),a=mn.get(r),i=t.start(-1),o=a.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function Io(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(a=>a>0)||(r.colwidth=null)),r}function AC(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let a=0;af!=n.pos-i);u.unshift(n.pos-i);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i+f+1;return new bS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(Sx(r)&&Sx(a)&&J0(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ka.rowSelection(r,a):i&&this.isColSelection()?ka.colSelection(r,a):new ka(r,a)}return Xe.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=mn.get(e),r=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=a.top;u0||v>0){let k=N.attrs;if(j>0&&(k=Io(k,0,j)),v>0&&(k=Io(k,k.colspan-v,v)),y.lefta.bottom){const k={...N.attrs,rowspan:Math.min(y.bottom,a.bottom)-Math.max(y.top,a.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),a=mn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(i+a.map[o.left])),c.bottom0&&(n=u.resolve(i+a.map[c.left])),o.bottom0)return!1;const o=a+this.$anchorCell.nodeAfter.attrs.colspan,c=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof ka&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=mn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(i+a.map[o.top*a.width])),c.right0&&(n=u.resolve(i+a.map[c.top*a.width])),o.right{e.push(An.node(r,r+n.nodeSize,{class:"selectedCell"}))}),_t.create(t.doc,e)}function Zz({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(a+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(a).type.spec.tableRole)}function e$({$from:t,$to:e}){let n,r;for(let a=t.depth;a>0;a--){const i=t.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let a=e.depth;a>0;a--){const i=e.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function t$(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof Ge&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=Ht.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=Ht.rowSelection(c,c)}else if(!n){const c=mn.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=Ht.create(a,u+1,h)}}else r instanceof Xe&&Zz(r)?i=Xe.create(a,r.from):r instanceof Xe&&e$(r)&&(i=Xe.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const n$=new tn("fix-tables");function RC(t,e,n,r){const a=t.childCount,i=e.childCount;e:for(let o=0,c=0;o{a.type.spec.tableRole=="table"&&(n=r$(t,a,i,n))};return e?e.doc!=t.doc&&RC(e.doc,t.doc,0,r):t.doc.descendants(r),n}function r$(t,e,n,r){const a=mn.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let y="cell";f.firstChild&&(y=f.firstChild.type.spec.tableRole);const N=[];for(let v=0;v0?-1:0;Yz(e,r,a+i)&&(i=a==0||a==e.width?null:0);for(let o=0;o0&&a0&&e.map[c-1]==u||a0?-1:0;l$(e,r,a+c)&&(c=a==0||a==e.height?null:0);for(let h=0,f=e.width*a;h0&&a0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(a0&&n[i]==n[i-1]||r.right0&&n[a]==n[a-t]||r.bottom0){const f=u+1+h.content.size,m=GN(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new Ht(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function YN(t,e){const n=mr(t.schema);return p$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function p$(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof Ht){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=qz(r.$from),!a)return!1;i=(o=Ao(r.$from))===null||o===void 0?void 0:o.pos}if(a==null||i==null||a.attrs.colspan==1&&a.attrs.rowspan==1)return!1;if(n){let c=a.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Qs(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&i.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function g$(t){return function(e,n){if(!Rs(e))return!1;if(n){const r=mr(e.schema),a=Qs(e),i=e.tr,o=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),c=o.map(u=>a.table.nodeAt(u));for(let u=0;u{const y=g+i.tableStart,N=o.doc.nodeAt(y);N&&o.setNodeMarkup(y,m,N.attrs)}),r(o)}return!0}}gd("row",{useDeprecatedLogic:!0});gd("column",{useDeprecatedLogic:!0});const x$=gd("cell",{useDeprecatedLogic:!0});function y$(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,a=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return a-1-o.nodeSize;a-=i.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Yu(t,e){const n=t.selection;if(!(n instanceof Ht))return!1;if(e){const r=t.tr,a=mr(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(a)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new Re(a,0,0))}),r.docChanged&&e(r)}return!0}function v$(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const a=e.child(0),i=a.type.spec.tableRole,o=a.type.schema,c=[];if(i=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=i.child(o).attrs;for(let h=a;h=e.length&&e.push(ve.empty),n[a]r&&(g=g.type.createChecked(Io(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;ya&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(ve.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function j$(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=mr(c);let h,f;if(a>e.width)for(let m=0,g=0;me.height){const m=[];for(let N=0,j=(e.height-1)*e.width;N=e.width?!1:n.nodeAt(e.map[j+N]).type==u.header_cell;m.push(v?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,ve.from(m)),y=[];for(let N=e.height;N{if(!a)return!1;const i=n.selection;if(i instanceof Ht)return lh(n,r,nt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=LC(a,t,e);if(o==null)return!1;if(t=="horiz")return lh(n,r,nt.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=MC(c,t,e);let h;return u?h=nt.near(u,1):e<0?h=nt.near(n.doc.resolve(c.before(-1)),-1):h=nt.near(n.doc.resolve(c.after(-1)),1),lh(n,r,h)}}}function Xu(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof Ht)o=i;else{const u=LC(a,t,e);if(u==null)return!1;o=new Ht(n.doc.resolve(u))}const c=MC(o.$headCell,t,e);return c?lh(n,r,new Ht(o.$anchorCell,c)):!1}}function S$(t,e){const n=t.state.doc,r=Ao(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ht(r))),!0):!1}function C$(t,e,n){if(!Rs(t.state))return!1;let r=v$(n);const a=t.state.selection;if(a instanceof Ht){r||(r={width:1,height:1,rows:[ve.from(Cx(mr(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=mn.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=w$(r,c.right-c.left,c.bottom-c.top),tw(t.state,t.dispatch,o,c,r),!0}else if(r){const i=$f(t.state),o=i.start(-1);return tw(t.state,t.dispatch,o,mn.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function E$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=nw(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof Ht)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=Ao(t.state.selection.$anchor))!=null&&((n=bg(t,e))===null||n===void 0?void 0:n.pos)!=a.pos)i(a,e),e.preventDefault();else if(!r)return;function i(u,h){let f=bg(t,h);const m=li.getState(t.state)==null;if(!f||!J0(u,f))if(m)f=u;else return;const g=new Ht(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(li,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),li.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(li,-1))}function c(u){const h=u,f=li.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(nw(t,h.target)!=r&&(m=bg(t,e),!m))return o();m&&i(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function LC(t,e,n){if(!(t.state.selection instanceof Xe))return null;const{$head:r}=t.state.selection;for(let a=r.depth-1;a>=0;a--){const i=r.node(a);if((n<0?r.index(a):r.indexAfter(a))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(a),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function nw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function bg(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:a}=n;return r>=0&&Ao(t.state.doc.resolve(r))||Ao(t.state.doc.resolve(a))}var T$=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ex(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Ex(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Ex(t,e,n,r,a,i){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new A$(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=Hr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{I$(o,c,t,a)},mouseleave:o=>{R$(o)},mousedown:(o,c)=>{P$(o,c,e,n)}},decorations:o=>{const c=Hr.getState(o);if(c&&c.activeHandle>-1)return z$(o,c.activeHandle)},nodeViews:{}}});return i}var A$=class ch{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Hr);if(r&&r.setHandle!=null)return new ch(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ch(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return Sx(e.doc.resolve(a))||(a=-1),new ch(a,n.dragging)}return n}};function I$(t,e,n,r){if(!t.editable)return;const a=Hr.getState(t.state);if(a&&!a.dragging){const i=D$(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=rw(t,e,"left",n):u-e.clientX<=n&&(o=rw(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=mn.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}_C(t,o)}}}function R$(t){if(!t.editable)return;const e=Hr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&_C(t,-1)}function P$(t,e,n,r){var a;if(!t.editable)return!1;const i=(a=t.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,o=Hr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=O$(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Hr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const g=Hr.getState(t.state);g!=null&&g.dragging&&(L$(t,g.activeHandle,sw(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Hr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=Hr.getState(t.state);if(g&&g.dragging){const y=sw(g.dragging,m,n);aw(t,g.activeHandle,y,r)}}return aw(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function O$(t,e,{colspan:n,colwidth:r}){const a=r&&r[r.length-1];if(a)return a;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),a=r?r.split(",").map(i=>parseInt(i,10)):null;if(!a){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const c=i[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return a}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",St(this.options.HTMLAttributes,t),0]}}),$C=Sn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",St(this.options.HTMLAttributes,t),0]}}),FC=Sn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}});function Tx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function iw(t,e,n,r,a,i){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,y=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function H$(t,e,n,r,a){const i=V$(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!W$(e))return!1;let n=0;const r=j2(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},U$="";function K$(t){return(t||"").replace(/\s+/g," ").trim()}function q$(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:U$;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(N=>{const j=[];N.content&&N.content.forEach(v=>{let k="";v.content&&Array.isArray(v.content)&&v.content.length>1?k=v.content.map(P=>e.renderChildren(P)).join(a):k=v.content?e.renderChildren(v.content):"";const E=K$(k),C=v.type==="tableHeader";j.push({text:E,isHeader:C})}),i.push(j)});const o=i.reduce((N,j)=>Math.max(N,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(N=>{var j;for(let v=0;vc[v]&&(c[v]=E),c[v]<3&&(c[v]=3)}});const u=(N,j)=>N+" ".repeat(Math.max(0,j-N.length)),h=i[0],f=h.some(N=>N.isHeader);let m=` +`;const g=new Array(o).fill(0).map((N,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((N,j)=>u(N,c[j])).join(" | ")} | +`,m+=`| ${c.map(N=>"-".repeat(Math.max(3,N))).join(" | ")} | +`,(f?i.slice(1):i).forEach(N=>{m+=`| ${new Array(o).fill(0).map((j,v)=>u(N[v]&&N[v].text||"",c[v])).join(" | ")} | +`}),m}var G$=q$,BC=Sn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:F$,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:a}=B$(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",St(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(a=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const a=[];r.forEach(i=>{a.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},a))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>G$(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=H$(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Xe.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>s$(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>a$(t,e),deleteColumn:()=>({state:t,dispatch:e})=>o$(t,e),addRowBefore:()=>({state:t,dispatch:e})=>c$(t,e),addRowAfter:()=>({state:t,dispatch:e})=>d$(t,e),deleteRow:()=>({state:t,dispatch:e})=>h$(t,e),deleteTable:()=>({state:t,dispatch:e})=>b$(t,e),mergeCells:()=>({state:t,dispatch:e})=>JN(t,e),splitCell:()=>({state:t,dispatch:e})=>YN(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>gd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>gd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>x$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>JN(t,e)?!0:YN(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>m$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>XN(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>XN(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&PC(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Ht.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Zu,"Mod-Backspace":Zu,Delete:Zu,"Mod-Delete":Zu}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[M$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],$$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:jt(Ue(t,"tableRole",e))}}});gn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(BC.configure(this.options.table)),this.options.tableCell!==!1&&t.push(zC.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push($C.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(FC.configure(this.options.tableRow)),t}});function J$(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 + +`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 + +`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 + +`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 + +`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 +`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` +`),e=e.replace(//gi,` +`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 + +`),e=e.replace(//gi,`--- + +`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` + +`),e.trim()}function lw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),e=e.replace(/^## (.+)$/gm,"

    $1

    "),e=e.replace(/^# (.+)$/gm,"

    $1

    "),e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/\*(.+?)\*/g,"$1"),e=e.replace(/~~(.+?)~~/g,"$1"),e=e.replace(/`([^`]+)`/g,"$1"),e=e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'$1'),e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1'),e=e.replace(/^> (.+)$/gm,"

    $1

    "),e=e.replace(/^---$/gm,"
    "),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` +`),r=[];for(const a of n){const i=a.trim();i&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(i)?r.push(i):r.push(`

    ${i}

    `))}return r.join("")}const Y$=Sn.create({name:"linkTag",group:"inline",inline:!0,selectable:!0,atom:!0,addAttributes(){return{label:{default:""},url:{default:""},tagType:{default:"url",parseHTML:t=>t.getAttribute("data-tag-type")||"url"},tagId:{default:"",parseHTML:t=>t.getAttribute("data-tag-id")||""},pagePath:{default:"",parseHTML:t=>t.getAttribute("data-page-path")||""},appId:{default:"",parseHTML:t=>t.getAttribute("data-app-id")||""},mpKey:{default:"",parseHTML:t=>t.getAttribute("data-mp-key")||""}}},parseHTML(){return[{tag:'span[data-type="linkTag"]',getAttrs:t=>{var e;return{label:((e=t.textContent)==null?void 0:e.replace(/^#/,"").trim())||"",url:t.getAttribute("data-url")||"",tagType:t.getAttribute("data-tag-type")||"url",tagId:t.getAttribute("data-tag-id")||"",pagePath:t.getAttribute("data-page-path")||"",appId:t.getAttribute("data-app-id")||"",mpKey:t.getAttribute("data-mp-key")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",St(e,{"data-type":"linkTag","data-url":t.attrs.url,"data-tag-type":t.attrs.tagType,"data-tag-id":t.attrs.tagId,"data-page-path":t.attrs.pagePath,"data-app-id":t.attrs.appId||"","data-mp-key":t.attrs.mpKey||t.attrs.appId||"",class:"link-tag-node"}),`#${t.attrs.label}`]}});function cw(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}const Q$=t=>({items:({query:e})=>t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase())||n.id.includes(e)).slice(0,8),render:()=>{let e=null,n=0,r=[],a=null;const i=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    + @${cw(o.name)} + ${cw(o.label||o.id)} +
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");a&&r[c]&&a({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,a=o.command,n=0,i(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,a=o.command,n=0,i(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),i(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),i(),!0):o.event.key==="Enter"?(a&&r[n]&&a({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}});function X$(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let a=0;a{const u=b.useRef(null),h=b.useRef(null),[f,m]=b.useState(""),[g,y]=b.useState(!1),N=b.useRef(lw(t)),j=b.useCallback((T,P)=>{var O;const F=h.current;if(!F||!n)return!1;const D=X$(P);if(D.length>0)return P.preventDefault(),(async()=>{for(const _ of D)try{const re=await n(_);re&&F.chain().focus().setImage({src:re}).run()}catch(re){console.error("粘贴图片上传失败",re)}})(),!0;const R=(O=P.clipboardData)==null?void 0:O.getData("text/html");if(R&&/data:image\/[^;"']+;base64,/i.test(R)){P.preventDefault();const{from:_,to:re}=F.state.selection;return(async()=>{try{const ne=await tF(R,n);F.chain().focus().insertContentAt({from:_,to:re},ne).run()}catch(ne){console.error("粘贴 HTML 内 base64 转换失败",ne)}})(),!0}return!1},[n]),v=U_({extensions:[Rz.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),Dz.configure({inline:!0,allowBase64:!0}),Bz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:Q$(r)}),Y$,Vz.configure({placeholder:i}),BC.configure({resizable:!0}),FC,zC,$C],content:N.current,onUpdate:({editor:T})=>{e(T.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:j}});b.useEffect(()=>{h.current=v??null},[v]),b.useImperativeHandle(c,()=>({getHTML:()=>(v==null?void 0:v.getHTML())||"",getMarkdown:()=>J$((v==null?void 0:v.getHTML())||"")})),b.useEffect(()=>{if(v&&t!==v.getHTML()){const T=lw(t);T!==v.getHTML()&&v.commands.setContent(T)}},[t]);const k=b.useCallback(async T=>{var F;const P=(F=T.target.files)==null?void 0:F[0];if(!(!P||!v)){if(n){const D=await n(P);D&&v.chain().focus().setImage({src:D}).run()}else{const D=new FileReader;D.onload=()=>{typeof D.result=="string"&&v.chain().focus().setImage({src:D.result}).run()},D.readAsDataURL(P)}T.target.value=""}},[v,n]),E=b.useCallback(T=>{v&&v.chain().focus().insertContent({type:"linkTag",attrs:{label:T.label,url:T.url||"",tagType:T.type||"url",tagId:T.id||"",pagePath:T.pagePath||"",appId:T.appId||"",mpKey:T.type==="miniprogram"&&T.appId||""}}).run()},[v]),C=b.useCallback(()=>{!v||!f||(v.chain().focus().setLink({href:f}).run(),m(""),y(!1))},[v,f]);return v?s.jsxs("div",{className:`rich-editor-wrapper ${o||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"is-active":"",type:"button",children:s.jsx(HT,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"is-active":"",type:"button",children:s.jsx(VM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleStrike().run(),className:v.isActive("strike")?"is-active":"",type:"button",children:s.jsx(zA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"is-active":"",type:"button",children:s.jsx(cM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(RM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(OM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(LM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(QM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(JM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(jA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(lA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:k,className:"hidden"}),s.jsx("button",{onClick:()=>{var T;return(T=u.current)==null?void 0:T.click()},type:"button",children:s.jsx(ej,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>y(!g),className:v.isActive("link")?"is-active":"",type:"button",children:s.jsx(Dg,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:s.jsx(FA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:s.jsx(qA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:s.jsx(SA,{className:"w-4 h-4"})})]}),a.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"toolbar-divider"}),s.jsx("div",{className:"toolbar-group",children:s.jsxs("select",{className:"link-tag-select",onChange:T=>{const P=a.find(F=>F.id===T.target.value);P&&E(P),T.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),a.map(T=>s.jsx("option",{value:T.id,children:T.label},T.id))]})})]})]}),g&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:f,onChange:T=>m(T.target.value),onKeyDown:T=>T.key==="Enter"&&C(),className:"link-input"}),s.jsx("button",{onClick:C,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{v.chain().focus().unsetLink().run(),y(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(X2,{editor:v})]}):null});Mx.displayName="RichEditor";const nF=["top","right","bottom","left"],ki=Math.min,Br=Math.max,lf=Math.round,eh=Math.floor,qs=t=>({x:t,y:t}),rF={left:"right",right:"left",bottom:"top",top:"bottom"},sF={start:"end",end:"start"};function Ax(t,e,n){return Br(t,ki(e,n))}function Pa(t,e){return typeof t=="function"?t(e):t}function Oa(t){return t.split("-")[0]}function Kl(t){return t.split("-")[1]}function Y0(t){return t==="x"?"y":"x"}function Q0(t){return t==="y"?"height":"width"}const aF=new Set(["top","bottom"]);function Ks(t){return aF.has(Oa(t))?"y":"x"}function X0(t){return Y0(Ks(t))}function iF(t,e,n){n===void 0&&(n=!1);const r=Kl(t),a=X0(t),i=Q0(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=cf(o)),[o,cf(o)]}function oF(t){const e=cf(t);return[Ix(t),e,Ix(e)]}function Ix(t){return t.replace(/start|end/g,e=>sF[e])}const dw=["left","right"],uw=["right","left"],lF=["top","bottom"],cF=["bottom","top"];function dF(t,e,n){switch(t){case"top":case"bottom":return n?e?uw:dw:e?dw:uw;case"left":case"right":return e?lF:cF;default:return[]}}function uF(t,e,n,r){const a=Kl(t);let i=dF(Oa(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(Ix)))),i}function cf(t){return t.replace(/left|right|bottom|top/g,e=>rF[e])}function hF(t){return{top:0,right:0,bottom:0,left:0,...t}}function VC(t){return typeof t!="number"?hF(t):{top:t,right:t,bottom:t,left:t}}function df(t){const{x:e,y:n,width:r,height:a}=t;return{width:r,height:a,top:n,left:e,right:e+r,bottom:n+a,x:e,y:n}}function hw(t,e,n){let{reference:r,floating:a}=t;const i=Ks(e),o=X0(e),c=Q0(o),u=Oa(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=r[c]/2-a[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-a.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-a.width,y:m};break;default:y={x:r.x,y:r.y}}switch(Kl(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function fF(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:i,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Pa(e,t),N=VC(y),v=c[g?m==="floating"?"reference":"floating":m],k=df(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),E=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),T=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},P=df(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-P.top+N.top)/T.y,bottom:(P.bottom-k.bottom+N.bottom)/T.y,left:(k.left-P.left+N.left)/T.x,right:(P.right-k.right+N.right)/T.x}}const pF=async(t,e,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,c=i.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:a}),{x:f,y:m}=hw(h,r,u),g=r,y={},N=0;for(let v=0;v({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Pa(t,e)||{};if(h==null)return{};const m=VC(f),g={x:n,y:r},y=X0(a),N=Q0(y),j=await o.getDimensions(h),v=y==="y",k=v?"top":"left",E=v?"bottom":"right",C=v?"clientHeight":"clientWidth",T=i.reference[N]+i.reference[y]-g[y]-i.floating[N],P=g[y]-i.reference[y],F=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let D=F?F[C]:0;(!D||!await(o.isElement==null?void 0:o.isElement(F)))&&(D=c.floating[C]||i.floating[N]);const R=T/2-P/2,O=D/2-j[N]/2-1,_=ki(m[k],O),re=ki(m[E],O),ne=_,he=D-j[N]-re,xe=D/2-j[N]/2+R,z=Ax(ne,xe,he),U=!u.arrow&&Kl(a)!=null&&xe!==z&&i.reference[N]/2-(xexe<=0)){var re,ne;const xe=(((re=i.flip)==null?void 0:re.index)||0)+1,z=D[xe];if(z&&(!(m==="alignment"?E!==Ks(z):!1)||_.every(I=>Ks(I.placement)===E?I.overflows[0]>0:!0)))return{data:{index:xe,overflows:_},reset:{placement:z}};let U=(ne=_.filter(H=>H.overflows[0]<=0).sort((H,I)=>H.overflows[1]-I.overflows[1])[0])==null?void 0:ne.placement;if(!U)switch(y){case"bestFit":{var he;const H=(he=_.filter(I=>{if(F){const q=Ks(I.placement);return q===E||q==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(q=>q>0).reduce((q,V)=>q+V,0)]).sort((I,q)=>I[1]-q[1])[0])==null?void 0:he[0];H&&(U=H);break}case"initialPlacement":U=c;break}if(a!==U)return{reset:{placement:U}}}return{}}}};function fw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function pw(t){return nF.some(e=>t[e]>=0)}const xF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Pa(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=fw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:pw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=fw(o,n.floating);return{data:{escapedOffsets:c,escaped:pw(c)}}}default:return{}}}}},HC=new Set(["left","top"]);async function yF(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Oa(n),c=Kl(n),u=Ks(n)==="y",h=HC.has(o)?-1:1,f=i&&u?-1:1,m=Pa(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:N}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof N=="number"&&(y=c==="end"?N*-1:N),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const bF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:a,y:i,placement:o,middlewareData:c}=e,u=await yF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:a+u.x,y:i+u.y,data:{...u,placement:o}}}}},vF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a,platform:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:E,y:C}=k;return{x:E,y:C}}},...h}=Pa(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=Ks(Oa(a)),y=Y0(g);let N=f[y],j=f[g];if(o){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",C=N+m[k],T=N-m[E];N=Ax(C,N,T)}if(c){const k=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=j+m[k],T=j-m[E];j=Ax(C,j,T)}const v=u.fn({...e,[y]:N,[g]:j});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[y]:o,[g]:c}}}}}},NF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:a,rects:i,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Pa(t,e),f={x:n,y:r},m=Ks(a),g=Y0(m);let y=f[g],N=f[m];const j=Pa(c,e),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",T=i.reference[g]-i.floating[C]+v.mainAxis,P=i.reference[g]+i.reference[C]-v.mainAxis;yP&&(y=P)}if(h){var k,E;const C=g==="y"?"width":"height",T=HC.has(Oa(a)),P=i.reference[m]-i.floating[C]+(T&&((k=o.offset)==null?void 0:k[m])||0)+(T?0:v.crossAxis),F=i.reference[m]+i.reference[C]+(T?0:((E=o.offset)==null?void 0:E[m])||0)-(T?v.crossAxis:0);NF&&(N=F)}return{[g]:y,[m]:N}}}},wF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:a,rects:i,platform:o,elements:c}=e,{apply:u=()=>{},...h}=Pa(t,e),f=await o.detectOverflow(e,h),m=Oa(a),g=Kl(a),y=Ks(a)==="y",{width:N,height:j}=i.floating;let v,k;m==="top"||m==="bottom"?(v=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,v=g==="end"?"top":"bottom");const E=j-f.top-f.bottom,C=N-f.left-f.right,T=ki(j-f[v],E),P=ki(N-f[k],C),F=!e.middlewareData.shift;let D=T,R=P;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(D=E),F&&!g){const _=Br(f.left,0),re=Br(f.right,0),ne=Br(f.top,0),he=Br(f.bottom,0);y?R=N-2*(_!==0||re!==0?_+re:Br(f.left,f.right)):D=j-2*(ne!==0||he!==0?ne+he:Br(f.top,f.bottom))}await u({...e,availableWidth:R,availableHeight:D});const O=await o.getDimensions(c.floating);return N!==O.width||j!==O.height?{reset:{rects:!0}}:{}}}};function Ff(){return typeof window<"u"}function ql(t){return WC(t)?(t.nodeName||"").toLowerCase():"#document"}function Kr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Xs(t){var e;return(e=(WC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function WC(t){return Ff()?t instanceof Node||t instanceof Kr(t).Node:!1}function Ms(t){return Ff()?t instanceof Element||t instanceof Kr(t).Element:!1}function Ys(t){return Ff()?t instanceof HTMLElement||t instanceof Kr(t).HTMLElement:!1}function mw(t){return!Ff()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Kr(t).ShadowRoot}const jF=new Set(["inline","contents"]);function Td(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=As(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!jF.has(a)}const kF=new Set(["table","td","th"]);function SF(t){return kF.has(ql(t))}const CF=[":popover-open",":modal"];function Bf(t){return CF.some(e=>{try{return t.matches(e)}catch{return!1}})}const EF=["transform","translate","scale","rotate","perspective"],TF=["transform","translate","scale","rotate","perspective","filter"],MF=["paint","layout","strict","content"];function Z0(t){const e=ey(),n=Ms(t)?As(t):t;return EF.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||TF.some(r=>(n.willChange||"").includes(r))||MF.some(r=>(n.contain||"").includes(r))}function AF(t){let e=Si(t);for(;Ys(e)&&!_l(e);){if(Z0(e))return e;if(Bf(e))return null;e=Si(e)}return null}function ey(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const IF=new Set(["html","body","#document"]);function _l(t){return IF.has(ql(t))}function As(t){return Kr(t).getComputedStyle(t)}function Vf(t){return Ms(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Si(t){if(ql(t)==="html")return t;const e=t.assignedSlot||t.parentNode||mw(t)&&t.host||Xs(t);return mw(e)?e.host:e}function UC(t){const e=Si(t);return _l(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ys(e)&&Td(e)?e:UC(e)}function xd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=UC(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Kr(a);if(i){const c=Rx(o);return e.concat(o,o.visualViewport||[],Td(a)?a:[],c&&n?xd(c):[])}return e.concat(a,xd(a,[],n))}function Rx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function KC(t){const e=As(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Ys(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=lf(n)!==i||lf(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function ty(t){return Ms(t)?t:t.contextElement}function El(t){const e=ty(t);if(!Ys(e))return qs(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=KC(e);let o=(i?lf(n.width):n.width)/r,c=(i?lf(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const RF=qs(0);function qC(t){const e=Kr(t);return!ey()||!e.visualViewport?RF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function PF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Kr(t)?!1:e}function Ro(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=ty(t);let o=qs(1);e&&(r?Ms(r)&&(o=El(r)):o=El(t));const c=PF(i,n,r)?qC(i):qs(0);let u=(a.left+c.x)/o.x,h=(a.top+c.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=Kr(i),y=r&&Ms(r)?Kr(r):r;let N=g,j=Rx(N);for(;j&&r&&y!==N;){const v=El(j),k=j.getBoundingClientRect(),E=As(j),C=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*v.x,T=k.top+(j.clientTop+parseFloat(E.paddingTop))*v.y;u*=v.x,h*=v.y,f*=v.x,m*=v.y,u+=C,h+=T,N=Kr(j),j=Rx(N)}}return df({width:f,height:m,x:u,y:h})}function Hf(t,e){const n=Vf(t).scrollLeft;return e?e.left+n:Ro(Xs(t)).left+n}function GC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Hf(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function OF(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Xs(r),c=e?Bf(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=qs(1);const f=qs(0),m=Ys(r);if((m||!m&&!i)&&((ql(r)!=="body"||Td(o))&&(u=Vf(r)),Ys(r))){const y=Ro(r);h=El(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!i?GC(o,u):qs(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function DF(t){return Array.from(t.getClientRects())}function LF(t){const e=Xs(t),n=Vf(t),r=t.ownerDocument.body,a=Br(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Br(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Hf(t);const c=-n.scrollTop;return As(r).direction==="rtl"&&(o+=Br(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const gw=25;function _F(t,e){const n=Kr(t),r=Xs(t),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,c=0,u=0;if(a){i=a.width,o=a.height;const f=ey();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=Hf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,N=Math.abs(r.clientWidth-m.clientWidth-y);N<=gw&&(i-=N)}else h<=gw&&(i+=h);return{width:i,height:o,x:c,y:u}}const zF=new Set(["absolute","fixed"]);function $F(t,e){const n=Ro(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Ys(t)?El(t):qs(1),o=t.clientWidth*i.x,c=t.clientHeight*i.y,u=a*i.x,h=r*i.y;return{width:o,height:c,x:u,y:h}}function xw(t,e,n){let r;if(e==="viewport")r=_F(t,n);else if(e==="document")r=LF(Xs(t));else if(Ms(e))r=$F(e,n);else{const a=qC(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return df(r)}function JC(t,e){const n=Si(t);return n===e||!Ms(n)||_l(n)?!1:As(n).position==="fixed"||JC(n,e)}function FF(t,e){const n=e.get(t);if(n)return n;let r=xd(t,[],!1).filter(c=>Ms(c)&&ql(c)!=="body"),a=null;const i=As(t).position==="fixed";let o=i?Si(t):t;for(;Ms(o)&&!_l(o);){const c=As(o),u=Z0(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&zF.has(a.position)||Td(o)&&!u&&JC(t,o))?r=r.filter(f=>f!==o):a=c,o=Si(o)}return e.set(t,r),r}function BF(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Bf(e)?[]:FF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=xw(e,f,a);return h.top=Br(m.top,h.top),h.right=ki(m.right,h.right),h.bottom=ki(m.bottom,h.bottom),h.left=Br(m.left,h.left),h},xw(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function VF(t){const{width:e,height:n}=KC(t);return{width:e,height:n}}function HF(t,e,n){const r=Ys(e),a=Xs(e),i=n==="fixed",o=Ro(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=qs(0);function h(){u.x=Hf(a)}if(r||!r&&!i)if((ql(e)!=="body"||Td(a))&&(c=Vf(e)),r){const y=Ro(e,!0,i,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else a&&h();i&&!r&&a&&h();const f=a&&!r&&!i?GC(a,c):qs(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function vg(t){return As(t).position==="static"}function yw(t,e){if(!Ys(t)||As(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Xs(t)===n&&(n=n.ownerDocument.body),n}function YC(t,e){const n=Kr(t);if(Bf(t))return n;if(!Ys(t)){let a=Si(t);for(;a&&!_l(a);){if(Ms(a)&&!vg(a))return a;a=Si(a)}return n}let r=yw(t,e);for(;r&&SF(r)&&vg(r);)r=yw(r,e);return r&&_l(r)&&vg(r)&&!Z0(r)?n:r||AF(t)||n}const WF=async function(t){const e=this.getOffsetParent||YC,n=this.getDimensions,r=await n(t.floating);return{reference:HF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function UF(t){return As(t).direction==="rtl"}const KF={convertOffsetParentRelativeRectToViewportRelativeRect:OF,getDocumentElement:Xs,getClippingRect:BF,getOffsetParent:YC,getElementRects:WF,getClientRects:DF,getDimensions:VF,getScale:El,isElement:Ms,isRTL:UF};function QC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function qF(t,e){let n=null,r;const a=Xs(t);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const N=eh(m),j=eh(a.clientWidth-(f+g)),v=eh(a.clientHeight-(m+y)),k=eh(f),C={rootMargin:-N+"px "+-j+"px "+-v+"px "+-k+"px",threshold:Br(0,ki(1,u))||1};let T=!0;function P(F){const D=F[0].intersectionRatio;if(D!==u){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!QC(h,t.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(P,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(P,C)}n.observe(t)}return o(!0),i}function GF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=ty(t),f=a||i?[...h?xd(h):[],...xd(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?qF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[E]=k;E&&E.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let N,j=u?Ro(t):null;u&&v();function v(){const k=Ro(t);j&&!QC(j,k)&&n(),j=k,N=requestAnimationFrame(v)}return n(),()=>{var k;f.forEach(E=>{a&&E.removeEventListener("scroll",n),i&&E.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(N)}}const JF=bF,YF=vF,QF=gF,XF=wF,ZF=xF,bw=mF,eB=NF,tB=(t,e,n)=>{const r=new Map,a={platform:KF,...n},i={...a.platform,_c:r};return pF(t,e,{...a,platform:i})};var nB=typeof document<"u",rB=function(){},dh=nB?b.useLayoutEffect:rB;function uf(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!uf(t[r],e[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&t.$$typeof)&&!uf(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function XC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function vw(t,e){const n=XC(t);return Math.round(e*n)/n}function Ng(t){const e=b.useRef(t);return dh(()=>{e.current=t}),e}function sB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);uf(g,r)||y(r);const[N,j]=b.useState(null),[v,k]=b.useState(null),E=b.useCallback(I=>{I!==F.current&&(F.current=I,j(I))},[]),C=b.useCallback(I=>{I!==D.current&&(D.current=I,k(I))},[]),T=i||N,P=o||v,F=b.useRef(null),D=b.useRef(null),R=b.useRef(f),O=u!=null,_=Ng(u),re=Ng(a),ne=Ng(h),he=b.useCallback(()=>{if(!F.current||!D.current)return;const I={placement:e,strategy:n,middleware:g};re.current&&(I.platform=re.current),tB(F.current,D.current,I).then(q=>{const V={...q,isPositioned:ne.current!==!1};xe.current&&!uf(R.current,V)&&(R.current=V,bd.flushSync(()=>{m(V)}))})},[g,e,n,re,ne]);dh(()=>{h===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,m(I=>({...I,isPositioned:!1})))},[h]);const xe=b.useRef(!1);dh(()=>(xe.current=!0,()=>{xe.current=!1}),[]),dh(()=>{if(T&&(F.current=T),P&&(D.current=P),T&&P){if(_.current)return _.current(T,P,he);he()}},[T,P,he,_,O]);const z=b.useMemo(()=>({reference:F,floating:D,setReference:E,setFloating:C}),[E,C]),U=b.useMemo(()=>({reference:T,floating:P}),[T,P]),H=b.useMemo(()=>{const I={position:n,left:0,top:0};if(!U.floating)return I;const q=vw(U.floating,f.x),V=vw(U.floating,f.y);return c?{...I,transform:"translate("+q+"px, "+V+"px)",...XC(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:V}},[n,c,U.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:he,refs:z,elements:U,floatingStyles:H}),[f,he,z,U,H])}const aB=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:a}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?bw({element:r.current,padding:a}).fn(n):{}:r?bw({element:r,padding:a}).fn(n):{}}}},iB=(t,e)=>({...JF(t),options:[t,e]}),oB=(t,e)=>({...YF(t),options:[t,e]}),lB=(t,e)=>({...eB(t),options:[t,e]}),cB=(t,e)=>({...QF(t),options:[t,e]}),dB=(t,e)=>({...XF(t),options:[t,e]}),uB=(t,e)=>({...ZF(t),options:[t,e]}),hB=(t,e)=>({...aB(t),options:[t,e]});var fB="Arrow",ZC=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(ft.svg,{...i,ref:e,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});ZC.displayName=fB;var pB=ZC,ny="Popper",[e4,t4]=Mi(ny),[mB,n4]=e4(ny),r4=t=>{const{__scopePopper:e,children:n}=t,[r,a]=b.useState(null);return s.jsx(mB,{scope:e,anchor:r,onAnchorChange:a,children:n})};r4.displayName=ny;var s4="PopperAnchor",a4=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=n4(s4,n),o=b.useRef(null),c=Ct(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(ft.div,{...a,ref:c})});a4.displayName=s4;var ry="PopperContent",[gB,xB]=e4(ry),i4=b.forwardRef((t,e)=>{var se,de,ce,ye,Le,Pe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:N,...j}=t,v=n4(ry,n),[k,E]=b.useState(null),C=Ct(e,at=>E(at)),[T,P]=b.useState(null),F=r0(T),D=(F==null?void 0:F.width)??0,R=(F==null?void 0:F.height)??0,O=r+(i!=="center"?"-"+i:""),_=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},re=Array.isArray(h)?h:[h],ne=re.length>0,he={padding:_,boundary:re.filter(bB),altBoundary:ne},{refs:xe,floatingStyles:z,placement:U,isPositioned:H,middlewareData:I}=sB({strategy:"fixed",placement:O,whileElementsMounted:(...at)=>GF(...at,{animationFrame:y==="always"}),elements:{reference:v.anchor},middleware:[iB({mainAxis:a+R,alignmentAxis:o}),u&&oB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?lB():void 0,...he}),u&&cB({...he}),dB({...he,apply:({elements:at,rects:Mt,availableWidth:on,availableHeight:bt})=>{const{width:nn,height:In}=Mt.reference,At=at.floating.style;At.setProperty("--radix-popper-available-width",`${on}px`),At.setProperty("--radix-popper-available-height",`${bt}px`),At.setProperty("--radix-popper-anchor-width",`${nn}px`),At.setProperty("--radix-popper-anchor-height",`${In}px`)}}),T&&hB({element:T,padding:c}),vB({arrowWidth:D,arrowHeight:R}),g&&uB({strategy:"referenceHidden",...he})]}),[q,V]=c4(U),L=Ni(N);dr(()=>{H&&(L==null||L())},[H,L]);const K=(se=I.arrow)==null?void 0:se.x,oe=(de=I.arrow)==null?void 0:de.y,Y=((ce=I.arrow)==null?void 0:ce.centerOffset)!==0,[X,W]=b.useState();return dr(()=>{k&&W(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:xe.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:H?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(ye=I.transformOrigin)==null?void 0:ye.x,(Le=I.transformOrigin)==null?void 0:Le.y].join(" "),...((Pe=I.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(gB,{scope:n,placedSide:q,onArrowChange:P,arrowX:K,arrowY:oe,shouldHideArrow:Y,children:s.jsx(ft.div,{"data-side":q,"data-align":V,...j,ref:C,style:{...j.style,animation:H?void 0:"none"}})})})});i4.displayName=ry;var o4="PopperArrow",yB={top:"bottom",right:"left",bottom:"top",left:"right"},l4=b.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=xB(o4,r),o=yB[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(pB,{...a,ref:n,style:{...a.style,display:"block"}})})});l4.displayName=o4;function bB(t){return t!==null}var vB=t=>({name:"transformOrigin",options:t,fn(e){var v,k,E;const{placement:n,rects:r,middlewareData:a}=e,o=((v=a.arrow)==null?void 0:v.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=c4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,y=(((E=a.arrow)==null?void 0:E.y)??0)+u/2;let N="",j="";return h==="bottom"?(N=o?m:`${g}px`,j=`${-u}px`):h==="top"?(N=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(N=`${-u}px`,j=o?m:`${y}px`):h==="left"&&(N=`${r.floating.width+u}px`,j=o?m:`${y}px`),{data:{x:N,y:j}}}});function c4(t){const[e,n="center"]=t.split("-");return[e,n]}var NB=r4,wB=a4,jB=i4,kB=l4,d4=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),SB="VisuallyHidden",CB=b.forwardRef((t,e)=>s.jsx(ft.span,{...t,ref:e,style:{...d4,...t.style}}));CB.displayName=SB;var EB=[" ","Enter","ArrowUp","ArrowDown"],TB=[" ","Enter"],Po="Select",[Wf,Uf,MB]=e0(Po),[Gl]=Mi(Po,[MB,t4]),Kf=t4(),[AB,Pi]=Gl(Po),[IB,RB]=Gl(Po),u4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:N}=t,j=Kf(e),[v,k]=b.useState(null),[E,C]=b.useState(null),[T,P]=b.useState(!1),F=vf(h),[D,R]=jo({prop:r,defaultProp:a??!1,onChange:i,caller:Po}),[O,_]=jo({prop:o,defaultProp:c,onChange:u,caller:Po}),re=b.useRef(null),ne=v?N||!!v.closest("form"):!0,[he,xe]=b.useState(new Set),z=Array.from(he).map(U=>U.props.value).join(";");return s.jsx(NB,{...j,children:s.jsxs(AB,{required:y,scope:e,trigger:v,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:T,onValueNodeHasChildrenChange:P,contentId:mi(),value:O,onValueChange:_,open:D,onOpenChange:R,dir:F,triggerPointerDownPosRef:re,disabled:g,children:[s.jsx(Wf.Provider,{scope:e,children:s.jsx(IB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(U=>{xe(H=>new Set(H).add(U))},[]),onNativeOptionRemove:b.useCallback(U=>{xe(H=>{const I=new Set(H);return I.delete(U),I})},[]),children:n})}),ne?s.jsxs(P4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:O,onChange:U=>_(U.target.value),disabled:g,form:N,children:[O===void 0?s.jsx("option",{value:""}):null,Array.from(he)]},z):null]})})};u4.displayName=Po;var h4="SelectTrigger",f4=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Kf(n),o=Pi(h4,n),c=o.disabled||r,u=Ct(e,o.onTriggerChange),h=Uf(n),f=b.useRef("touch"),[m,g,y]=D4(j=>{const v=h().filter(C=>!C.disabled),k=v.find(C=>C.value===o.value),E=L4(v,j,k);E!==void 0&&o.onValueChange(E.value)}),N=j=>{c||(o.onOpenChange(!0),y()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return s.jsx(wB,{asChild:!0,...i,children:s.jsx(ft.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":O4(o.value)?"":void 0,...a,ref:u,onClick:lt(a.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&N(j)}),onPointerDown:lt(a.onPointerDown,j=>{f.current=j.pointerType;const v=j.target;v.hasPointerCapture(j.pointerId)&&v.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(N(j),j.preventDefault())}),onKeyDown:lt(a.onKeyDown,j=>{const v=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(v&&j.key===" ")&&EB.includes(j.key)&&(N(),j.preventDefault())})})})});f4.displayName=h4;var p4="SelectValue",m4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Pi(p4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Ct(e,u.onValueNodeChange);return dr(()=>{h(f)},[h,f]),s.jsx(ft.span,{...c,ref:m,style:{pointerEvents:"none"},children:O4(u.value)?s.jsx(s.Fragment,{children:o}):i})});m4.displayName=p4;var PB="SelectIcon",g4=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(ft.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});g4.displayName=PB;var OB="SelectPortal",x4=t=>s.jsx(Jx,{asChild:!0,...t});x4.displayName=OB;var Oo="SelectContent",y4=b.forwardRef((t,e)=>{const n=Pi(Oo,t.__scopeSelect),[r,a]=b.useState();if(dr(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?bd.createPortal(s.jsx(b4,{scope:t.__scopeSelect,children:s.jsx(Wf.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(v4,{...t,ref:e})});y4.displayName=Oo;var Ss=10,[b4,Oi]=Gl(Oo),DB="SelectContentImpl",LB=sd("SelectContent.RemoveScroll"),v4=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:N,hideWhenDetached:j,avoidCollisions:v,...k}=t,E=Pi(Oo,n),[C,T]=b.useState(null),[P,F]=b.useState(null),D=Ct(e,se=>T(se)),[R,O]=b.useState(null),[_,re]=b.useState(null),ne=Uf(n),[he,xe]=b.useState(!1),z=b.useRef(!1);b.useEffect(()=>{if(C)return Dj(C)},[C]),Cj();const U=b.useCallback(se=>{const[de,...ce]=ne().map(Pe=>Pe.ref.current),[ye]=ce.slice(-1),Le=document.activeElement;for(const Pe of se)if(Pe===Le||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===de&&P&&(P.scrollTop=0),Pe===ye&&P&&(P.scrollTop=P.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Le))return},[ne,P]),H=b.useCallback(()=>U([R,C]),[U,R,C]);b.useEffect(()=>{he&&H()},[he,H]);const{onOpenChange:I,triggerPointerDownPosRef:q}=E;b.useEffect(()=>{if(C){let se={x:0,y:0};const de=ye=>{var Le,Pe;se={x:Math.abs(Math.round(ye.pageX)-(((Le=q.current)==null?void 0:Le.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((Pe=q.current)==null?void 0:Pe.y)??0))}},ce=ye=>{se.x<=10&&se.y<=10?ye.preventDefault():C.contains(ye.target)||I(!1),document.removeEventListener("pointermove",de),q.current=null};return q.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",ce,{capture:!0})}}},[C,I,q]),b.useEffect(()=>{const se=()=>I(!1);return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[I]);const[V,L]=D4(se=>{const de=ne().filter(Le=>!Le.disabled),ce=de.find(Le=>Le.ref.current===document.activeElement),ye=L4(de,se,ce);ye&&setTimeout(()=>ye.ref.current.focus())}),K=b.useCallback((se,de,ce)=>{const ye=!z.current&&!ce;(E.value!==void 0&&E.value===de||ye)&&(O(se),ye&&(z.current=!0))},[E.value]),oe=b.useCallback(()=>C==null?void 0:C.focus(),[C]),Y=b.useCallback((se,de,ce)=>{const ye=!z.current&&!ce;(E.value!==void 0&&E.value===de||ye)&&re(se)},[E.value]),X=r==="popper"?Px:N4,W=X===Px?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:N,hideWhenDetached:j,avoidCollisions:v}:{};return s.jsx(b4,{scope:n,content:C,viewport:P,onViewportChange:F,itemRefCallback:K,selectedItem:R,onItemLeave:oe,itemTextRefCallback:Y,focusSelectedItem:H,selectedItemText:_,position:r,isPositioned:he,searchRef:V,children:s.jsx(Yx,{as:LB,allowPinchZoom:!0,children:s.jsx(Gx,{asChild:!0,trapped:E.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:lt(a,se=>{var de;(de=E.trigger)==null||de.focus({preventScroll:!0}),se.preventDefault()}),children:s.jsx(qx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:s.jsx(X,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:se=>se.preventDefault(),...k,...W,onPlaced:()=>xe(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:lt(k.onKeyDown,se=>{const de=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!de&&se.key.length===1&&L(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.key)){let ye=ne().filter(Le=>!Le.disabled).map(Le=>Le.ref.current);if(["ArrowUp","End"].includes(se.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const Le=se.target,Pe=ye.indexOf(Le);ye=ye.slice(Pe+1)}setTimeout(()=>U(ye)),se.preventDefault()}})})})})})})});v4.displayName=DB;var _B="SelectItemAlignedPosition",N4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Pi(Oo,n),o=Oi(Oo,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=Ct(e,D=>f(D)),g=Uf(n),y=b.useRef(!1),N=b.useRef(!0),{viewport:j,selectedItem:v,selectedItemText:k,focusSelectedItem:E}=o,C=b.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&j&&v&&k){const D=i.trigger.getBoundingClientRect(),R=h.getBoundingClientRect(),O=i.valueNode.getBoundingClientRect(),_=k.getBoundingClientRect();if(i.dir!=="rtl"){const Le=_.left-R.left,Pe=O.left-Le,at=D.left-Pe,Mt=D.width+at,on=Math.max(Mt,R.width),bt=window.innerWidth-Ss,nn=xh(Pe,[Ss,Math.max(Ss,bt-on)]);c.style.minWidth=Mt+"px",c.style.left=nn+"px"}else{const Le=R.right-_.right,Pe=window.innerWidth-O.right-Le,at=window.innerWidth-D.right-Pe,Mt=D.width+at,on=Math.max(Mt,R.width),bt=window.innerWidth-Ss,nn=xh(Pe,[Ss,Math.max(Ss,bt-on)]);c.style.minWidth=Mt+"px",c.style.right=nn+"px"}const re=g(),ne=window.innerHeight-Ss*2,he=j.scrollHeight,xe=window.getComputedStyle(h),z=parseInt(xe.borderTopWidth,10),U=parseInt(xe.paddingTop,10),H=parseInt(xe.borderBottomWidth,10),I=parseInt(xe.paddingBottom,10),q=z+U+he+I+H,V=Math.min(v.offsetHeight*5,q),L=window.getComputedStyle(j),K=parseInt(L.paddingTop,10),oe=parseInt(L.paddingBottom,10),Y=D.top+D.height/2-Ss,X=ne-Y,W=v.offsetHeight/2,se=v.offsetTop+W,de=z+U+se,ce=q-de;if(de<=Y){const Le=re.length>0&&v===re[re.length-1].ref.current;c.style.bottom="0px";const Pe=h.clientHeight-j.offsetTop-j.offsetHeight,at=Math.max(X,W+(Le?oe:0)+Pe+H),Mt=de+at;c.style.height=Mt+"px"}else{const Le=re.length>0&&v===re[0].ref.current;c.style.top="0px";const at=Math.max(Y,z+j.offsetTop+(Le?K:0)+W)+ce;c.style.height=at+"px",j.scrollTop=de-Y+j.offsetTop}c.style.margin=`${Ss}px 0`,c.style.minHeight=V+"px",c.style.maxHeight=ne+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,i.trigger,i.valueNode,c,h,j,v,k,i.dir,r]);dr(()=>C(),[C]);const[T,P]=b.useState();dr(()=>{h&&P(window.getComputedStyle(h).zIndex)},[h]);const F=b.useCallback(D=>{D&&N.current===!0&&(C(),E==null||E(),N.current=!1)},[C,E]);return s.jsx($B,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:F,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:s.jsx(ft.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});N4.displayName=_B;var zB="SelectPopperPosition",Px=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=Ss,...i}=t,o=Kf(n);return s.jsx(jB,{...o,...i,ref:e,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Px.displayName=zB;var[$B,sy]=Gl(Oo,{}),Ox="SelectViewport",w4=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Oi(Ox,n),o=sy(Ox,n),c=Ct(e,i.onViewportChange),u=b.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(Wf.Slot,{scope:n,children:s.jsx(ft.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:lt(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const N=window.innerHeight-Ss*2,j=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),k=Math.max(j,v);if(k0?T:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});w4.displayName=Ox;var j4="SelectGroup",[FB,BB]=Gl(j4),VB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=mi();return s.jsx(FB,{scope:n,id:a,children:s.jsx(ft.div,{role:"group","aria-labelledby":a,...r,ref:e})})});VB.displayName=j4;var k4="SelectLabel",HB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=BB(k4,n);return s.jsx(ft.div,{id:a.id,...r,ref:e})});HB.displayName=k4;var hf="SelectItem",[WB,S4]=Gl(hf),C4=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Pi(hf,n),u=Oi(hf,n),h=c.value===r,[f,m]=b.useState(i??""),[g,y]=b.useState(!1),N=Ct(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,a)}),j=mi(),v=b.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(WB,{scope:n,value:r,disabled:a,textId:j,isSelected:h,onItemTextChange:b.useCallback(E=>{m(C=>C||((E==null?void 0:E.textContent)??"").trim())},[]),children:s.jsx(Wf.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(ft.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:N,onFocus:lt(o.onFocus,()=>y(!0)),onBlur:lt(o.onBlur,()=>y(!1)),onClick:lt(o.onClick,()=>{v.current!=="mouse"&&k()}),onPointerUp:lt(o.onPointerUp,()=>{v.current==="mouse"&&k()}),onPointerDown:lt(o.onPointerDown,E=>{v.current=E.pointerType}),onPointerMove:lt(o.onPointerMove,E=>{var C;v.current=E.pointerType,a?(C=u.onItemLeave)==null||C.call(u):v.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:lt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:lt(o.onKeyDown,E=>{var T;((T=u.searchRef)==null?void 0:T.current)!==""&&E.key===" "||(TB.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});C4.displayName=hf;var Fc="SelectItemText",E4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Pi(Fc,n),c=Oi(Fc,n),u=S4(Fc,n),h=RB(Fc,n),[f,m]=b.useState(null),g=Ct(e,k=>m(k),u.onItemTextChange,k=>{var E;return(E=c.itemTextRefCallback)==null?void 0:E.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,N=b.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:v}=h;return dr(()=>(j(N),()=>v(N)),[j,v,N]),s.jsxs(s.Fragment,{children:[s.jsx(ft.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?bd.createPortal(i.children,o.valueNode):null]})});E4.displayName=Fc;var T4="SelectItemIndicator",M4=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return S4(T4,n).isSelected?s.jsx(ft.span,{"aria-hidden":!0,...r,ref:e}):null});M4.displayName=T4;var Dx="SelectScrollUpButton",A4=b.forwardRef((t,e)=>{const n=Oi(Dx,t.__scopeSelect),r=sy(Dx,t.__scopeSelect),[a,i]=b.useState(!1),o=Ct(e,r.onScrollButtonChange);return dr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;i(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(R4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});A4.displayName=Dx;var Lx="SelectScrollDownButton",I4=b.forwardRef((t,e)=>{const n=Oi(Lx,t.__scopeSelect),r=sy(Lx,t.__scopeSelect),[a,i]=b.useState(!1),o=Ct(e,r.onScrollButtonChange);return dr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(R4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});I4.displayName=Lx;var R4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Oi("SelectScrollButton",n),o=b.useRef(null),c=Uf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),dr(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),s.jsx(ft.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:lt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:lt(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:lt(a.onPointerLeave,()=>{u()})})}),UB="SelectSeparator",KB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(ft.div,{"aria-hidden":!0,...r,ref:e})});KB.displayName=UB;var _x="SelectArrow",qB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Kf(n),i=Pi(_x,n),o=Oi(_x,n);return i.open&&o.position==="popper"?s.jsx(kB,{...a,...r,ref:e}):null});qB.displayName=_x;var GB="SelectBubbleInput",P4=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=b.useRef(null),i=Ct(r,a),o=n0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(ft.select,{...n,style:{...d4,...n.style},ref:i,defaultValue:e})});P4.displayName=GB;function O4(t){return t===""||t===void 0}function D4(t){const e=Ni(t),n=b.useRef(""),r=b.useRef(0),a=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),i=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function L4(t,e,n){const a=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=JB(t,Math.max(i,0));a.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function JB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var YB=u4,_4=f4,QB=m4,XB=g4,ZB=x4,z4=y4,eV=w4,$4=C4,tV=E4,nV=M4,rV=A4,sV=I4;const bl=YB,vl=QB,io=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(_4,{ref:r,className:Et("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,s.jsx(XB,{asChild:!0,children:s.jsx(rd,{className:"h-4 w-4 opacity-50"})})]}));io.displayName=_4.displayName;const oo=b.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(ZB,{children:s.jsxs(z4,{ref:a,className:Et("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[s.jsx(rV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Gw,{className:"h-4 w-4"})}),s.jsx(eV,{className:"p-1",children:e}),s.jsx(sV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(rd,{className:"h-4 w-4"})})]})}));oo.displayName=z4.displayName;const Fr=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs($4,{ref:r,className:Et("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(nV,{children:s.jsx(mf,{className:"h-4 w-4"})})}),s.jsx(tV,{children:e})]}));Fr.displayName=$4.displayName;function aV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(null),[u,h]=b.useState({name:"",appId:"",path:"",sort:0}),[f,m]=b.useState(!1);async function g(){r(!0);try{const k=await Oe("/api/admin/linked-miniprograms");if(k!=null&&k.success&&Array.isArray(k.data)){const E=[...k.data].sort((C,T)=>(C.sort??0)-(T.sort??0));e(E)}}catch(k){console.error("Load linked miniprograms error:",k),ae.error("加载失败")}finally{r(!1)}}b.useEffect(()=>{g()},[]);function y(){c(null),h({name:"",appId:"",path:"",sort:t.length}),i(!0)}function N(k){c(k),h({name:k.name,appId:k.appId,path:k.path??"",sort:k.sort??0}),i(!0)}async function j(){const k=u.name.trim(),E=u.appId.trim();if(!k||!E){ae.error("请填写小程序名称和 AppID");return}m(!0);try{if(o){const C=await Dt("/api/admin/linked-miniprograms",{key:o.key,name:k,appId:E,path:u.path.trim(),sort:u.sort});C!=null&&C.success?(ae.success("已更新"),i(!1),g()):ae.error((C==null?void 0:C.error)??"更新失败")}else{const C=await Nt("/api/admin/linked-miniprograms",{name:k,appId:E,path:u.path.trim(),sort:u.sort});C!=null&&C.success?(ae.success("已添加"),i(!1),g()):ae.error((C==null?void 0:C.error)??"添加失败")}}catch{ae.error("操作失败")}finally{m(!1)}}async function v(k){if(confirm(`确定要删除「${k.name}」吗?`))try{const E=await Ws(`/api/admin/linked-miniprograms/${k.key}`);E!=null&&E.success?(ae.success("已删除"),g()):ae.error((E==null?void 0:E.error)??"删除失败")}catch{ae.error("删除失败")}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(vi,{className:"w-5 h-5 text-[#38bdac]"}),"关联小程序管理"]}),s.jsx(Lt,{className:"text-gray-400",children:"添加后生成 32 位密钥,链接标签选择小程序时存密钥;小程序端点击 #标签 时用密钥查 appId 再跳转。需在 app.json 的 navigateToMiniProgramAppIdList 中配置目标 AppID。"})]}),s.jsxs(Ie,{children:[s.jsxs("div",{className:"flex justify-end gap-2 mb-4",children:[s.jsx(ee,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>g(),title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsxs(ee,{onClick:y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"添加关联小程序"]})]}),n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"名称"}),s.jsx(ke,{className:"text-gray-400",children:"密钥"}),s.jsx(ke,{className:"text-gray-400",children:"AppID"}),s.jsx(ke,{className:"text-gray-400",children:"路径"}),s.jsx(ke,{className:"text-gray-400 w-24",children:"排序"}),s.jsx(ke,{className:"text-gray-400 w-32",children:"操作"})]})}),s.jsxs(fr,{children:[t.map(k=>s.jsxs(ot,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-white",children:k.name}),s.jsx(be,{className:"text-gray-300 font-mono text-xs",children:k.key}),s.jsx(be,{className:"text-gray-300 font-mono text-sm",children:k.appId}),s.jsx(be,{className:"text-gray-400 text-sm",children:k.path||"—"}),s.jsx(be,{className:"text-gray-300",children:k.sort??0}),s.jsx(be,{children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/20",onClick:()=>N(k),children:s.jsx(rj,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-red-400 hover:bg-red-500/20",onClick:()=>v(k),children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},k.key)),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无关联小程序,点击「添加关联小程序」开始配置"})})]})]})]})]}),s.jsx(Rt,{open:a,onOpenChange:i,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Pt,{className:"gap-1",children:[s.jsx(Ot,{className:"text-base",children:o?"编辑关联小程序":"添加关联小程序"}),s.jsx(bf,{className:"text-gray-400 text-xs",children:"填写目标小程序的名称和 AppID,路径可选(为空则打开首页)"})]}),s.jsxs("div",{className:"space-y-3 py-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"小程序名称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"例如:Soul 创业派对",value:u.name,onChange:k=>h(E=>({...E,name:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono h-8 text-sm",placeholder:"例如:wxb8bbb2b10dec74aa",value:u.appId,onChange:k=>h(E=>({...E,appId:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"路径(可选)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"例如:pages/index/index",value:u.path,onChange:k=>h(E=>({...E,path:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm w-20",value:u.sort,onChange:k=>h(E=>({...E,sort:parseInt(k.target.value,10)||0}))})]})]}),s.jsxs(Xt,{className:"gap-2 pt-1",children:[s.jsx(ee,{variant:"outline",onClick:()=>i(!1),className:"border-gray-600",children:"取消"}),s.jsx(ee,{onClick:j,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:f?"保存中...":"保存"})]})]})})]})}const iV=["一","二","三","四","五","六","七","八","九","十"];function wg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function oV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:a,onDeleteSection:i,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:N,pinnedSectionIds:j=[]}){const[v,k]=b.useState(null),[E,C]=b.useState(null),T=(_,re)=>(v==null?void 0:v.type)===_&&(v==null?void 0:v.id)===re,P=(_,re)=>(E==null?void 0:E.type)===_&&(E==null?void 0:E.id)===re,F=b.useCallback(()=>{const _=[];for(const re of t)for(const ne of re.chapters)for(const he of ne.sections)_.push({id:he.id,partId:re.id,partTitle:re.title,chapterId:ne.id,chapterTitle:ne.title});return _},[t]),D=b.useCallback(async(_,re,ne,he)=>{var I;_.preventDefault(),_.stopPropagation();const xe=_.dataTransfer.getData("text/plain"),z=wg(xe);if(!z||z.type===re&&z.id===ne)return;const U=F(),H=new Map(U.map(q=>[q.id,q]));if(z.type==="part"&&re==="part"){const q=t.map(Y=>Y.id),V=q.indexOf(z.id),L=q.indexOf(ne);if(V===-1||L===-1)return;const K=[...q];K.splice(V,1),K.splice(VW.id===Y);if(X)for(const W of X.chapters)for(const se of W.sections){const de=H.get(se.id);de&&oe.push(de)}}await r(oe);return}if(z.type==="chapter"&&(re==="chapter"||re==="section"||re==="part")){const q=t.find(de=>de.chapters.some(ce=>ce.id===z.id)),V=q==null?void 0:q.chapters.find(de=>de.id===z.id);if(!q||!V)return;let L,K,oe=null;if(re==="section"){const de=H.get(ne);if(!de)return;L=de.partId,K=de.partTitle,oe=ne}else if(re==="chapter"){const de=t.find(Le=>Le.chapters.some(Pe=>Pe.id===ne)),ce=de==null?void 0:de.chapters.find(Le=>Le.id===ne);if(!de||!ce)return;L=de.id,K=de.title;const ye=U.filter(Le=>Le.chapterId===ne).pop();oe=(ye==null?void 0:ye.id)??null}else{const de=t.find(ye=>ye.id===ne);if(!de||!de.chapters[0])return;L=de.id,K=de.title;const ce=U.filter(ye=>ye.partId===de.id&&ye.chapterId===de.chapters[0].id);oe=((I=ce[ce.length-1])==null?void 0:I.id)??null}const Y=V.sections.map(de=>de.id),X=U.filter(de=>!Y.includes(de.id));let W=X.length;if(oe){const de=X.findIndex(ce=>ce.id===oe);de>=0&&(W=de+1)}const se=Y.map(de=>({...H.get(de),partId:L,partTitle:K,chapterId:V.id,chapterTitle:V.title}));await r([...X.slice(0,W),...se,...X.slice(W)]);return}if(z.type==="section"&&(re==="section"||re==="chapter"||re==="part")){if(!he)return;const{partId:q,partTitle:V,chapterId:L,chapterTitle:K}=he;let oe;if(re==="section")oe=U.findIndex(ce=>ce.id===ne);else if(re==="chapter"){const ce=U.filter(ye=>ye.chapterId===ne).pop();oe=ce?U.findIndex(ye=>ye.id===ce.id)+1:U.length}else{const ce=t.find(Pe=>Pe.id===ne);if(!(ce!=null&&ce.chapters[0]))return;const ye=U.filter(Pe=>Pe.partId===ce.id&&Pe.chapterId===ce.chapters[0].id),Le=ye[ye.length-1];oe=Le?U.findIndex(Pe=>Pe.id===Le.id)+1:0}const Y=U.findIndex(ce=>ce.id===z.id);if(Y===-1)return;const X=U.filter(ce=>ce.id!==z.id),W=Y({onDragEnter:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",C({type:_,id:re})},onDragOver:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",C({type:_,id:re})},onDragLeave:()=>C(null),onDrop:he=>{C(null);const xe=wg(he.dataTransfer.getData("text/plain"));if(xe&&!(_==="section"&&xe.type==="section"&&xe.id===re))if(_==="part")if(xe.type==="part")D(he,"part",re);else{const z=t.find(H=>H.id===re);(z==null?void 0:z.chapters[0])&&ne&&D(he,"part",re,ne)}else _==="chapter"&&ne?(xe.type==="section"||xe.type==="chapter")&&D(he,"chapter",re,ne):_==="section"&&ne&&D(he,"section",re,ne)}}),O=_=>iV[_]??String(_+1);return s.jsx("div",{className:"space-y-3",children:t.map((_,re)=>{var V,L,K,oe;const ne=_.title==="序言"||_.title.includes("序言"),he=_.title==="尾声"||_.title.includes("尾声"),xe=_.title==="附录"||_.title.includes("附录"),z=P("part",_.id),U=e.includes(_.id),H=_.chapters.length,I=_.chapters.reduce((Y,X)=>Y+X.sections.length,0);if(ne&&_.chapters.length===1&&_.chapters[0].sections.length===1){const Y=_.chapters[0].sections[0],X=P("section",Y.id),W={partId:_.id,partTitle:_.title,chapterId:_.chapters[0].id,chapterTitle:_.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+Y.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:Y.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${X?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",Y.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",Y.id,W),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ya,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(Y.id),onChange:()=>y(Y.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Wr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[_.chapters[0].title," | ",Y.title]}),j.includes(Y.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(co,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:se=>se.stopPropagation(),onClick:se=>se.stopPropagation(),children:[Y.price===0||Y.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",Y.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Y.clickCount??0," · 付款 ",Y.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Y.hotScore??0).toFixed(1)," · 第",Y.hotRank&&Y.hotRank>0?Y.hotRank:"-","名"]}),N&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(Y),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Y),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(Y),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)}if(_.title==="2026每日派对干货"||_.title.includes("2026每日派对干货")){const Y=P("part",_.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${Y?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...R("part",_.id,{partId:_.id,partTitle:_.title,chapterId:((V=_.chapters[0])==null?void 0:V.id)??"",chapterTitle:((L=_.chapters[0])==null?void 0:L.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:X=>{X.stopPropagation(),X.dataTransfer.setData("text/plain","part:"+_.id),X.dataTransfer.effectAllowed="move",k({type:"part",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(_.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ya,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:_.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",I," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:X=>X.stopPropagation(),onClick:X=>X.stopPropagation(),children:[o&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(fn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),f&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(_),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[H,"章"]}),U?s.jsx(rd,{className:"w-5 h-5 text-gray-500"}):s.jsx(lo,{className:"w-5 h-5 text-gray-500"})]})]}),U&&_.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:_.chapters.map(X=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:X.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:W=>W.stopPropagation(),children:[m&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>m(_,X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),c&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>c(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(fn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>u(_,X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:X.sections.map(W=>{const se=P("section",W.id);return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+W.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:W.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(W),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${se?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",W.id,{partId:_.id,partTitle:_.title,chapterId:X.id,chapterTitle:X.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ya,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(W.id),onChange:()=>y(W.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[W.id," ",W.title]}),j.includes(W.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(co,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onClick:de=>de.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",W.clickCount??0," · 付款 ",W.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(W.hotScore??0).toFixed(1)," · 第",W.hotRank&&W.hotRank>0?W.hotRank:"-","名"]}),N&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(W),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(W),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]},W.id)})})]},X.id))})]},_.id)}if(xe)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:_.chapters.map((Y,X)=>Y.sections.length>0?Y.sections.map(W=>{const se=P("section",W.id);return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+W.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:W.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${se?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",W.id,{partId:_.id,partTitle:_.title,chapterId:Y.id,chapterTitle:Y.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ya,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(W.id),onChange:()=>y(W.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",X+1," | ",Y.title," | ",W.title]}),j.includes(W.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(co,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",W.clickCount??0," · 付款 ",W.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(W.hotScore??0).toFixed(1)," · 第",W.hotRank&&W.hotRank>0?W.hotRank:"-","名"]}),N&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(W),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>a(W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>i(W),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(lo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},W.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",X+1," | ",Y.title,"(空)"]}),s.jsx(lo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},Y.id))})]},_.id);if(he&&_.chapters.length===1&&_.chapters[0].sections.length===1){const Y=_.chapters[0].sections[0],X=P("section",Y.id),W={partId:_.id,partTitle:_.title,chapterId:_.chapters[0].id,chapterTitle:_.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+Y.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:Y.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${X?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",Y.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",Y.id,W),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ya,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(Y.id),onChange:()=>y(Y.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Wr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[_.chapters[0].title," | ",Y.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:se=>se.stopPropagation(),onClick:se=>se.stopPropagation(),children:[Y.price===0||Y.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",Y.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Y.clickCount??0," · 付款 ",Y.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Y.hotScore??0).toFixed(1)," · 第",Y.hotRank&&Y.hotRank>0?Y.hotRank:"-","名"]}),N&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(Y),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Y),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(Y),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)}return he?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:_.chapters.map(Y=>Y.sections.map(X=>{const W=P("section",X.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+X.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:X.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${W?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...R("section",X.id,{partId:_.id,partTitle:_.title,chapterId:Y.id,chapterTitle:Y.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ya,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(X.id),onChange:()=>y(X.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[Y.title," | ",X.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),N&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(X),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},X.id)}))})]},_.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${z?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...R("part",_.id,{partId:_.id,partTitle:_.title,chapterId:((K=_.chapters[0])==null?void 0:K.id)??"",chapterTitle:((oe=_.chapters[0])==null?void 0:oe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:Y=>{Y.stopPropagation(),Y.dataTransfer.setData("text/plain","part:"+_.id),Y.dataTransfer.effectAllowed="move",k({type:"part",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(_.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ya,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:O(re)}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:_.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",I," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Y=>Y.stopPropagation(),onClick:Y=>Y.stopPropagation(),children:[o&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(fn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),f&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(_),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[H,"章"]}),U?s.jsx(rd,{className:"w-5 h-5 text-gray-500"}):s.jsx(lo,{className:"w-5 h-5 text-gray-500"})]})]}),U&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:_.chapters.map(Y=>{const X=P("chapter",Y.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:W=>{W.stopPropagation(),W.dataTransfer.setData("text/plain","chapter:"+Y.id),W.dataTransfer.effectAllowed="move",k({type:"chapter",id:Y.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:W=>{W.preventDefault(),W.stopPropagation(),W.dataTransfer.dropEffect="move",C({type:"chapter",id:Y.id})},onDragOver:W=>{W.preventDefault(),W.stopPropagation(),W.dataTransfer.dropEffect="move",C({type:"chapter",id:Y.id})},onDragLeave:()=>C(null),onDrop:W=>{C(null);const se=wg(W.dataTransfer.getData("text/plain"));if(!se)return;const de={partId:_.id,partTitle:_.title,chapterId:Y.id,chapterTitle:Y.title};(se.type==="section"||se.type==="chapter")&&D(W,"chapter",Y.id,de)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${X?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${T("chapter",Y.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(ya,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:Y.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:W=>W.stopPropagation(),children:[m&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>m(_,Y),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),c&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>c(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(fn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>u(_,Y),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:Y.sections.map(W=>{const se=P("section",W.id);return s.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+W.id),de.dataTransfer.effectAllowed="move",k({type:"section",id:W.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${se?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",W.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...R("section",W.id,{partId:_.id,partTitle:_.title,chapterId:Y.id,chapterTitle:Y.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(W.id),onChange:()=>y(W.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(ya,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${W.price===0||W.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[W.id," ",W.title]}),j.includes(W.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(co,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:de=>de.stopPropagation(),onClick:de=>de.stopPropagation(),children:[W.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),W.price===0||W.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",W.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",W.clickCount??0," · 付款 ",W.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(W.hotScore??0).toFixed(1)," · 第",W.hotRank&&W.hotRank>0?W.hotRank:"-","名"]}),N&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(W),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(W),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Vt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(W),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},W.id)})})]},Y.id)})})]},_.id)})})}function lV(t){var a;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(a=t==null?void 0:t.keyword)!=null&&a.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString(),r=n?`/api/admin/ckb/devices?${n}`:"/api/admin/ckb/devices";return Oe(r)}function cV(t){return Oe(`/api/db/person?personId=${encodeURIComponent(t)}`)}function dV(t){var r;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(r=t==null?void 0:t.keyword)!=null&&r.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString();return Oe(n?`/api/admin/ckb/plans?${n}`:"/api/admin/ckb/plans")}const F4=11,Nw={personId:"",name:"",aliases:"",label:"",sceneId:F4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"09:00",endTime:"18:00",deviceGroups:""};function uV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var U;const a=!!n,[i,o]=b.useState(Nw),[c,u]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState([]),[y,N]=b.useState(!1),[j,v]=b.useState(""),[k,E]=b.useState([]),[C,T]=b.useState(!1),[P,F]=b.useState(""),[D,R]=b.useState(!1),[O,_]=b.useState({});b.useEffect(()=>{t&&(v(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",aliases:n.aliases??"",label:n.label??"",sceneId:F4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"09:00",endTime:n.endTime??"18:00",deviceGroups:n.deviceGroups??""}:{...Nw}),_({}),m.length===0&&re(""),k.length===0&&ne(""))},[t,n]);const re=async H=>{N(!0);try{const I=await lV({page:1,limit:50,keyword:H});I!=null&&I.success&&Array.isArray(I.devices)?g(I.devices):I!=null&&I.error&&ae.error(I.error)}catch(I){ae.error(I instanceof Error?I.message:"加载设备列表失败")}finally{N(!1)}},ne=async H=>{T(!0);try{const I=await dV({page:1,limit:100,keyword:H});I!=null&&I.success&&Array.isArray(I.plans)?E(I.plans):I!=null&&I.error&&ae.error(I.error)}catch{ae.error("加载计划列表失败")}finally{T(!1)}},he=H=>{const I=Array.isArray(H.deviceGroups)?H.deviceGroups.map(String).join(","):"";o(q=>({...q,ckbApiKey:H.apiKey||"",greeting:H.greeting||q.greeting,tips:H.tips||q.tips,remarkType:H.remarkType||q.remarkType,remarkFormat:H.remarkFormat||q.remarkFormat,addFriendInterval:H.addInterval||q.addFriendInterval,startTime:H.startTime||q.startTime,endTime:H.endTime||q.endTime,deviceGroups:I||q.deviceGroups})),R(!1),ae.success(`已选择计划「${H.name}」,参数已覆盖`)},xe=P.trim()?k.filter(H=>(H.name||"").includes(P.trim())||String(H.id).includes(P.trim())):k,z=async()=>{var V;const H={};(!i.name||!String(i.name).trim())&&(H.name="请填写名称");const I=i.addFriendInterval;if((typeof I!="number"||I<1)&&(H.addFriendInterval="添加间隔至少为 1 分钟"),(((V=i.deviceGroups)==null?void 0:V.split(",").map(L=>L.trim()).filter(Boolean))??[]).length===0&&(H.deviceGroups="请至少选择 1 台设备"),_(H),Object.keys(H).length>0){ae.error(H.name||H.addFriendInterval||H.deviceGroups||"请完善必填项");return}u(!0);try{await r(i),e(!1)}catch(L){ae.error(L instanceof Error?L.message:"保存失败")}finally{u(!1)}};return s.jsx(Rt,{open:t,onOpenChange:e,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Pt,{children:[s.jsx(Ot,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(bf,{className:"text-gray-400 text-sm",children:a?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Z,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(ie,{className:`bg-[#0a1628] text-white ${O.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:i.name,onChange:H=>{o(I=>({...I,name:H.target.value})),O.name&&_(I=>({...I,name:void 0}))}}),O.name&&s.jsx("p",{className:"text-xs text-red-400",children:O.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:i.personId,onChange:H=>o(I=>({...I,personId:H.target.value})),disabled:a})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:i.label,onChange:H=>o(I=>({...I,label:H.target.value}))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 卡卡, 若若",value:i.aliases,onChange:H=>o(I=>({...I,aliases:H.target.value}))})]})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-4",children:"存客宝 API 获客配置"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5 relative",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"选择存客宝获客计划"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1 flex items-center bg-[#0a1628] border border-gray-700 rounded-md px-3 py-2 cursor-pointer hover:border-[#38bdac]/60 text-sm",onClick:()=>R(!D),children:i.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((U=k.find(H=>H.apiKey===i.ckbApiKey))==null?void 0:U.name)||`密钥: ${i.ckbApiKey.slice(0,20)}...`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{ne(P),R(!0)},disabled:C,children:C?"加载...":"刷新"})]}),D&&s.jsxs("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-[#0b1828] border border-gray-700 rounded-lg shadow-xl max-h-64 flex flex-col",children:[s.jsx("div",{className:"p-2 border-b border-gray-700/60",children:s.jsx(ie,{className:"bg-[#050c18] border-gray-700 text-white h-8 text-xs",placeholder:"搜索计划名称...",value:P,onChange:H=>F(H.target.value),onKeyDown:H=>{H.key==="Enter"&&ne(P)},autoFocus:!0})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:xe.length===0?s.jsx("div",{className:"text-center py-4 text-gray-500 text-xs",children:C?"加载中...":"暂无计划"}):xe.map(H=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${i.ckbApiKey===H.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>he(H),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:H.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(H.id)]})]}),H.enabled?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 rounded shrink-0 ml-2",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 rounded shrink-0 ml-2",children:"停用"})]},String(H.id)))}),s.jsx("div",{className:"p-2 border-t border-gray-700/60 flex justify-end",children:s.jsx(ee,{type:"button",size:"sm",variant:"ghost",className:"text-gray-400 h-7 text-xs",onClick:()=>R(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Z,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${O.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(ie,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:i.deviceGroups?`已选择 ${i.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(ee,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),O.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:O.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(bl,{value:i.remarkType,onValueChange:H=>o(I=>({...I,remarkType:H})),children:[s.jsx(io,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(vl,{placeholder:"选择备注类型"})}),s.jsxs(oo,{children:[s.jsx(Fr,{value:"phone",children:"手机号"}),s.jsx(Fr,{value:"nickname",children:"昵称"}),s.jsx(Fr,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"备注格式"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 手机号+SOUL链接人与事-{名称},留空用默认",value:i.remarkFormat,onChange:H=>o(I=>({...I,remarkFormat:H.target.value}))})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:i.greeting,onChange:H=>o(I=>({...I,greeting:H.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(ie,{type:"number",min:1,className:`bg-[#0a1628] text-white ${O.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:i.addFriendInterval,onChange:H=>{o(I=>({...I,addFriendInterval:Number(H.target.value)||1})),O.addFriendInterval&&_(I=>({...I,addFriendInterval:void 0}))}}),O.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:O.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.startTime,onChange:H=>o(I=>({...I,startTime:H.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(ie,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.endTime,onChange:H=>o(I=>({...I,endTime:H.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(Hl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:i.tips,onChange:H=>o(I=>({...I,tips:H.target.value}))})]})]})]})]})]}),s.jsxs(Xt,{className:"gap-3 pt-2",children:[s.jsx(ee,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(ee,{onClick:z,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:c?"保存中...":a?"保存":"添加"})]}),h&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:j,onChange:H=>v(H.target.value),onKeyDown:H=>{H.key==="Enter"&&re(j)}}),s.jsx(ee,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>re(j),disabled:y,children:"刷新"}),s.jsx(ee,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>f(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:y?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):m.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:m.map(H=>{const I=String(H.id??""),q=i.deviceGroups?i.deviceGroups.split(",").map(K=>K.trim()).filter(Boolean):[],V=q.includes(I),L=()=>{let K;V?K=q.filter(oe=>oe!==I):K=[...q,I],o(oe=>({...oe,deviceGroups:K.join(",")})),K.length>0&&_(oe=>({...oe,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:V,onChange:L}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:H.memo||H.wechatId||`设备 ${I}`}),H.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),H.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",I]}),H.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",H.wechatId]}),typeof H.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",H.totalFriend]})]})]})]},I)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",i.deviceGroups?i.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ee,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(ee,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}function hV(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,mid:c.mid,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const i=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return i.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function fV(){var la,ca,Xr;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[N,j]=b.useState(""),[v,k]=b.useState([]),[E,C]=b.useState(!1),[T,P]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[F,D]=b.useState(null),[R,O]=b.useState(!1),[_,re]=b.useState(!1),[ne,he]=b.useState(null),[xe,z]=b.useState(!1),[U,H]=b.useState([]),[I,q]=b.useState(!1),[V,L]=b.useState(""),[K,oe]=b.useState(""),[Y,X]=b.useState(!1),[W,se]=b.useState(""),[de,ce]=b.useState(!1),[ye,Le]=b.useState(null),[Pe,at]=b.useState(!1),[Mt,on]=b.useState(!1),[bt,nn]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[In,At]=b.useState(!1),[Jt,rn]=b.useState(!1),[Rn,xr]=b.useState(1),[Pn,Un]=b.useState([]),[G,We]=b.useState(!1),[qe,yt]=b.useState([]),[ct,tt]=b.useState(!1),[gt,Yt]=b.useState(20),[ln,tr]=b.useState(!1),[nr,Ps]=b.useState(!1),[Or,Os]=b.useState([]),[pe,ge]=b.useState([]),[cn,On]=b.useState(!1),[Zs,ea]=b.useState(null),[ms,ta]=b.useState(null),[xt,Dn]=b.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),[yr,Ds]=b.useState(null),na=b.useRef(null),Kn=hV(t),rr=t.length,gs=10,Dr=Math.max(1,Math.ceil(Pn.length/gs)),qr=Pn.slice((Rn-1)*gs,Rn*gs),Ln=async()=>{r(!0);try{const M=await Oe("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(M==null?void 0:M.sections)?M.sections:[])}catch(M){console.error(M),e([])}finally{r(!1)}},Gr=async()=>{We(!0);try{const M=await Oe("/api/db/book?action=ranking",{cache:"no-store"}),Q=Array.isArray(M==null?void 0:M.sections)?M.sections:[];Un(Q);const me=Q.filter(Ne=>Ne.isPinned).map(Ne=>Ne.id);yt(me)}catch(M){console.error(M),Un([])}finally{We(!1)}};b.useEffect(()=>{Ln(),Gr()},[]);const Di=M=>{i(Q=>Q.includes(M)?Q.filter(me=>me!==M):[...Q,M])},Jr=b.useCallback(M=>{const Q=t,me=M.flatMap(Ne=>{const rt=Q.find(mt=>mt.id===Ne.id);return rt?[{...rt,partId:Ne.partId,partTitle:Ne.partTitle,chapterId:Ne.chapterId,chapterTitle:Ne.chapterTitle}]:[]});return e(me),Dt("/api/db/book",{action:"reorder",items:M}).then(Ne=>{Ne&&Ne.success===!1&&(e(Q),ae.error("排序失败: "+(Ne&&typeof Ne=="object"&&"error"in Ne?Ne.error:"未知错误")))}).catch(Ne=>{e(Q),console.error("排序失败:",Ne),ae.error("排序失败: "+(Ne instanceof Error?Ne.message:"网络或服务异常"))}),Promise.resolve()},[t]),Li=async M=>{if(confirm(`确定要删除章节「${M.title}」吗?此操作不可恢复。`))try{const Q=await Ws(`/api/db/book?id=${encodeURIComponent(M.id)}`);Q&&Q.success!==!1?(ae.success("已删除"),Ln(),Gr()):ae.error("删除失败: "+(Q&&typeof Q=="object"&&"error"in Q?Q.error:"未知错误"))}catch(Q){console.error(Q),ae.error("删除失败")}},_i=b.useCallback(async()=>{At(!0);try{const M=await Oe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),Q=M&&M.data;Q&&typeof Q.readWeight=="number"&&typeof Q.recencyWeight=="number"&&typeof Q.payWeight=="number"&&nn({readWeight:Math.max(0,Math.min(1,Q.readWeight)),recencyWeight:Math.max(0,Math.min(1,Q.recencyWeight)),payWeight:Math.max(0,Math.min(1,Q.payWeight))})}catch{}finally{At(!1)}},[]);b.useEffect(()=>{Mt&&_i()},[Mt,_i]);const Jl=async()=>{const{readWeight:M,recencyWeight:Q,payWeight:me}=bt,Ne=M+Q+me;if(Math.abs(Ne-1)>.001){ae.error("三个权重之和必须等于 1");return}rn(!0);try{const rt=await Nt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:M,recencyWeight:Q,payWeight:me},description:"文章排名算法权重"});rt&&rt.success!==!1?(ae.success("排名权重已保存"),on(!1),Ln(),Gr()):ae.error("保存失败: "+(rt&&typeof rt=="object"&&"error"in rt?rt.error:""))}catch(rt){console.error(rt),ae.error("保存失败")}finally{rn(!1)}},zi=b.useCallback(async()=>{tt(!0);try{const M=await Oe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),Q=M&&M.data;Array.isArray(Q)&&yt(Q)}catch{}finally{tt(!1)}},[]),Yr=b.useCallback(async()=>{try{const M=await Oe("/api/db/persons");M!=null&&M.success&&M.persons&&Os(M.persons.map(Q=>{const me=Q.deviceGroups,Ne=Array.isArray(me)?me.join(","):me??"";return{id:Q.token??Q.personId??"",personId:Q.personId,name:Q.name,label:Q.label??"",ckbApiKey:Q.ckbApiKey??"",ckbPlanId:Q.ckbPlanId,remarkType:Q.remarkType,remarkFormat:Q.remarkFormat,addFriendInterval:Q.addFriendInterval,startTime:Q.startTime,endTime:Q.endTime,deviceGroups:Ne}}))}catch{}},[]),br=b.useCallback(async()=>{try{const M=await Oe("/api/db/link-tags");M!=null&&M.success&&M.linkTags&&ge(M.linkTags.map(Q=>({id:Q.tagId,label:Q.label,url:Q.url,type:Q.type||"url",appId:Q.appId||"",pagePath:Q.pagePath||""})))}catch{}},[]),[Qr,$i]=b.useState([]),[Ls,It]=b.useState(""),[Fi,xs]=b.useState(!1),zo=b.useRef(null),ra=b.useCallback(async()=>{try{const M=await Oe("/api/admin/linked-miniprograms");M!=null&&M.success&&Array.isArray(M.data)&&$i(M.data.map(Q=>({...Q,key:Q.key})))}catch{}},[]),$o=Qr.filter(M=>!Ls.trim()||M.name.toLowerCase().includes(Ls.toLowerCase())||M.key&&M.key.toLowerCase().includes(Ls.toLowerCase())||M.appId.toLowerCase().includes(Ls.toLowerCase())),Bi=async M=>{const Q=qe.includes(M)?qe.filter(me=>me!==M):[...qe,M];yt(Q);try{await Nt("/api/db/config",{key:"pinned_section_ids",value:Q,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),Gr()}catch{yt(qe)}},sa=b.useCallback(async()=>{tr(!0);try{const M=await Oe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),Q=M&&M.data;typeof Q=="number"&&Q>0&&Q<=100&&Yt(Q)}catch{}finally{tr(!1)}},[]),Sr=async()=>{if(gt<1||gt>100){ae.error("预览比例需在 1~100 之间");return}Ps(!0);try{const M=await Nt("/api/db/config",{key:"unpaid_preview_percent",value:gt,description:"小程序未付费内容默认预览比例(%)"});M&&M.success!==!1?ae.success("预览比例已保存"):ae.error("保存失败: "+(M.error||""))}catch{ae.error("保存失败")}finally{Ps(!1)}};b.useEffect(()=>{zi(),sa(),Yr(),br(),ra()},[zi,sa,Yr,br,ra]);const Vi=async M=>{Le({section:M,orders:[]}),at(!0);try{const Q=await Oe(`/api/db/book?action=section-orders&id=${encodeURIComponent(M.id)}`),me=Q!=null&&Q.success&&Array.isArray(Q.orders)?Q.orders:[];Le(Ne=>Ne?{...Ne,orders:me}:null)}catch(Q){console.error(Q),Le(me=>me?{...me,orders:[]}:null)}finally{at(!1)}},_n=async M=>{m(!0);try{const Q=M.mid!=null&&M.mid>0?`/api/db/book?action=read&mid=${M.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(M.id)}`,me=await Oe(Q);if(me!=null&&me.success&&me.section){const Ne=me.section,rt=Ne.editionPremium===!0;c({id:M.id,originalId:M.id,title:me.section.title??M.title,price:me.section.price??M.price,content:me.section.content??"",filePath:M.filePath,isFree:M.isFree||M.price===0,isNew:Ne.isNew??M.isNew,isPinned:qe.includes(M.id),hotScore:M.hotScore??0,editionStandard:rt?!1:Ne.editionStandard??!0,editionPremium:rt})}else c({id:M.id,originalId:M.id,title:M.title,price:M.price,content:"",filePath:M.filePath,isFree:M.isFree,isNew:M.isNew,isPinned:qe.includes(M.id),hotScore:M.hotScore??0,editionStandard:!0,editionPremium:!1}),me&&!me.success&&ae.error("无法读取文件内容: "+(me.error||"未知错误"))}catch(Q){console.error(Q),c({id:M.id,title:M.title,price:M.price,content:"",filePath:M.filePath,isFree:M.isFree})}finally{m(!1)}},Yl=async()=>{var M;if(o){y(!0);try{let Q=o.content||"";const me=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(M=o.title)==null?void 0:M.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const dn of me)Q=Q.replace(dn,"");Q=Q.replace(/^\s*\n+/,"").trim();const Ne=o.originalId||o.id,rt=o.id!==Ne,mt=await Dt("/api/db/book",{id:Ne,...rt?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:Q,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,editionStandard:o.editionPremium?!1:o.editionStandard??!0,editionPremium:o.editionPremium??!1,saveToFile:!0},{timeout:Uv}),$t=rt?o.id:Ne;o.isPinned!==qe.includes($t)&&await Bi($t),mt&&mt.success!==!1?(ae.success(`已保存:${o.title}`),c(null),Ln(),Yr(),br()):ae.error("保存失败: "+(mt&&typeof mt=="object"&&"error"in mt?mt.error:"未知错误"))}catch(Q){console.error(Q);const me=Q instanceof Error&&Q.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";ae.error(me)}finally{y(!1)}}},Fo=async()=>{if(!T.id||!T.title){ae.error("请填写章节ID和标题");return}y(!0);try{const M=Kn.find(Ne=>Ne.id===T.partId),Q=M==null?void 0:M.chapters.find(Ne=>Ne.id===T.chapterId),me=await Dt("/api/db/book",{id:T.id,title:T.title,price:T.isFree?0:T.price,content:T.content||"",partId:T.partId,partTitle:(M==null?void 0:M.title)??"",chapterId:T.chapterId,chapterTitle:(Q==null?void 0:Q.title)??"",isFree:T.isFree,isNew:T.isNew,editionStandard:T.editionPremium?!1:T.editionStandard??!0,editionPremium:T.editionPremium??!1,hotScore:T.hotScore??0,saveToFile:!1},{timeout:Uv});if(me&&me.success!==!1){if(T.isPinned){const Ne=[...qe,T.id];yt(Ne);try{await Nt("/api/db/config",{key:"pinned_section_ids",value:Ne,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}ae.success(`章节创建成功:${T.title}`),h(!1),P({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),Ln(),Yr(),br()}else ae.error("创建失败: "+(me&&typeof me=="object"&&"error"in me?me.error:"未知错误"))}catch(M){console.error(M),ae.error("创建失败")}finally{y(!1)}},Bo=M=>{P(Q=>{var me;return{...Q,partId:M.id,chapterId:((me=M.chapters[0])==null?void 0:me.id)??"chapter-1"}}),h(!0)},aa=M=>{D({id:M.id,title:M.title})},ia=async()=>{var M;if((M=F==null?void 0:F.title)!=null&&M.trim()){O(!0);try{const Q=t.map(Ne=>({id:Ne.id,partId:Ne.partId||"part-1",partTitle:Ne.partId===F.id?F.title.trim():Ne.partTitle||"",chapterId:Ne.chapterId||"chapter-1",chapterTitle:Ne.chapterTitle||""})),me=await Dt("/api/db/book",{action:"reorder",items:Q});if(me&&me.success!==!1){const Ne=F.title.trim();e(rt=>rt.map(mt=>mt.partId===F.id?{...mt,partTitle:Ne}:mt)),D(null),Ln()}else ae.error("更新篇名失败: "+(me&&typeof me=="object"&&"error"in me?me.error:"未知错误"))}catch(Q){console.error(Q),ae.error("更新篇名失败")}finally{O(!1)}}},_s=M=>{const Q=M.chapters.length+1,me=`chapter-${M.id}-${Q}-${Date.now()}`;P({id:`${Q}.1`,title:"新章节",price:1,partId:M.id,chapterId:me,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},oa=(M,Q)=>{he({part:M,chapter:Q,title:Q.title})},$=async()=>{var M;if((M=ne==null?void 0:ne.title)!=null&&M.trim()){z(!0);try{const Q=t.map(Ne=>({id:Ne.id,partId:Ne.partId||ne.part.id,partTitle:Ne.partId===ne.part.id?ne.part.title:Ne.partTitle||"",chapterId:Ne.chapterId||ne.chapter.id,chapterTitle:Ne.partId===ne.part.id&&Ne.chapterId===ne.chapter.id?ne.title.trim():Ne.chapterTitle||""})),me=await Dt("/api/db/book",{action:"reorder",items:Q});if(me&&me.success!==!1){const Ne=ne.title.trim(),rt=ne.part.id,mt=ne.chapter.id;e($t=>$t.map(dn=>dn.partId===rt&&dn.chapterId===mt?{...dn,chapterTitle:Ne}:dn)),he(null),Ln()}else ae.error("保存失败: "+(me&&typeof me=="object"&&"error"in me?me.error:"未知错误"))}catch(Q){console.error(Q),ae.error("保存失败")}finally{z(!1)}}},Te=async(M,Q)=>{const me=Q.sections.map(Ne=>Ne.id);if(me.length===0){ae.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${M.chapters.indexOf(Q)+1}章 | ${Q.title}」吗?将删除共 ${me.length} 节,此操作不可恢复。`))try{for(const Ne of me)await Ws(`/api/db/book?id=${encodeURIComponent(Ne)}`);Ln()}catch(Ne){console.error(Ne),ae.error("删除失败")}},Je=async()=>{if(!W.trim()){ae.error("请输入篇名");return}ce(!0);try{const M=`part-new-${Date.now()}`,Q="chapter-1",me=`part-placeholder-${Date.now()}`,Ne=await Dt("/api/db/book",{id:me,title:"占位节(可编辑)",price:0,content:"",partId:M,partTitle:W.trim(),chapterId:Q,chapterTitle:"第1章 | 待编辑",saveToFile:!1});Ne&&Ne.success!==!1?(ae.success(`篇「${W}」创建成功`),re(!1),se(""),Ln()):ae.error("创建失败: "+(Ne&&typeof Ne=="object"&&"error"in Ne?Ne.error:"未知错误"))}catch(M){console.error(M),ae.error("创建失败")}finally{ce(!1)}},ut=async()=>{if(U.length===0){ae.error("请先勾选要移动的章节");return}const M=Kn.find(me=>me.id===V),Q=M==null?void 0:M.chapters.find(me=>me.id===K);if(!M||!Q||!V||!K){ae.error("请选择目标篇和章");return}X(!0);try{const me=()=>{const $t=new Set(U),dn=t.map(zn=>({id:zn.id,partId:zn.partId||"",partTitle:zn.partTitle||"",chapterId:zn.chapterId||"",chapterTitle:zn.chapterTitle||""})),Wi=dn.filter(zn=>$t.has(zn.id)).map(zn=>({...zn,partId:V,partTitle:M.title||V,chapterId:K,chapterTitle:Q.title||K})),ys=dn.filter(zn=>!$t.has(zn.id));let Zr=ys.length;for(let zn=ys.length-1;zn>=0;zn-=1){const Ql=ys[zn];if(Ql.partId===V&&Ql.chapterId===K){Zr=zn+1;break}}return[...ys.slice(0,Zr),...Wi,...ys.slice(Zr)]},Ne=async()=>{const $t=me(),dn=await Dt("/api/db/book",{action:"reorder",items:$t});return dn&&dn.success!==!1?(ae.success(`已移动 ${U.length} 节到「${M.title}」-「${Q.title}」`),q(!1),H([]),await Ln(),!0):!1},rt={action:"move-sections",sectionIds:U,targetPartId:V,targetChapterId:K,targetPartTitle:M.title||V,targetChapterTitle:Q.title||K},mt=await Dt("/api/db/book",rt);if(mt&&mt.success!==!1)ae.success(`已移动 ${mt.count??U.length} 节到「${M.title}」-「${Q.title}」`),q(!1),H([]),await Ln();else{const $t=mt&&typeof mt=="object"&&"error"in mt?mt.error||"":"未知错误";if(($t.includes("缺少 id")||$t.includes("无效的 action"))&&await Ne())return;ae.error("移动失败: "+$t)}}catch(me){console.error(me),ae.error("移动失败: "+(me instanceof Error?me.message:"网络或服务异常"))}finally{X(!1)}},vn=M=>{H(Q=>Q.includes(M)?Q.filter(me=>me!==M):[...Q,M])},Cn=async M=>{const Q=t.filter(me=>me.partId===M.id).map(me=>me.id);if(Q.length===0){ae.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${M.title}」整篇吗?将删除共 ${Q.length} 节内容,此操作不可恢复。`))try{for(const me of Q)await Ws(`/api/db/book?id=${encodeURIComponent(me)}`);Ln()}catch(me){console.error(me),ae.error("删除失败")}},Hi=async()=>{var M;if(N.trim()){C(!0);try{const Q=await Oe(`/api/search?q=${encodeURIComponent(N)}`);Q!=null&&Q.success&&((M=Q.data)!=null&&M.results)?k(Q.data.results):(k([]),Q&&!Q.success&&ae.error("搜索失败: "+Q.error))}catch(Q){console.error(Q),k([]),ae.error("搜索失败")}finally{C(!1)}}},Ut=Kn.find(M=>M.id===T.partId),it=(Ut==null?void 0:Ut.chapters)??[];return 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.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",Kn.length," 篇 · ",rr," 节内容"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ee,{onClick:()=>on(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Mu,{className:"w-4 h-4 mr-2"}),"排名算法"]}),s.jsxs(ee,{onClick:()=>{const M=typeof window<"u"?`${window.location.origin}/api-doc`:"";M&&window.open(M,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ts,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),s.jsx(Rt,{open:u,onOpenChange:h,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Pt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(fn,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节ID *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:T.id,onChange:M=>P({...T,id:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:T.isFree?0:T.price,onChange:M=>P({...T,price:Number(M.target.value),isFree:Number(M.target.value)===0}),disabled:T.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isFree,onChange:M=>P({...T,isFree:M.target.checked,price:M.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isNew,onChange:M=>P({...T,isNew:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isPinned,onChange:M=>P({...T,isPinned:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium!==!0,onChange:()=>P({...T,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium===!0,onChange:()=>P({...T,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"热度分"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:T.hotScore??0,onChange:M=>P({...T,hotScore:Math.max(0,parseFloat(M.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:T.title,onChange:M=>P({...T,title:M.target.value})})]}),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.jsxs(bl,{value:T.partId,onValueChange:M=>{var me;const Q=Kn.find(Ne=>Ne.id===M);P({...T,partId:M,chapterId:((me=Q==null?void 0:Q.chapters[0])==null?void 0:me.id)??"chapter-1"})},children:[s.jsx(io,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(vl,{})}),s.jsxs(oo,{className:"bg-[#0f2137] border-gray-700",children:[Kn.map(M=>s.jsx(Fr,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id)),Kn.length===0&&s.jsx(Fr,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"所属章"}),s.jsxs(bl,{value:T.chapterId,onValueChange:M=>P({...T,chapterId:M}),children:[s.jsx(io,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(vl,{})}),s.jsxs(oo,{className:"bg-[#0f2137] border-gray-700",children:[it.map(M=>s.jsx(Fr,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id)),it.length===0&&s.jsx(Fr,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(Mx,{content:T.content||"",onChange:M=>P({...T,content:M}),onImageUpload:async M=>{var rt;const Q=new FormData;Q.append("file",M),Q.append("folder","book-images");const Ne=await(await fetch(wo("/api/upload"),{method:"POST",body:Q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((rt=Ne==null?void 0:Ne.data)==null?void 0:rt.url)||(Ne==null?void 0:Ne.url)||""},persons:Or,linkTags:pe,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(Xt,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(ee,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:Fo,disabled:g||!T.id||!T.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Rt,{open:!!F,onOpenChange:M=>!M&&D(null),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),F&&s.jsx("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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:F.title,onChange:M=>D({...F,title:M.target.value}),placeholder:"输入篇名"})]})}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",onClick:()=>D(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:ia,disabled:R||!((la=F==null?void 0:F.title)!=null&&la.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:R?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Rt,{open:!!ne,onOpenChange:M=>!M&&he(null),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),ne&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:ne.title,onChange:M=>he({...ne,title:M.target.value}),placeholder:"输入章节名称"})]})}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",onClick:()=>he(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:$,disabled:xe||!((ca=ne==null?void 0:ne.title)!=null&&ca.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:xe?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Rt,{open:I,onOpenChange:M=>{var Q;if(q(M),M&&Kn.length>0){const me=Kn[0];L(me.id),oe(((Q=me.chapters[0])==null?void 0:Q.id)??"")}},children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsx(Ot,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:U.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目标篇"}),s.jsxs(bl,{value:V,onValueChange:M=>{var me;L(M);const Q=Kn.find(Ne=>Ne.id===M);oe(((me=Q==null?void 0:Q.chapters[0])==null?void 0:me.id)??"")},children:[s.jsx(io,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(vl,{placeholder:"选择篇"})}),s.jsx(oo,{className:"bg-[#0f2137] border-gray-700",children:Kn.map(M=>s.jsx(Fr,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目标章"}),s.jsxs(bl,{value:K,onValueChange:oe,children:[s.jsx(io,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(vl,{placeholder:"选择章"})}),s.jsx(oo,{className:"bg-[#0f2137] border-gray-700",children:(((Xr=Kn.find(M=>M.id===V))==null?void 0:Xr.chapters)??[]).map(M=>s.jsx(Fr,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id))})]})]})]}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",onClick:()=>q(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:ut,disabled:Y||U.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Y?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Rt,{open:!!ye,onOpenChange:M=>!M&&Le(null),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white",children:["付款记录 — ",(ye==null?void 0:ye.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Pe?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):ye&&ye.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):ye?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"py-2 pr-2",children:"订单号"}),s.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),s.jsx("th",{className:"py-2 pr-2",children:"金额"}),s.jsx("th",{className:"py-2 pr-2",children:"状态"}),s.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),s.jsx("tbody",{children:ye.orders.map(M=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${M.orderSn}`,onClick:()=>window.open(`/orders?search=${M.orderSn??M.id??""}`,"_blank"),children:M.orderSn?M.orderSn.length>16?M.orderSn.slice(0,8)+"..."+M.orderSn.slice(-6):M.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${M.userId??M.openId??""}`,onClick:()=>window.open(`/users?search=${M.userId??M.openId??""}`,"_blank"),children:(()=>{const Q=M.userId??M.openId??"-";return Q.length>12?Q.slice(0,6)+"..."+Q.slice(-4):Q})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",M.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:M.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:M.payTime??M.createdAt??"-"})]},M.id??M.orderSn??""))})]}):null})]})}),s.jsx(Rt,{open:Mt,onOpenChange:on,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Mu,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),In?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"阅读权重"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:bt.readWeight,onChange:M=>nn(Q=>({...Q,readWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"新度权重"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:bt.recencyWeight,onChange:M=>nn(Q=>({...Q,recencyWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"付款权重"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:bt.payWeight,onChange:M=>nn(Q=>({...Q,payWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(bt.readWeight+bt.recencyWeight+bt.payWeight).toFixed(1)]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),s.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),s.jsx(ee,{onClick:Jl,disabled:Jt||Math.abs(bt.readWeight+bt.recencyWeight+bt.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Jt?"保存中...":"保存权重"})]})]})]})}),s.jsx(Rt,{open:_,onOpenChange:re,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(fn,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:W,onChange:M=>se(M.target.value),placeholder:"输入篇名"})]})}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",onClick:()=>{re(!1),se("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:Je,disabled:de||!W.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:de?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Rt,{open:!!o,onOpenChange:()=>c(null),children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Pt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:M=>c({...o,id:M.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:M=>c({...o,price:Number(M.target.value),isFree:Number(M.target.value)===0}),disabled:o.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:M=>c({...o,isFree:M.target.checked,price:M.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:M=>c({...o,isNew:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:M=>c({...o,isPinned:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium!==!0,onChange:()=>c({...o,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium===!0,onChange:()=>c({...o,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"热度分"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:M=>c({...o,hotScore:Math.max(0,parseFloat(M.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:M=>c({...o,title:M.target.value})})]}),o.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文件路径"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(Mx,{ref:na,content:o.content||"",onChange:M=>c({...o,content:M}),onImageUpload:async M=>{var rt;const Q=new FormData;Q.append("file",M),Q.append("folder","book-images");const Ne=await(await fetch(wo("/api/upload"),{method:"POST",body:Q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((rt=Ne==null?void 0:Ne.data)==null?void 0:rt.url)||(Ne==null?void 0:Ne.url)||""},persons:Or,linkTags:pe,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(Xt,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&s.jsxs(ee,{variant:"outline",onClick:()=>Vi({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[s.jsx(Wr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(ee,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(ee,{onClick:Yl,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(jd,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Vl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(Zt,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Wr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(Zt,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(_g,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(Zt,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Ta,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(Zt,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Ts,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(Zt,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Hv,{className:"w-4 h-4 mr-2"}),"链接标签"]}),s.jsxs(Zt,{value:"linkedmp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(vi,{className:"w-4 h-4 mr-2"}),"关联小程序"]})]}),s.jsxs(en,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx(Wr,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),s.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),s.jsxs("div",{className:"text-center shrink-0",children:[s.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:rr}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(ee,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(ee,{onClick:()=>re(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(ee,{variant:"outline",onClick:()=>q(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",U.length," 节)"]})]}),n?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(oV,{parts:Kn,expandedParts:a,onTogglePart:Di,onReorder:Jr,onReadSection:_n,onDeleteSection:Li,onAddSectionInPart:Bo,onAddChapterInPart:_s,onDeleteChapter:Te,onEditPart:aa,onDeletePart:Cn,onEditChapter:oa,selectedSectionIds:U,onToggleSectionSelect:vn,onShowSectionOrders:Vi,pinnedSectionIds:qe})]}),s.jsx(en,{value:"search",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"内容搜索"})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:N,onChange:M=>j(M.target.value),onKeyDown:M=>M.key==="Enter"&&Hi()}),s.jsx(ee,{onClick:Hi,disabled:E||!N.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?s.jsx(He,{className:"w-4 h-4 animate-spin"}):s.jsx(Ta,{className:"w-4 h-4"})})]}),v.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",v.length," 个结果"]}),v.map(M=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>_n({id:M.id,mid:M.mid,title:M.title,price:M.price??1,filePath:""}),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:M.id}),s.jsx("span",{className:"text-white",children:M.title}),qe.includes(M.id)&&s.jsx(co,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Ke,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:M.matchType==="title"?"标题匹配":"内容匹配"})]}),M.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:M.snippet}),(M.partTitle||M.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[M.partTitle," · ",M.chapterTitle]})]},M.id))]})]})]})}),s.jsxs(en,{value:"ranking",className:"space-y-4",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs(Qe,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Mu,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(Ie,{children:s.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Z,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(ie,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:gt,onChange:M=>Yt(Math.max(1,Math.min(100,Number(M.target.value)||20))),disabled:ln}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(ee,{size:"sm",onClick:Sr,disabled:nr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:nr?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",gt,"% 内容"]})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(Qe,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(_g,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",Pn.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Gr(),disabled:G,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(He,{className:`w-4 h-4 ${G?"animate-spin":""}`})}),s.jsx(ee,{variant:"ghost",size:"sm",disabled:Rn<=1||G,onClick:()=>xr(M=>Math.max(1,M-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(YT,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[Rn," / ",Dr]}),s.jsx(ee,{variant:"ghost",size:"sm",disabled:Rn>=Dr||G,onClick:()=>xr(M=>Math.min(Dr,M+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(lo,{className:"w-4 h-4"})})]})]})}),s.jsx(Ie,{children:s.jsxs("div",{className:"space-y-0",children:[s.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"排名"}),s.jsx("span",{children:"置顶"}),s.jsx("span",{children:"标题"}),s.jsx("span",{className:"text-right",children:"点击量"}),s.jsx("span",{className:"text-right",children:"付款数"}),s.jsx("span",{className:"text-right",children:"热度"}),s.jsx("span",{className:"text-right",children:"编辑"})]}),qr.map((M,Q)=>{const me=(Rn-1)*gs+Q+1,Ne=M.isPinned??qe.includes(M.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${Ne?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${me<=3?"text-amber-400":"text-gray-500"}`,children:me<=3?["🥇","🥈","🥉"][me-1]:`#${me}`}),s.jsx(ee,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${Ne?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Bi(M.id),disabled:ct,title:Ne?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:Ne?s.jsx(co,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(bA,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:M.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[M.partTitle," · ",M.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:M.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:M.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(M.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(ee,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>_n({id:M.id,mid:M.mid,title:M.title,price:M.price,filePath:""}),title:"编辑文章",children:s.jsx(Vt,{className:"w-3 h-3"})})})]},M.id)}),qr.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(en,{value:"link-person",className:"space-y-4",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{className:"pb-3",children:[s.jsxs(Qe,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"添加时自动生成 32 位 token,文章 @ 时存 token;小程序点击 @ 时用 token 兑换真实密钥后加好友"})]}),s.jsxs(Ie,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"添加人物时同步创建存客宝场景获客计划,配置与存客宝 API 获客一致"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ee,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>Yr(),title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsxs(ee,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{ea(null),On(!0)},children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Or.length>0?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("th",{className:"text-left py-1.5 px-3 w-[280px] font-normal",children:"token"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-24 font-normal",children:"@的人"}),s.jsx("th",{className:"text-left py-1.5 px-3 font-normal",children:"获客计划活动名"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-20 font-normal",children:"planId"}),s.jsx("th",{className:"text-left py-1.5 px-3 font-normal",children:"apiKey"}),s.jsx("th",{className:"text-left py-1.5 px-2 w-24 font-normal",children:"操作"})]})}),s.jsx("tbody",{children:Or.map(M=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"32位token",children:M.id}),s.jsx("td",{className:"py-2 px-3 text-amber-400 truncate max-w-[96px]",title:"@的人",children:M.name}),s.jsxs("td",{className:"py-2 px-3 text-white truncate max-w-[200px]",title:"获客计划活动名",children:["SOUL链接人与事-",M.name]}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"存客宝计划ID",children:M.ckbPlanId??"-"}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[M.ckbApiKey?s.jsx(ee,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-gray-500 hover:text-[#38bdac] shrink-0",title:"复制 apiKey",onClick:async()=>{await navigator.clipboard.writeText(M.ckbApiKey??""),ae.success("已复制到剪贴板")},children:s.jsx(Hx,{className:"w-3.5 h-3.5"})}):null,s.jsx("span",{title:M.ckbApiKey??"",children:M.ckbApiKey??"-"})]})}),s.jsx("td",{className:"py-2 px-2",children:s.jsxs("div",{className:"flex items-center gap-0",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const Q=await cV(M.personId||"");if(Q!=null&&Q.success&&Q.person){const me=Q.person;ea({id:me.token??me.personId,personId:me.personId,name:me.name,label:me.label??"",ckbApiKey:me.ckbApiKey??"",remarkType:me.remarkType,remarkFormat:me.remarkFormat,addFriendInterval:me.addFriendInterval,startTime:me.startTime,endTime:me.endTime,deviceGroups:me.deviceGroups})}else ea(M),Q!=null&&Q.error&&ae.error(Q.error)}catch(Q){console.error(Q),ea(M),ae.error(Q instanceof Error?Q.message:"加载人物详情失败")}On(!0)},children:s.jsx(rj,{className:"w-3 h-3"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-amber-400 h-6 px-2",title:"编辑计划(跳转存客宝)",onClick:()=>{const Q=M.ckbPlanId;Q?window.open(`https://h5.ckb.quwanzhi.com/#/scenarios/edit/${Q}`,"_blank"):ae.info("该人物尚未同步存客宝计划,请先保存后等待同步完成")},children:s.jsx(Ra,{className:"w-3 h-3"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:"删除(同时删除存客宝对应获客计划)",onClick:()=>ta(M),children:s.jsx(Zn,{className:"w-3 h-3"})})]})})]},M.id))})]}):s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{className:"pb-3",children:[s.jsxs(Qe,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Mu,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(Ie,{className:"space-y-3",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-400 text-xs",children:"存客宝 API 地址"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往"," ",s.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]}),s.jsx(en,{value:"link-tag",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{className:"pb-3",children:[s.jsxs(Qe,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Hv,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(Ie,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap justify-between",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"标签ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:xt.tagId,onChange:M=>Dn({...xt,tagId:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"显示文字"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:xt.label,onChange:M=>Dn({...xt,label:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"类型"}),s.jsxs(bl,{value:xt.type,onValueChange:M=>Dn({...xt,type:M}),children:[s.jsx(io,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:s.jsx(vl,{})}),s.jsxs(oo,{children:[s.jsx(Fr,{value:"url",children:"网页链接"}),s.jsx(Fr,{value:"miniprogram",children:"小程序"}),s.jsx(Fr,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:xt.type==="url"?"URL地址":xt.type==="ckb"?"存客宝计划URL":"小程序(选密钥)"}),xt.type==="miniprogram"&&Qr.length>0?s.jsxs("div",{ref:zo,className:"relative w-44",children:[s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:"搜索名称或密钥",value:Fi?Ls:xt.appId,onChange:M=>{const Q=M.target.value;It(Q),xs(!0),Qr.some(me=>me.key===Q)||Dn({...xt,appId:Q})},onFocus:()=>{It(xt.appId),xs(!0)},onBlur:()=>setTimeout(()=>xs(!1),150)}),Fi&&s.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 max-h-48 overflow-y-auto rounded-md border border-gray-700 bg-[#0a1628] shadow-lg z-50",children:$o.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):$o.map(M=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:Q=>{Q.preventDefault(),Dn({...xt,appId:M.key,pagePath:M.path||""}),It(""),xs(!1)},children:[s.jsx("span",{children:M.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:M.key})]},M.key))})]}):s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:xt.type==="url"?"https://...":xt.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联小程序的32位密钥",value:xt.type==="url"||xt.type==="ckb"?xt.url:xt.appId,onChange:M=>{xt.type==="url"||xt.type==="ckb"?Dn({...xt,url:M.target.value}):Dn({...xt,appId:M.target.value})}})]}),xt.type==="miniprogram"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"页面路径"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:xt.pagePath,onChange:M=>Dn({...xt,pagePath:M.target.value})})]}),s.jsxs(ee,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!xt.tagId||!xt.label){ae.error("标签ID和显示文字必填");return}const M={...xt};M.type==="miniprogram"&&(M.url=""),await Nt("/api/db/link-tags",M),Dn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Ds(null),br()},children:[s.jsx(fn,{className:"w-3 h-3 mr-1"}),yr?"保存":"添加"]})]}),s.jsx(ee,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>br(),title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[pe.map(M=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[s.jsxs("button",{type:"button",className:"text-amber-400 font-bold text-base hover:underline",onClick:()=>{Dn({tagId:M.id,label:M.label,url:M.url,type:M.type,appId:M.appId??"",pagePath:M.pagePath??""}),Ds(M.id)},children:["#",M.label]}),s.jsx(Ke,{variant:"secondary",className:`text-[10px] ${M.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:M.type==="url"?"网页":M.type==="ckb"?"存客宝":"小程序"}),M.type==="miniprogram"?s.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[M.appId," ",M.pagePath?`· ${M.pagePath}`:""]}):M.url?s.jsxs("a",{href:M.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[M.url," ",s.jsx(Ra,{className:"w-3 h-3 shrink-0"})]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-6 px-2",onClick:()=>{Dn({tagId:M.id,label:M.label,url:M.url,type:M.type,appId:M.appId??"",pagePath:M.pagePath??""}),Ds(M.id)},children:"编辑"}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Ws(`/api/db/link-tags?tagId=${M.id}`),yr===M.id&&(Ds(null),Dn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""})),br()},children:s.jsx(Zn,{className:"w-3 h-3"})})]})]},M.id)),pe.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]})}),s.jsx(en,{value:"linkedmp",className:"space-y-4",children:s.jsx(aV,{})})]}),s.jsx(uV,{open:cn,onOpenChange:On,editingPerson:Zs,onSubmit:async M=>{var Ne;const Q={personId:M.personId||M.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:M.name,label:M.label,ckbApiKey:M.ckbApiKey||void 0,greeting:M.greeting||void 0,tips:M.tips||void 0,remarkType:M.remarkType||void 0,remarkFormat:M.remarkFormat||void 0,addFriendInterval:M.addFriendInterval,startTime:M.startTime||void 0,endTime:M.endTime||void 0,deviceGroups:(Ne=M.deviceGroups)!=null&&Ne.trim()?M.deviceGroups.split(",").map(rt=>parseInt(rt.trim(),10)).filter(rt=>!Number.isNaN(rt)):void 0},me=await Nt("/api/db/persons",Q);if(me&&me.success===!1){const rt=me;rt.ckbResponse&&console.log("存客宝返回",rt.ckbResponse);const mt=rt.error||"操作失败";throw new Error(mt)}if(Yr(),ae.success(Zs?"已保存":"已添加"),me!=null&&me.ckbCreateResult&&Object.keys(me.ckbCreateResult).length>0){const rt=me.ckbCreateResult;console.log("存客宝创建结果",rt);const mt=rt.planId??rt.id,$t=mt!=null?[`planId: ${mt}`]:[];rt.apiKey!=null&&$t.push("apiKey: ***"),ae.info($t.length?`存客宝创建结果:${$t.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Rt,{open:!!ms,onOpenChange:M=>{M||ta(null)},children:s.jsxs(Tt,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Pt,{className:"gap-1",children:[s.jsx(Ot,{className:"text-white text-base",children:"确认删除"}),s.jsx(bf,{className:"text-gray-400 text-sm leading-relaxed break-words",children:ms&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除「SOUL链接人与事-",ms.name,"」?将同时删除存客宝对应获客计划。"]}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",ms.name," 将无法正常跳转。"]})]})})]}),s.jsxs(Xt,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(ee,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>ta(null),children:"取消"}),s.jsx(ee,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{ms&&(await Ws(`/api/db/persons?personId=${ms.personId}`),ta(null),Yr(),ae.success("已删除"))},children:"确定删除"})]})]})})]})}const Ca={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function ww(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):Ca.stats}function jw(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Ca.highlights}function pV(){const[t,e]=b.useState(Ca),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Oe("/api/admin/author-settings").then(k=>{const E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??Ca.name),avatar:String(E.avatar??Ca.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??Ca.title),bio:String(E.bio??Ca.bio),stats:ww(E.stats).length?ww(E.stats):Ca.stats,highlights:jw(E.highlights).length?jw(E.highlights):Ca.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{i(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(T=>T.label||T.value),highlights:t.highlights.filter(Boolean)},E=await Nt("/api/admin/author-settings",k);if(!E||E.success===!1){ae.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:""));return}i(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),ae.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var C;const E=(C=k.target.files)==null?void 0:C[0];if(E){c(!0);try{const T=new FormData;T.append("file",E),T.append("folder","avatars");const P=vd(),F={};P&&(F.Authorization=`Bearer ${P}`);const R=await(await fetch(wo("/api/upload"),{method:"POST",body:T,credentials:"include",headers:F})).json();R!=null&&R.success&&(R!=null&&R.url)?e(O=>({...O,avatarImg:R.url})):ae.error("上传失败: "+((R==null?void 0:R.error)||"未知错误"))}catch(T){console.error(T),ae.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(E=>({...E,stats:E.stats.filter((C,T)=>T!==k)})),y=(k,E,C)=>e(T=>({...T,stats:T.stats.map((P,F)=>F===k?{...P,[E]:C}:P)})),N=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(E=>({...E,highlights:E.highlights.filter((C,T)=>T!==k)})),v=(k,E)=>e(C=>({...C,highlights:C.highlights.map((T,P)=>P===k?E:T)}));return n?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(go,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(ee,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"flex items-center gap-2 text-white",children:[s.jsx(go,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Lt,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(Ie,{className:"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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(E=>({...E,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(E=>({...E,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ej,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(E=>({...E,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(ee,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[s.jsx(fh,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ps(t.avatarImg.startsWith("http")?t.avatarImg:wo(t.avatarImg)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"头衔"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(E=>({...E,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"个人简介"}),s.jsx(Hl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(E=>({...E,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsx(Qe,{className:"text-white",children:"统计数据"}),s.jsx(Lt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(Ie,{className:"space-y-3",children:[t.stats.map((k,E)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>y(E,"label",C.target.value),placeholder:"标签"}),s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>y(E,"value",C.target.value),placeholder:"数值"}),s.jsx(ee,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(E),children:s.jsx(Zn,{className:"w-4 h-4"})})]},E)),s.jsxs(ee,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsx(Qe,{className:"text-white",children:"亮点标签"}),s.jsx(Lt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(Ie,{className:"space-y-3",children:[t.highlights.map((k,E)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>v(E,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(ee,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(E),children:s.jsx(Zn,{className:"w-4 h-4"})})]},E)),s.jsxs(ee,{variant:"outline",size:"sm",onClick:N,className:"border-gray-600 text-gray-400",children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function mV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=a0(h,300),[g,y]=b.useState(!0),[N,j]=b.useState(null),[v,k]=b.useState(!1),[E,C]=b.useState(null),[T,P]=b.useState(""),[F,D]=b.useState(""),[R,O]=b.useState(""),[_,re]=b.useState("admin"),[ne,he]=b.useState("active"),[xe,z]=b.useState(!1);async function U(){var K;y(!0),j(null);try{const oe=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&oe.set("search",m.trim());const Y=await Oe(`/api/admin/admin-users?${oe}`);Y!=null&&Y.success?(e(Y.records||[]),r(Y.total??0),u(Y.totalPages??0)):j(Y.error||"加载失败")}catch(oe){const Y=oe;j(Y.status===403?"无权限访问":((K=Y==null?void 0:Y.data)==null?void 0:K.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{U()},[a,o,m]);const H=()=>{C(null),P(""),D(""),O(""),re("admin"),he("active"),k(!0)},I=K=>{C(K),P(K.username),D(""),O(K.name||""),re(K.role==="super_admin"?"super_admin":"admin"),he(K.status==="disabled"?"disabled":"active"),k(!0)},q=async()=>{var K;if(!T.trim()){j("用户名不能为空");return}if(!E&&!F){j("新建时密码必填,至少 6 位");return}if(F&&F.length<6){j("密码至少 6 位");return}j(null),z(!0);try{if(E){const oe=await Dt("/api/admin/admin-users",{id:E.id,password:F||void 0,name:R.trim(),role:_,status:ne});oe!=null&&oe.success?(k(!1),U()):j((oe==null?void 0:oe.error)||"保存失败")}else{const oe=await Nt("/api/admin/admin-users",{username:T.trim(),password:F,name:R.trim(),role:_});oe!=null&&oe.success?(k(!1),U()):j((oe==null?void 0:oe.error)||"保存失败")}}catch(oe){const Y=oe;j(((K=Y==null?void 0:Y.data)==null?void 0:K.error)||"保存失败")}finally{z(!1)}},V=async K=>{var oe;if(confirm("确定删除该管理员?"))try{const Y=await Ws(`/api/admin/admin-users?id=${K}`);Y!=null&&Y.success?U():j((Y==null?void 0:Y.error)||"删除失败")}catch(Y){const X=Y;j(((oe=X==null?void 0:X.data)==null?void 0:oe.error)||"删除失败")}},L=K=>{if(!K)return"-";try{const oe=new Date(K);return isNaN(oe.getTime())?K:oe.toLocaleString("zh-CN")}catch{return K}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Vc,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{placeholder:"搜索用户名/昵称",value:h,onChange:K=>f(K.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(ee,{variant:"outline",size:"sm",onClick:U,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(He,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(ee,{onClick:H,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),N&&s.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[s.jsx("span",{children:N}),s.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"ID"}),s.jsx(ke,{className:"text-gray-400",children:"用户名"}),s.jsx(ke,{className:"text-gray-400",children:"昵称"}),s.jsx(ke,{className:"text-gray-400",children:"角色"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-gray-400",children:"创建时间"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(fr,{children:[t.map(K=>s.jsxs(ot,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:K.id}),s.jsx(be,{className:"text-white font-medium",children:K.username}),s.jsx(be,{className:"text-gray-400",children:K.name||"-"}),s.jsx(be,{children:s.jsx(Ke,{variant:"outline",className:K.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:K.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(be,{children:s.jsx(Ke,{variant:"outline",className:K.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:K.status==="active"?"正常":"已禁用"})}),s.jsx(be,{className:"text-gray-500 text-sm",children:L(K.createdAt)}),s.jsxs(be,{className:"text-right",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>I(K),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(Vt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>V(K.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Yn,{className:"w-4 h-4"})})]})]},K.id)),t.length===0&&!g&&s.jsx(ot,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:N==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(us,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Rt,{open:v,onOpenChange:k,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Pt,{children:s.jsx(Ot,{className:"text-white",children:E?"编辑管理员":"新增管理员"})}),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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:T,onChange:K=>P(K.target.value),disabled:!!E}),E&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:E?"新密码(留空不改)":"密码"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:E?"留空表示不修改":"至少 6 位",value:F,onChange:K=>D(K.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:R,onChange:K=>O(K.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:_,onChange:K=>re(K.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),E&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:ne,onChange:K=>he(K.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(Xt,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:q,disabled:xe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),xe?"保存中...":"保存"]})]})]})})]})}function wn({method:t,url:e,desc:n,headers:r,body:a,response:i}){const o=t==="GET"?"text-emerald-400":t==="POST"?"text-amber-400":t==="PUT"?"text-blue-400":t==="DELETE"?"text-rose-400":"text-gray-400";return s.jsxs("div",{className:"rounded-lg bg-[#0a1628]/60 border border-gray-700/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:`font-mono font-semibold ${o}`,children:t}),s.jsx("code",{className:"text-sm text-[#38bdac] break-all",children:e})]}),n&&s.jsx("p",{className:"text-gray-400 text-sm",children:n}),r&&r.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Headers"}),s.jsx("pre",{className:"text-xs text-gray-300 font-mono overflow-x-auto p-2 rounded bg-black/30",children:r.join(` +`)})]}),a&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Request Body (JSON)"}),s.jsx("pre",{className:"text-xs text-green-400/90 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:a})]}),i&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Response Example"}),s.jsx("pre",{className:"text-xs text-amber-200/80 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:i})]})]})}function B4(){const t=["Authorization: Bearer {token}","Content-Type: application/json"];return s.jsxs("div",{className:"p-8 w-full bg-[#0a1628] text-white",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"内容管理相关接口 · RESTful · 基础路径 /api · 管理端需 Bearer Token"})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(tj,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(Ie,{className:"space-y-4",children:s.jsx(wn,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ + "username": "admin", + "password": "your_password" +}`,response:`{ + "success": true, + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", + "expires_at": "2026-03-16T12:00:00Z" +}`})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Wr,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsx(wn,{method:"GET",url:"/api/db/book?action=chapters",desc:"获取章节树",headers:t,response:`{ + "success": true, + "data": [ + { "id": "part-1", "title": "第一篇", "children": [...] }, + { "id": "section-1", "title": "第1节", "price": 1.0, "isFree": false } + ] +}`}),s.jsx(wn,{method:"GET",url:"/api/db/book?action=section&id={id}",desc:"获取单篇内容",headers:t,response:`{ + "success": true, + "data": { + "id": "section-1", + "title": "标题", + "content": "正文...", + "price": 1.0, + "isFree": false, + "partId": "part-1", + "chapterId": "ch-1" + } +}`}),s.jsx(wn,{method:"POST",url:"/api/db/book",desc:"新建章节 (action=create-section)",headers:t,body:`{ + "action": "create-section", + "title": "新章节标题", + "content": "正文内容", + "price": 0, + "isFree": true, + "partId": "part-1", + "chapterId": "ch-1", + "partTitle": "第一篇", + "chapterTitle": "第1章" +}`,response:`{ + "success": true, + "data": { "id": "section-new-id", "title": "新章节标题", ... } +}`}),s.jsx(wn,{method:"POST",url:"/api/db/book",desc:"更新章节内容 (action=update-section)",headers:t,body:`{ + "action": "update-section", + "id": "section-1", + "title": "更新后的标题", + "content": "更新后的正文", + "price": 1.0, + "isFree": false +}`,response:`{ + "success": true, + "data": { "id": "section-1", "title": "更新后的标题", ... } +}`}),s.jsx(wn,{method:"POST",url:"/api/db/book",desc:"删除章节 (action=delete-section)",headers:t,body:`{ + "action": "delete-section", + "id": "section-1" +}`,response:`{ + "success": true, + "message": "已删除" +}`}),s.jsx(wn,{method:"POST",url:"/api/admin/content/upload",desc:"上传图片(管理端)",headers:t,body:"FormData: file (binary)",response:`{ + "success": true, + "url": "/uploads/images/xxx.jpg", + "data": { "url", "fileName", "size", "type" } +}`})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(go,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsx(wn,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ + "success": true, + "data": [ + { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } + ] +}`}),s.jsx(wn,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ + "success": true, + "data": { + "personId": "p1", + "label": "张三", + "aliases": ["老张"], + "description": "..." + } +}`}),s.jsx(wn,{method:"POST",url:"/api/db/persons",desc:"新增/更新人物(含 aliases 字段)",headers:t,body:`{ + "personId": "p1", + "label": "张三", + "aliases": ["老张", "张三丰"], + "description": "可选描述" +}`,response:`{ + "success": true, + "data": { "personId": "p1", "label": "张三", ... } +}`}),s.jsx(wn,{method:"DELETE",url:"/api/db/persons?personId={id}",desc:"删除人物",headers:t,response:`{ + "success": true, + "message": "已删除" +}`})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Hc,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsx(wn,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ + "success": true, + "data": [ + { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } + ] +}`}),s.jsx(wn,{method:"POST",url:"/api/db/link-tags",desc:"新增/更新标签(含 aliases, type: url/miniprogram/ckb)",headers:t,body:`{ + "tagId": "t1", + "label": "官网", + "aliases": ["官方网站"], + "type": "url", + "url": "https://example.com" +} + +// type 可选: url | miniprogram | ckb`,response:`{ + "success": true, + "data": { "tagId": "t1", "label": "官网", "type": "url", ... } +}`}),s.jsx(wn,{method:"DELETE",url:"/api/db/link-tags?tagId={id}",desc:"删除标签",headers:t,response:`{ + "success": true, + "message": "已删除" +}`})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Ta,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(Ie,{className:"space-y-4",children:s.jsx(wn,{method:"GET",url:"/api/search?q={keyword}",desc:"搜索(标题优先 3 条 + 内容匹配)",headers:t,response:`{ + "success": true, + "data": { + "titleMatches": [{ "id": "s1", "title": "...", "snippet": "..." }], + "contentMatches": [{ "id": "s2", "title": "...", "snippet": "..." }] + } +}`})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(_g,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(Ie,{className:"space-y-4",children:s.jsx(wn,{method:"GET",url:"/api/db/book?action=ranking",desc:"排行榜数据",headers:t,response:`{ + "success": true, + "data": [ + { "id": "s1", "title": "...", "clickCount": 100, "payCount": 50, "hotScore": 120, "hotRank": 1 } + ] +}`})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{className:"pb-3",children:s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(vi,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsx(wn,{method:"GET",url:"/api/miniprogram/book/all-chapters",desc:"全部章节(小程序用)",headers:["Content-Type: application/json"],response:`{ + "success": true, + "data": [ { "id": "s1", "title": "...", "price": 1.0, "isFree": false }, ... ] +}`}),s.jsx(wn,{method:"GET",url:"/api/miniprogram/balance?userId={id}",desc:"查余额",headers:["Content-Type: application/json"],response:`{ + "success": true, + "data": { "balance": 100.50, "userId": "xxx" } +}`}),s.jsx(wn,{method:"POST",url:"/api/miniprogram/balance/gift",desc:"代付",headers:["Content-Type: application/json"],body:`{ + "userId": "xxx", + "amount": 10.00, + "remark": "可选备注" +}`,response:`{ + "success": true, + "data": { "balance": 110.50 } +}`}),s.jsx(wn,{method:"POST",url:"/api/miniprogram/balance/gift/redeem",desc:"领取代付",headers:["Content-Type: application/json"],body:`{ + "code": "GIFT_XXXX" +}`,response:`{ + "success": true, + "data": { "amount": 10.00, "balance": 120.50 } +}`})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-6",children:"管理端仅使用 /api/admin/*、/api/db/*;小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const gV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},xV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},yV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...xV},ckbLeadApiKey:""},bV={endpoint:"",accessKeyId:"",accessKeySecret:"",bucket:"",region:""},vV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},NV=["system","author","admin","api-docs"];function wV(){const[t,e]=Kw(),n=t.get("tab")??"system",r=NV.includes(n)?n:"system",[a,i]=b.useState(yV),[o,c]=b.useState(vV),[u,h]=b.useState(gV),[f,m]=b.useState(bV),[g,y]=b.useState(!1),[N,j]=b.useState(!0),[v,k]=b.useState(!1),[E,C]=b.useState(""),[T,P]=b.useState(""),[F,D]=b.useState(!1),[R,O]=b.useState(!1),_=(I,q,V=!1)=>{C(I),P(q),D(V),k(!0)};b.useEffect(()=>{(async()=>{try{const q=await Oe("/api/admin/settings");if(!q||q.success===!1)return;if(q.featureConfig&&Object.keys(q.featureConfig).length&&c(V=>({...V,...q.featureConfig})),q.mpConfig&&typeof q.mpConfig=="object"&&h(V=>({...V,...q.mpConfig})),q.ossConfig&&typeof q.ossConfig=="object"&&m(V=>({...V,...q.ossConfig})),q.siteSettings&&typeof q.siteSettings=="object"){const V=q.siteSettings;i(L=>({...L,...typeof V.sectionPrice=="number"&&{sectionPrice:V.sectionPrice},...typeof V.baseBookPrice=="number"&&{baseBookPrice:V.baseBookPrice},...typeof V.distributorShare=="number"&&{distributorShare:V.distributorShare},...V.authorInfo&&typeof V.authorInfo=="object"&&{authorInfo:{...L.authorInfo,...V.authorInfo}},...typeof V.ckbLeadApiKey=="string"&&{ckbLeadApiKey:V.ckbLeadApiKey}}))}}catch(q){console.error("Load settings error:",q)}finally{j(!1)}})()},[]);const re=async(I,q)=>{O(!0);try{const V=await Nt("/api/admin/settings",{featureConfig:I});if(!V||V.success===!1){q(),_("保存失败",(V==null?void 0:V.error)??"未知错误",!0);return}_("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(V){console.error("Save feature config error:",V),q(),_("保存失败",V instanceof Error?V.message:String(V),!0)}finally{O(!1)}},ne=(I,q)=>{const V=o,L={...V,[I]:q};c(L),re(L,()=>c(V))},[he,xe]=b.useState(!1),z=async I=>{const q=u,V={...q,auditMode:I};h(V),xe(!0);try{const L=await Nt("/api/admin/settings",{mp_config:V});if(!L||L.success===!1){h(q),_("保存失败",(L==null?void 0:L.error)??"未知错误",!0);return}_("已保存",I?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(L){h(q),_("保存失败",L instanceof Error?L.message:String(L),!0)}finally{xe(!1)}},U=async()=>{y(!0);try{const I=await Nt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:a.sectionPrice,baseBookPrice:a.baseBookPrice,distributorShare:a.distributorShare,authorInfo:a.authorInfo,ckbLeadApiKey:a.ckbLeadApiKey||void 0},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10},ossConfig:{endpoint:f.endpoint||"",accessKeyId:f.accessKeyId||"",accessKeySecret:f.accessKeySecret||"",bucket:f.bucket||"",region:f.region||""}});if(!I||I.success===!1){_("保存失败",(I==null?void 0:I.error)??"未知错误",!0);return}_("已保存","设置已保存成功。")}catch(I){console.error("Save settings error:",I),_("保存失败",I instanceof Error?I.message:String(I),!0)}finally{y(!1)}},H=I=>{e(I==="system"?{}:{tab:I})};return N?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-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&s.jsxs(ee,{onClick:U,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存设置"]})]}),s.jsxs(jd,{value:r,onValueChange:H,className:"w-full",children:[s.jsxs(Vl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(Zt,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(mo,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(Zt,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Mm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(Zt,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Vc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(Zt,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Wr,{className:"w-4 h-4 mr-2"}),"API 文档"]})]}),s.jsx(en,{value:"system",className:"mt-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Mm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Lt,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Mm,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(ie,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.name??"",onChange:I=>i(q=>({...q,authorInfo:{...q.authorInfo,name:I.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Mg,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(ie,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:a.authorInfo.startDate??"",onChange:I=>i(q=>({...q,authorInfo:{...q.authorInfo,startDate:I.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Mg,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(ie,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:a.authorInfo.liveTime??"",onChange:I=>i(q=>({...q,authorInfo:{...q.authorInfo,liveTime:I.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(nj,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(ie,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:a.authorInfo.platform??"",onChange:I=>i(q=>({...q,authorInfo:{...q.authorInfo,platform:I.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Wr,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(ie,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.description??"",onChange:I=>i(q=>({...q,authorInfo:{...q.authorInfo,description:I.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(Hl,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:a.authorInfo.bio??"",onChange:I=>i(q=>({...q,authorInfo:{...q.authorInfo,bio:I.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ts,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(ie,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:a.ckbLeadApiKey??"",onChange:I=>i(q=>({...q,ckbLeadApiKey:I.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(a.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:a.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:a.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",a.authorInfo.liveTime," · ",a.authorInfo.platform]})]})]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(hh,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(Ie,{className:"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(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.sectionPrice,onChange:I=>i(q=>({...q,sectionPrice:Number.parseFloat(I.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.baseBookPrice,onChange:I=>i(q=>({...q,baseBookPrice:Number.parseFloat(I.target.value)||9.9}))})]})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(vi,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Lt,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsx(Ie,{className:"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:"小程序 AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:I=>h(q=>({...q,appId:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:I=>h(q=>({...q,withdrawSubscribeTmplId:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:I=>h(q=>({...q,mchId:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:I=>h(q=>({...q,minWithdraw:Number.parseFloat(I.target.value)||10}))})]})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(oM,{className:"w-5 h-5 text-[#38bdac]"}),"阿里云 OSS 配置"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置阿里云对象存储,用于图片和视频的云端存储(配置后将替代本地存储)"})]}),s.jsxs(Ie,{className:"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:"Endpoint"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:f.endpoint??"",onChange:I=>m(q=>({...q,endpoint:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"Region"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:f.region??"",onChange:I=>m(q=>({...q,region:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"LTAI5t...",value:f.accessKeyId??"",onChange:I=>m(q=>({...q,accessKeyId:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"********",value:f.accessKeySecret??"",onChange:I=>m(q=>({...q,accessKeySecret:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2 col-span-2",children:[s.jsx(Z,{className:"text-gray-300",children:"Bucket 名称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"my-soul-bucket",value:f.bucket??"",onChange:I=>m(q=>({...q,bucket:I.target.value}))})]})]}),s.jsx("div",{className:`p-3 rounded-lg ${f.endpoint&&f.bucket&&f.accessKeyId?"bg-green-500/10 border border-green-500/30":"bg-amber-500/10 border border-amber-500/30"}`,children:s.jsx("p",{className:`text-xs ${f.endpoint&&f.bucket&&f.accessKeyId?"text-green-300":"text-amber-300"}`,children:f.endpoint&&f.bucket&&f.accessKeyId?`✅ OSS 已配置(${f.bucket}.${f.endpoint}),上传将自动使用云端存储`:"⚠ 未配置 OSS,当前上传存储在本地服务器。填写以上信息并保存后自动启用云端存储"})})]})]}),s.jsxs(Ae,{className:`bg-[#0f2137] shadow-xl ${u.auditMode?"border-amber-500/50 border-2":"border-gray-700/50"}`,children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Vc,{className:"w-5 h-5 text-amber-400"}),"小程序审核模式"]}),s.jsx(Lt,{className:"text-gray-400",children:"提交微信审核前开启,审核通过后关闭即可恢复支付功能"})]}),s.jsx(Ie,{children:s.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg border ${u.auditMode?"bg-amber-500/10 border-amber-500/30":"bg-[#0a1628] border-gray-700/50"}`,children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vc,{className:`w-4 h-4 ${u.auditMode?"text-amber-400":"text-gray-400"}`}),s.jsx(Z,{htmlFor:"audit-mode",className:"text-white font-medium cursor-pointer",children:u.auditMode?"审核模式(已开启)":"审核模式(已关闭)"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:u.auditMode?"当前已隐藏所有支付、VIP、充值、收益等入口,审核员看不到任何付费内容":"关闭状态,小程序正常显示所有功能(含支付、VIP 等)"})]}),s.jsx(kt,{id:"audit-mode",checked:u.auditMode??!1,disabled:he,onCheckedChange:z})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(mo,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Lt,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(cr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(kt,{id:"match-enabled",checked:o.matchEnabled,disabled:R,onCheckedChange:I=>ne("matchEnabled",I)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Zw,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),s.jsx(kt,{id:"referral-enabled",checked:o.referralEnabled,disabled:R,onCheckedChange:I=>ne("referralEnabled",I)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Wr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),s.jsx(kt,{id:"search-enabled",checked:o.searchEnabled,disabled:R,onCheckedChange:I=>ne("searchEnabled",I)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(mo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(kt,{id:"about-enabled",checked:o.aboutEnabled,disabled:R,onCheckedChange:I=>ne("aboutEnabled",I)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),s.jsx(en,{value:"author",className:"mt-0",children:s.jsx(pV,{})}),s.jsx(en,{value:"admin",className:"mt-0",children:s.jsx(mV,{})}),s.jsx(en,{value:"api-docs",className:"mt-0",children:s.jsx(B4,{})})]}),s.jsx(Rt,{open:v,onOpenChange:k,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Pt,{children:[s.jsx(Ot,{className:F?"text-red-400":"text-[#38bdac]",children:E}),s.jsx(bf,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:T})]}),s.jsx(Xt,{className:"mt-4",children:s.jsx(ee,{onClick:()=>k(!1),className:F?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const kw={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function jV(){const[t,e]=b.useState(!1),[n,r]=b.useState(kw),[a,i]=b.useState(""),o=async()=>{e(!0);try{const k=await Oe("/api/config");k!=null&&k.paymentMethods&&r({...kw,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await Nt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),ae.success("配置已保存!")}catch(k){console.error("保存失败:",k),ae.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,E)=>{navigator.clipboard.writeText(k),i(E),setTimeout(()=>i(""),2e3)},h=(k,E)=>{r(C=>({...C,wechat:{...C.wechat,[k]:E}}))},f=(k,E)=>{r(C=>({...C,alipay:{...C.alipay,[k]:E}}))},m=(k,E)=>{r(C=>({...C,usdt:{...C.usdt,[k]:E}}))},g=(k,E)=>{r(C=>({...C,paypal:{...C.paypal,[k]:E}}))},y=n.wechat,N=n.alipay,j=n.usdt,v=n.paypal;return 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.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ee,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(ee,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Yw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),s.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[s.jsx("li",{children:"打开微信,进入目标微信群"}),s.jsx("li",{children:'点击右上角"..." → "群二维码"'}),s.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),s.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),s.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),s.jsxs(jd,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Vl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(Zt,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(vi,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(Zt,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(Vv,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(Zt,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(Fv,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(Zt,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Og,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(en,{value:"wechat",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Qe,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(vi,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(kt,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(Ie,{className:"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:"网站AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"商户号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ra,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),s.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[s.jsx(Z,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(ie,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(en,{value:"alipay",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Qe,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(Vv,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Lt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(kt,{checked:!!N.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(Ie,{className:"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:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(ee,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(N.partnerId??""),"pid"),children:a==="pid"?s.jsx(mf,{className:"w-4 h-4 text-green-500"}):s.jsx(Hx,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ra,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(N.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(en,{value:"usdt",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Qe,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(Fv,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(kt,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"收款地址"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(j.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(en,{value:"paypal",className:"space-y-4",children:s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Qe,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Og,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(kt,{checked:!!v.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(v.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(v.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const kV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},SV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},CV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function EV(){const[t,e]=b.useState({siteConfig:{...kV},menuConfig:{...SV},pageConfig:{...CV}}),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{Oe("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{i(!0);try{await Nt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await Nt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await Nt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),ae.success("配置已保存")}catch(f){console.error(f),ae.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{i(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return 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.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(ee,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Og,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(Ie,{className:"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,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(ie,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(ie,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(ie,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(ie,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(ie,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(uA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(Ie,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(Z,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ie,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),s.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(sA,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Lt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(Ie,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(kt,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(bM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(Ie,{className:"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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首页副标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function TV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[a,i]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,N,j,v;try{const k=await Oe("/api/config"),E=(N=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:N.urls;Array.isArray(E)&&e(E.join(` +`));const C=(v=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:v.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,N)=>{navigator.clipboard.writeText(y),i(N),setTimeout(()=>i(""),2e3)},f=async()=>{try{const y=t.split(` +`).map(j=>j.trim()).filter(Boolean),N=[...o.liveQRCodes||[]];N[0]?N[0].urls=y:N.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await Nt("/api/db/config",{key:"live_qr_codes",value:N,description:"群活码配置"}),ae.success("群活码配置已保存!"),await u()}catch(y){console.error(y),ae.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await Nt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),ae.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(N){console.error(N),ae.error("保存失败: "+(N instanceof Error?N.message:String(N)))}},g=()=>{n?window.open(n,"_blank"):ae.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Yw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Wv,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Lt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Dg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:y=>r(y.target.value)}),s.jsx(ee,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(mf,{className:"w-4 h-4 text-green-500"}):s.jsx(Hx,{className:"w-4 h-4 text-gray-400"})})]}),s.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[s.jsx(Ra,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ee,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(fh,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(ee,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(Ra,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Wv,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(Ie,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Dg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(Hl,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` +`).filter(Boolean).length," 个"]})]}),s.jsxs(ee,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(fh,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),s.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[s.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),s.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),s.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const Sw={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},MV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function AV(){const[t,e]=b.useState(Sw),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Oe("/api/db/config/full?key=match_config"),T=(C==null?void 0:C.data)??(C==null?void 0:C.config);T&&e({...Sw,...T})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{i(!0);try{const C=await Nt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?ae.success("配置保存成功!"):ae.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),ae.error("保存失败")}finally{i(!1)}},N=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},v=()=>{if(!f.id||!f.label){ae.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const T=C.findIndex(P=>P.id===u.id);T!==-1&&(C[T]={...f})}else{if(C.some(T=>T.id===f.id)){ae.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(T=>T.id!==C)})},E=C=>{e({...t,matchTypes:t.matchTypes.map(T=>T.id===C?{...T,enabled:!T.enabled}:T)})};return s.jsxs("div",{className:"p-8 w-full space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(mo,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ee,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(ee,{onClick:y,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(di,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ie,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:C=>e({...t,freeMatchLimit:parseInt(C.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:C=>e({...t,matchPrice:parseFloat(C.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ie,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:C=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(C.target.value,10)||10}})}),s.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),s.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),s.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(cr,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(ee,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(fn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(Ie,{children:s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"图标"}),s.jsx(ke,{className:"text-gray-400",children:"类型ID"}),s.jsx(ke,{className:"text-gray-400",children:"显示名称"}),s.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),s.jsx(ke,{className:"text-gray-400",children:"价格"}),s.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(fr,{children:t.matchTypes.map(C=>s.jsxs(ot,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx("span",{className:"text-2xl",children:C.icon})}),s.jsx(be,{className:"font-mono text-gray-300",children:C.id}),s.jsx(be,{className:"text-white font-medium",children:C.label}),s.jsx(be,{className:"text-gray-300",children:C.matchLabel}),s.jsx(be,{children:s.jsxs(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),s.jsx(be,{children:C.matchFromDB?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(be,{children:s.jsx(kt,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Vt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx(Rt,{open:o,onOpenChange:c,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[u?s.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(fn,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-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:"类型ID(英文)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:C=>m({...f,id:C.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:MV.map(C=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===C?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:C}),children:C},C))})]})]}),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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:C=>m({...f,label:C.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:C=>m({...f,matchLabel:C.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:C=>m({...f,price:parseFloat(C.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(ee,{onClick:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Cw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function IV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function N(){m(!0),y(null);try{const v=new URLSearchParams({page:String(a),pageSize:String(o)});u&&v.set("matchType",u);const k=await Oe(`/api/db/match-records?${v}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(v){console.error("加载匹配记录失败",v),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{N()},[a,u]);const j=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&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:g}),s.jsx("button",{type:"button",onClick:()=>y(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:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:v=>{h(v.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Cw).map(([v,k])=>s.jsx("option",{value:v,children:k},v))]}),s.jsxs("button",{type:"button",onClick:N,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"发起人"}),s.jsx(ke,{className:"text-gray-400",children:"匹配到"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"联系方式"}),s.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(fr,{children:[t.map(v=>s.jsxs(ot,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.userAvatar?s.jsx("img",{src:ps(v.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,s.jsx("span",{className:v.userAvatar?"hidden":"",children:(v.userNickname||v.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.userNickname||v.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.userId.slice(0,16),"..."]})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.matchedUserAvatar?s.jsx("img",{src:ps(v.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,s.jsx("span",{className:v.matchedUserAvatar?"hidden":"",children:(v.matchedNickname||v.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.matchedNickname||v.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Cw[v.matchType]||v.matchType})}),s.jsxs(be,{className:"text-gray-400 text-sm",children:[v.phone&&s.jsxs("div",{children:["📱 ",v.phone]}),v.wechatId&&s.jsxs("div",{children:["💬 ",v.wechatId]}),!v.phone&&!v.wechatId&&"-"]}),s.jsx(be,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleString():"-"})]},v.id)),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(us,{page:a,totalPages:j,total:n,pageSize:o,onPageChange:i,onPageSizeChange:v=>{c(v),i(1)}})]})})})]})}function RV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0);async function a(){r(!0);try{const i=await Oe("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),ae.error("加载 VIP 成员失败")}finally{r(!1)}}return b.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("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-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(ke,{className:"text-gray-400",children:"成员"}),s.jsx(ke,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(ke,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(fr,{children:[t.map((i,o)=>{var c;return s.jsxs(ot,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:o+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:ps(i.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:((c=i.name)==null?void 0:c[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:i.name})})]})}),s.jsx(be,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(be,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function V4(t){const[e,n]=b.useState([]),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,N]=b.useState(!1),j=b.useRef(null),v=async R=>{var _;const O=(_=R.target.files)==null?void 0:_[0];if(O){N(!0);try{const re=new FormData;re.append("file",O),re.append("folder","mentors");const ne=vd(),he={};ne&&(he.Authorization=`Bearer ${ne}`);const z=await(await fetch(wo("/api/upload"),{method:"POST",body:re,credentials:"include",headers:he})).json();z!=null&&z.success&&(z!=null&&z.url)?f(U=>({...U,avatar:z.url})):ae.error("上传失败: "+((z==null?void 0:z.error)||"未知错误"))}catch(re){console.error(re),ae.error("上传失败")}finally{N(!1),j.current&&(j.current.value="")}}};async function k(){a(!0);try{const R=await Oe("/api/db/mentors");R!=null&&R.success&&R.data&&n(R.data)}catch(R){console.error("Load mentors error:",R)}finally{a(!1)}}b.useEffect(()=>{k()},[]);const E=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(R=>R.sort))+1:0,enabled:!0})},C=()=>{u(null),E(),o(!0)},T=R=>{u(R),f({name:R.name,avatar:R.avatar||"",intro:R.intro||"",tags:R.tags||"",priceSingle:R.priceSingle!=null?String(R.priceSingle):"",priceHalfYear:R.priceHalfYear!=null?String(R.priceHalfYear):"",priceYear:R.priceYear!=null?String(R.priceYear):"",quote:R.quote||"",whyFind:R.whyFind||"",offering:R.offering||"",judgmentStyle:R.judgmentStyle||"",sort:R.sort,enabled:R.enabled??!0}),o(!0)},P=async()=>{if(!h.name.trim()){ae.error("导师姓名不能为空");return}g(!0);try{const R=_=>_===""?void 0:parseFloat(_),O={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:R(h.priceSingle),priceHalfYear:R(h.priceHalfYear),priceYear:R(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const _=await Dt("/api/db/mentors",{id:c.id,...O});_!=null&&_.success?(o(!1),k()):ae.error("更新失败: "+(_==null?void 0:_.error))}else{const _=await Nt("/api/db/mentors",O);_!=null&&_.success?(o(!1),k()):ae.error("新增失败: "+(_==null?void 0:_.error))}}catch(R){console.error("Save error:",R),ae.error("保存失败")}finally{g(!1)}},F=async R=>{if(confirm("确定删除该导师?"))try{const O=await Ws(`/api/db/mentors?id=${R}`);O!=null&&O.success?k():ae.error("删除失败: "+(O==null?void 0:O.error))}catch(O){console.error("Delete error:",O),ae.error("删除失败")}},D=R=>R!=null?`¥${R}`:"-";return 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(cr,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(ee,{onClick:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(fn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:r?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"ID"}),s.jsx(ke,{className:"text-gray-400",children:"姓名"}),s.jsx(ke,{className:"text-gray-400",children:"简介"}),s.jsx(ke,{className:"text-gray-400",children:"单次"}),s.jsx(ke,{className:"text-gray-400",children:"半年"}),s.jsx(ke,{className:"text-gray-400",children:"年度"}),s.jsx(ke,{className:"text-gray-400",children:"排序"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(fr,{children:[e.map(R=>s.jsxs(ot,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:R.id}),s.jsx(be,{className:"text-white",children:R.name}),s.jsx(be,{className:"text-gray-400 max-w-[200px] truncate",children:R.intro||"-"}),s.jsx(be,{className:"text-gray-400",children:D(R.priceSingle)}),s.jsx(be,{className:"text-gray-400",children:D(R.priceHalfYear)}),s.jsx(be,{className:"text-gray-400",children:D(R.priceYear)}),s.jsx(be,{className:"text-gray-400",children:R.sort}),s.jsxs(be,{className:"text-right",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>T(R),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(Vt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>F(R.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Yn,{className:"w-4 h-4"})})]})]},R.id)),e.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Rt,{open:i,onOpenChange:o,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Pt,{children:s.jsx(Ot,{className:"text-white",children:c?"编辑导师":"新增导师"})}),s.jsxs("div",{className:"space-y-4 py-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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:R=>f(O=>({...O,name:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"排序"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:R=>f(O=>({...O,sort:parseInt(R.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:R=>f(O=>({...O,avatar:R.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:j,type:"file",accept:"image/*",className:"hidden",onChange:v}),s.jsxs(ee,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var R;return(R=j.current)==null?void 0:R.click()},children:[s.jsx(fh,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ps(h.avatar.startsWith("http")?h.avatar:wo(h.avatar)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"简介"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:R=>f(O=>({...O,intro:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:R=>f(O=>({...O,tags:R.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(Z,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:R=>f(O=>({...O,priceSingle:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:R=>f(O=>({...O,priceHalfYear:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:R=>f(O=>({...O,priceYear:R.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"引言"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:R=>f(O=>({...O,quote:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:R=>f(O=>({...O,whyFind:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:R=>f(O=>({...O,offering:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:R=>f(O=>({...O,judgmentStyle:R.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:R=>f(O=>({...O,enabled:R.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(Z,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(Xt,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Zn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:P,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function PV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const h=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",f=await Oe(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[a]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return 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(Mg,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:h=>i(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>s.jsx("option",{value:h,children:f},h))]}),s.jsxs(ee,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"ID"}),s.jsx(ke,{className:"text-gray-400",children:"用户ID"}),s.jsx(ke,{className:"text-gray-400",children:"导师ID"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"金额"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(fr,{children:[t.map(h=>s.jsxs(ot,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:h.id}),s.jsx(be,{className:"text-gray-400",children:h.userId}),s.jsx(be,{className:"text-gray-400",children:h.mentorId}),s.jsx(be,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(be,{className:"text-white",children:["¥",h.amount]}),s.jsx(be,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(be,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Bc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},Ew={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:Bc},OV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function DV(){const t=Ti(),[e,n]=b.useState(Ew),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,N]=b.useState(null),[j,v]=b.useState(!1),k=async()=>{v(!0);try{const O=await Oe("/api/db/match-pool-counts");O!=null&&O.success&&O.data&&N(O.data)}catch(O){console.error("加载池子人数失败:",O)}finally{v(!1)}},E=async()=>{a(!0);try{const O=await Oe("/api/db/config/full?key=match_config"),_=(O==null?void 0:O.data)??(O==null?void 0:O.config);if(_){let re=_.poolSettings??Bc;re.poolSource&&!Array.isArray(re.poolSource)&&(re={...re,poolSource:[re.poolSource]}),n({...Ew,..._,poolSettings:re})}}catch(O){console.error("加载匹配配置失败:",O)}finally{a(!1)}};b.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const O=await Nt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});ae.error((O==null?void 0:O.success)!==!1?"配置保存成功!":"保存失败: "+((O==null?void 0:O.error)||"未知错误"))}catch(O){console.error(O),ae.error("保存失败")}finally{o(!1)}},T=O=>{f(O),g({...O}),u(!0)},P=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},F=()=>{if(!m.id||!m.label){ae.error("请填写类型ID和名称");return}const O=[...e.matchTypes];if(h){const _=O.findIndex(re=>re.id===h.id);_!==-1&&(O[_]={...m})}else{if(O.some(_=>_.id===m.id)){ae.error("类型ID已存在");return}O.push({...m})}n({...e,matchTypes:O}),u(!1)},D=O=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(_=>_.id!==O)})},R=O=>{n({...e,matchTypes:e.matchTypes.map(_=>_.id===O?{..._,enabled:!_.enabled}:_)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(ee,{variant:"outline",onClick:E,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(ee,{onClick:C,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(Xw,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Lt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(Ie,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(O=>{const _=e.poolSettings??Bc,ne=(Array.isArray(_.poolSource)?_.poolSource:[_.poolSource]).includes(O.value),he=y==null?void 0:y[O.countKey],xe=()=>{const z=Array.isArray(_.poolSource)?[..._.poolSource]:[_.poolSource],U=ne?z.filter(H=>H!==O.value):[...z,O.value];U.length===0&&U.push(O.value),n({...e,poolSettings:{..._,poolSource:U}})};return s.jsxs("button",{type:"button",onClick:xe,className:`p-4 rounded-lg border text-left transition-all ${ne?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${ne?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:ne&&"✓"}),s.jsx("span",{className:"text-xl",children:O.icon}),s.jsx("span",{className:`text-sm font-medium ${ne?"text-[#38bdac]":"text-gray-300"}`,children:O.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":he??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:O.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:z=>{z.stopPropagation(),t(`/users?pool=${O.value}`)},onKeyDown:z=>{z.key==="Enter"&&(z.stopPropagation(),t(`/users?pool=${O.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},O.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(Z,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(O=>{const re=(e.poolSettings??Bc)[O.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(kt,{checked:re,onCheckedChange:ne=>n({...e,poolSettings:{...e.poolSettings??Bc,[O.key]:ne}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:O.icon}),s.jsx(Z,{className:"text-gray-300 text-sm",children:O.label})]})]},O.key)})})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Ye,{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(di,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ie,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:O=>n({...e,freeMatchLimit:parseInt(O.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:O=>n({...e,matchPrice:parseFloat(O.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ie,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:O=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(O.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:e.settings.enableFreeMatches,onCheckedChange:O=>n({...e,settings:{...e.settings,enableFreeMatches:O}})}),s.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:e.settings.enablePaidMatches,onCheckedChange:O=>n({...e,settings:{...e.settings,enablePaidMatches:O}})}),s.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Ye,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Qe,{className:"text-white flex items-center gap-2",children:[s.jsx(cr,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Lt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(ee,{onClick:P,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(fn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(Ie,{children:s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"图标"}),s.jsx(ke,{className:"text-gray-400",children:"类型ID"}),s.jsx(ke,{className:"text-gray-400",children:"显示名称"}),s.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),s.jsx(ke,{className:"text-gray-400",children:"价格"}),s.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(fr,{children:e.matchTypes.map(O=>s.jsxs(ot,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx("span",{className:"text-2xl",children:O.icon})}),s.jsx(be,{className:"font-mono text-gray-300",children:O.id}),s.jsx(be,{className:"text-white font-medium",children:O.label}),s.jsx(be,{className:"text-gray-300",children:O.matchLabel}),s.jsx(be,{children:s.jsxs(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",O.price]})}),s.jsx(be,{children:O.matchFromDB?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(be,{children:s.jsx(kt,{checked:O.enabled,onCheckedChange:()=>R(O.id)})}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>T(O),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Vt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>D(O.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},O.id))})]})})]}),s.jsx(Rt,{open:c,onOpenChange:u,children:s.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Pt,{children:s.jsxs(Ot,{className:"text-white flex items-center gap-2",children:[h?s.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(fn,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-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:"类型ID(英文)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:O=>g({...m,id:O.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:OV.map(O=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===O?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:O}),children:O},O))})]})]}),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(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:O=>g({...m,label:O.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:O=>g({...m,matchLabel:O.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:O=>g({...m,price:parseFloat(O.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:m.matchFromDB,onCheckedChange:O=>g({...m,matchFromDB:O})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:m.showJoinAfterMatch,onCheckedChange:O=>g({...m,showJoinAfterMatch:O})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kt,{checked:m.enabled,onCheckedChange:O=>g({...m,enabled:O})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(Xt,{children:[s.jsx(ee,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(ee,{onClick:F,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Tw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function LV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[N,j]=b.useState(null);async function v(){m(!0),y(null);try{const C=new URLSearchParams({page:String(a),pageSize:String(o)});u&&C.set("matchType",u);const T=await Oe(`/api/db/match-records?${C}`);T!=null&&T.success?(e(T.records||[]),r(T.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[a,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:T,avatar:P})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[P?s.jsx("img",{src:ps(P),alt:"",className:"w-full h-full object-cover",onError:F=>{F.currentTarget.style.display="none"}}):null,s.jsx("span",{className:P?"hidden":"",children:(T||C||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:T||C}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[C==null?void 0:C.slice(0,16),(C==null?void 0:C.length)>16?"...":""]})]})]});return s.jsxs("div",{children:[g&&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:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:C=>{h(C.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Tw).map(([C,T])=>s.jsx("option",{value:C,children:T},C))]}),s.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"发起人"}),s.jsx(ke,{className:"text-gray-400",children:"匹配到"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"联系方式"}),s.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(fr,{children:[t.map(C=>s.jsxs(ot,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(be,{children:C.matchedUserId?s.jsx(E,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Tw[C.matchType]||C.matchType})}),s.jsxs(be,{className:"text-sm",children:[C.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&s.jsx("span",{className:"text-gray-600",children:"-"})]}),s.jsx(be,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(us,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(s0,{open:!!N,onClose:()=>j(null),userId:N,onUserUpdated:v})]})}function _V(){const[t,e]=b.useState("records");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),s.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&s.jsx(LV,{}),t==="pool"&&s.jsx(DV,{})]})}const Mw={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function zV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function N(){h(!0);try{const E=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),C=await Oe(`/api/db/match-records?${E}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(E){console.error(E)}finally{h(!1)}}b.useEffect(()=>{N()},[a,f]);const j=async E=>{if(!E.phone&&!E.wechatId){ae.info("该记录无联系方式,无法推送到存客宝");return}y(E.id);try{const C=await Nt("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});ae.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){ae.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{y(null)}},v=Math.ceil(n/o)||1,k=E=>!!(E.phone||E.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:E=>{m(E.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Mw).map(([E,C])=>s.jsx("option",{value:E,children:C},E))}),s.jsxs(ee,{onClick:N,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"发起人"}),s.jsx(ke,{className:"text-gray-400",children:"匹配到"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"联系方式"}),s.jsx(ke,{className:"text-gray-400",children:"时间"}),s.jsx(ke,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(fr,{children:[t.map(E=>{var C,T;return s.jsxs(ot,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(be,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),s.jsx(be,{className:"text-white",children:E.matchedNickname||((T=E.matchedUserId)==null?void 0:T.slice(0,12))}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Mw[E.matchType]||E.matchType})}),s.jsxs(be,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(be,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),s.jsx(be,{className:"text-right",children:k(E)?s.jsxs(ee,{size:"sm",onClick:()=>j(E),disabled:g===E.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(AA,{className:"w-3 h-3 mr-1"}),g===E.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},E.id)}),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(us,{page:a,totalPages:v,total:n,pageSize:o,onPageChange:i,onPageSizeChange:E=>{c(E),i(1)}})]})})})]})}const Aw={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},$V={single:"单次",half_year:"半年",year:"年度"};function FV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const c=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",u=await Oe(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[a]),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:c=>i(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(Aw).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(ee,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ie,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"ID"}),s.jsx(ke,{className:"text-gray-400",children:"用户ID"}),s.jsx(ke,{className:"text-gray-400",children:"导师ID"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"金额"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(fr,{children:[t.map(c=>s.jsxs(ot,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:c.id}),s.jsx(be,{className:"text-gray-400",children:c.userId}),s.jsx(be,{className:"text-gray-400",children:c.mentorId}),s.jsx(be,{className:"text-gray-400",children:$V[c.consultationType]||c.consultationType}),s.jsxs(be,{className:"text-white",children:["¥",c.amount]}),s.jsx(be,{className:"text-gray-400",children:Aw[c.status]||c.status}),s.jsx(be,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function BV(){const[t,e]=b.useState("booking");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),s.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&s.jsx(FV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(V4,{embedded:!0})})]})}function VV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),y=await Oe(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ie,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ur,{children:[s.jsx(hr,{children:s.jsxs(ot,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"发起人"}),s.jsx(ke,{className:"text-gray-400",children:"匹配到"}),s.jsx(ke,{className:"text-gray-400",children:"联系方式"}),s.jsx(ke,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(fr,{children:[t.map(g=>s.jsxs(ot,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(be,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(be,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(be,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(ot,{children:s.jsx(be,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(us,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const Iw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募",join:"加入",match:"匹配"},Rw={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮",join:"📋",match:"🔗"};function HV({onSwitchTab:t,onOpenCKB:e}={}){const n=Ti(),[r,a]=b.useState(null),[i,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var g,y;u(!0);try{const[N,j]=await Promise.allSettled([Oe("/api/db/match-records?stats=true"),Oe("/api/db/ckb-plan-stats")]);if(N.status==="fulfilled"&&((g=N.value)!=null&&g.success)&&N.value.data){let v=N.value.data;if(v.totalMatches>0&&(!v.uniqueUsers||v.uniqueUsers===0))try{const k=await Oe("/api/db/match-records?page=1&pageSize=200");if(k!=null&&k.success&&k.records){const E=new Set(k.records.map(C=>C.userId).filter(Boolean));v={...v,uniqueUsers:E.size}}}catch{}a(v)}j.status==="fulfilled"&&((y=j.value)!=null&&y.success)&&j.value.data&&o(j.value.data)}catch(N){console.error("加载统计失败:",N)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=g=>c?"—":String(g??0),m=r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0";return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-5 gap-3",children:[s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.totalMatches)}),s.jsxs("p",{className:"text-[#38bdac] text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(Ra,{className:"w-2.5 h-2.5"})," 查看记录"]})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"今日"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.todayMatches)}),s.jsxs("p",{className:"text-yellow-400/60 text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(di,{className:"w-2.5 h-2.5"})," 实时"]})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"用户数"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.uniqueUsers)}),s.jsxs("p",{className:"text-blue-400/60 text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(cr,{className:"w-2.5 h-2.5"})," 查看用户"]})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"人均匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c?"—":m})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"付费匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.paidMatchCount)})]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ie,{className:"p-4",children:[s.jsx("h4",{className:"text-sm font-medium text-white mb-3",children:"匹配类型分布"}),r!=null&&r.byType&&r.byType.length>0?s.jsx("div",{className:"space-y-2",children:r.byType.map(g=>{const y=r.totalMatches>0?g.count/r.totalMatches*100:0;return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-lg shrink-0",children:Rw[g.matchType]||"📊"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex justify-between text-xs mb-0.5",children:[s.jsx("span",{className:"text-gray-300",children:Iw[g.matchType]||g.matchType}),s.jsxs("span",{className:"text-gray-500",children:[g.count," (",y.toFixed(0),"%)"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-gray-700/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${Math.min(y,100)}%`}})})]})]},g.matchType)})}):s.jsx("p",{className:"text-gray-500 text-xs",children:"暂无数据"})]})}),s.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/20",children:s.jsxs(Ie,{className:"p-4",children:[s.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-1.5",children:[s.jsx(Ts,{className:"w-4 h-4 text-orange-400"})," AI 获客"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 cursor-pointer hover:border-orange-500/50 border border-transparent transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"已提交线索"}),s.jsx("p",{className:"text-xl font-bold text-white",children:c?"—":(i==null?void 0:i.ckbTotal)??0})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 cursor-pointer hover:border-orange-500/50 border border-transparent transition-colors",onClick:()=>e==null?void 0:e("contact"),children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"有联系方式"}),s.jsx("p",{className:"text-xl font-bold text-white",children:c?"—":(i==null?void 0:i.withContact)??0})]})]}),(i==null?void 0:i.byType)&&i.byType.length>0&&s.jsx("div",{className:"space-y-1.5",children:i.byType.map(g=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{children:Rw[g.matchType]||"📋"}),s.jsx("span",{className:"text-gray-400",children:Iw[g.matchType]||g.matchType}),s.jsx("span",{className:"ml-auto text-white font-medium",children:g.total})]},g.matchType))}),s.jsx("button",{type:"button",onClick:()=>e==null?void 0:e("test"),className:"mt-3 w-full text-xs text-orange-400 hover:text-orange-300 text-center py-1.5 bg-orange-500/10 rounded",children:"查看 AI 添加进度 →"})]})})]})]})}const WV=["partner","investor","mentor","team"],jg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],Pw=`# 场景获客接口摘要 +- 地址:POST /v1/api/scenarios +- 必填:apiKey、sign、timestamp +- 主标识:phone 或 wechatId 至少一项 +- 可选:name、source、remark、tags、siteTags、portrait +- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 +- 成功:code=200,message=新增成功 或 已存在`;function UV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,a]=b.useState("13800000000"),[i,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(Pw),[m,g]=b.useState(!1),[y,N]=b.useState(!1),[j,v]=b.useState([]),[k,E]=b.useState([]),[C,T]=b.useState({}),[P,F]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),D=b.useMemo(()=>{const z={};return jg.forEach(U=>{z[U.key]=C[U.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),z},[C]),R=z=>{const U=r.trim(),H=i.trim();return z<=3?{type:WV[z],phone:U||void 0,wechat:H||void 0,userId:"admin_test",name:"后台测试"}:z===4?{matchType:"partner",phone:U||void 0,wechat:H||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:z===5?{phone:U||void 0,wechatId:H||void 0,userId:"admin_test",name:"后台测试"}:{}};async function O(){N(!0);try{const[z,U,H]=await Promise.all([Oe("/api/db/config/full?key=ckb_config"),Oe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Oe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),I=z==null?void 0:z.data;I!=null&&I.routes&&T(I.routes),I!=null&&I.docNotes&&u(I.docNotes),I!=null&&I.docContent&&f(I.docContent),U!=null&&U.success&&v(U.records||[]),H!=null&&H.success&&E(H.records||[])}finally{N(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{O()},[]);async function _(){g(!0);try{const z=await Nt("/api/db/config",{key:"ckb_config",value:{routes:D,docNotes:c,docContent:h},description:"存客宝接口配置"});ae.error((z==null?void 0:z.success)!==!1?"存客宝配置已保存":`保存失败: ${(z==null?void 0:z.error)||"未知错误"}`)}catch(z){ae.error(`保存失败: ${z instanceof Error?z.message:"网络错误"}`)}finally{g(!1)}}const re=(z,U)=>{T(H=>({...H,[z]:{...D[z],...U}}))},ne=async z=>{const U=P[z];if(U.method==="POST"&&!r.trim()&&!i.trim()){ae.error("请填写测试手机号");return}const H=[...P];H[z]={...U,status:"testing",message:void 0,responseTime:void 0},F(H);const I=performance.now();try{const q=U.method==="GET"?await Oe(U.endpoint):await Nt(U.endpoint,R(z)),V=Math.round(performance.now()-I),L=(q==null?void 0:q.message)||"",K=(q==null?void 0:q.success)===!0||L.includes("已存在")||L.includes("已加入")||L.includes("已提交"),oe=[...P];oe[z]={...U,status:K?"success":"error",message:L||(K?"正常":"异常"),responseTime:V},F(oe),await O()}catch(q){const V=Math.round(performance.now()-I),L=[...P];L[z]={...U,status:"error",message:q instanceof Error?q.message:"失败",responseTime:V},F(L)}},he=async()=>{if(!r.trim()&&!i.trim()){ae.error("请填写测试手机号");return}for(let z=0;zs.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:z.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:U})}):z.map(H=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:H.userNickname||H.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:H.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:H.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:H.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:H.createdAt?new Date(H.createdAt).toLocaleString():"—"})]},H.id))})]})});return s.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(Ie,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(Ra,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ee,{onClick:()=>O(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(ee,{onClick:_,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(yn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([z,U])=>s.jsx("button",{type:"button",onClick:()=>n(z),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===z?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:U},z))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:j.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:jg.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&xe(j,"暂无已提交线索"),e==="contact"&&xe(k,"暂无有联系方式线索"),e==="config"&&s.jsx("div",{className:"space-y-4",children:jg.map(z=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white font-medium",children:z.label}),s.jsx(Ke,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:z.key})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[z.key].apiUrl,onChange:U=>re(z.key,{apiUrl:U.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[z.key].apiKey,onChange:U=>re(z.key,{apiKey:U.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[z.key].source,onChange:U=>re(z.key,{source:U.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[z.key].tags,onChange:U=>re(z.key,{tags:U.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[z.key].siteTags,onChange:U=>re(z.key,{siteTags:U.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:D[z.key].notes,onChange:U=>re(z.key,{notes:U.target.value})})]})]})]},z.key))}),e==="test"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx(vi,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:z=>a(z.target.value)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:z=>o(z.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(ee,{onClick:he,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(di,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:P.map((z,U)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[z.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),z.status==="testing"&&s.jsx(He,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),z.status==="success"&&s.jsx(Ig,{className:"w-3 h-3 text-green-400 shrink-0"}),z.status==="error"&&s.jsx(Qw,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:z.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[z.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[z.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>ne(U),disabled:z.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${z.endpoint}-${U}`))})]}),e==="doc"&&s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),s.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[s.jsx(Ra,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||Pw})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),s.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:z=>u(z.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const KV=[{id:"stats",label:"数据统计",icon:Ag},{id:"partner",label:"找伙伴",icon:cr},{id:"resource",label:"资源对接",icon:MM},{id:"mentor",label:"导师预约",icon:CM},{id:"team",label:"团队招募",icon:zg}];function qV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[a,i]=b.useState("overview");return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(cr,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),s.jsxs(ee,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[s.jsx(Ts,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&s.jsx(UV,{initialTab:a}),s.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:KV.map(o=>{const c=t===o.id;return s.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[s.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&s.jsx(HV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(_V,{}),t==="resource"&&s.jsx(zV,{}),t==="mentor"&&s.jsx(BV,{}),t==="team"&&s.jsx(VV,{})]})}function GV(){return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[s.jsx(Ts,{className:"w-8 h-8 text-[#38bdac]"}),s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),s.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"1. 接口总览"})}),s.jsxs(Ie,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),s.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[s.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),s.jsx("li",{children:"/api/miniprogram/upload — 小程序上传(图片/视频、图片压缩)"}),s.jsx("li",{children:"/api/admin/content/upload — 管理端内容导入"}),s.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),s.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),s.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),s.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),s.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),s.jsx("li",{children:"/api/config — 配置系统"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),s.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),s.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"2. 书籍内容"})}),s.jsxs(Ie,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),s.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),s.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"2.1 小程序上传接口"})}),s.jsxs(Ie,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-1",children:"POST /api/miniprogram/upload/image — 图片上传(支持压缩)"}),s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"表单:file(必填)、folder(可选,默认 images)、quality(可选 1-100,默认 85)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"支持 jpeg/png/gif,单张最大 5MB。JPEG 按 quality 压缩。"}),s.jsx("pre",{className:"mt-2 p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:'响应示例: { "success": true, "url": "/uploads/images/xxx.jpg", "data": { "url", "fileName", "size", "type", "quality" } }'})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-1",children:"POST /api/miniprogram/upload/video — 视频上传"}),s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"表单:file(必填)、folder(可选,默认 videos)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"支持 mp4/mov/avi,单个最大 100MB。"}),s.jsx("pre",{className:"mt-2 p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:'响应示例: { "success": true, "url": "/uploads/videos/xxx.mp4", "data": { "url", "fileName", "size", "type", "folder" } }'})]})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"2.2 管理端内容上传"})}),s.jsxs(Ie,{className:"space-y-3 text-sm",children:[s.jsx("p",{className:"text-gray-400",children:"POST /api/admin/content/upload — 内容导入(需 AdminAuth)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"通过 API 批量导入章节到内容管理,不直接操作数据库。"}),s.jsx("pre",{className:"p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:`请求体: { + "action": "import", + "data": [{ + "id": "ch-001", + "title": "章节标题", + "content": "正文内容", + "price": 1.0, + "isFree": false, + "partId": "part-1", + "partTitle": "第一篇", + "chapterId": "chapter-1", + "chapterTitle": "第1章" + }] +}`}),s.jsxs("p",{className:"text-gray-500 text-xs",children:["响应:",'{ "success": true, "message": "导入完成", "imported": N, "failed": M }']})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"3. 支付"})}),s.jsxs(Ie,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),s.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),s.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"4. 分销与用户"})}),s.jsxs(Ie,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),s.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),s.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),s.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Ye,{children:s.jsx(Qe,{className:"text-white",children:"5. 管理后台"})}),s.jsxs(Ie,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),s.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),s.jsx("p",{children:"GET /api/admin/orders — 订单列表"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function JV(){const t=Ei();return s.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:s.jsx(Jw,{className:"w-10 h-10"})}),s.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),s.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),s.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),s.jsx(ee,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(Tg,{to:"/",children:[s.jsx(zM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function YV(){return s.jsxs(jT,{children:[s.jsx(Bt,{path:"/login",element:s.jsx(sI,{})}),s.jsxs(Bt,{path:"/",element:s.jsx(o5,{}),children:[s.jsx(Bt,{index:!0,element:s.jsx(Em,{to:"/dashboard",replace:!0})}),s.jsx(Bt,{path:"dashboard",element:s.jsx(pP,{})}),s.jsx(Bt,{path:"orders",element:s.jsx(mP,{})}),s.jsx(Bt,{path:"users",element:s.jsx(gP,{})}),s.jsx(Bt,{path:"distribution",element:s.jsx(zP,{})}),s.jsx(Bt,{path:"withdrawals",element:s.jsx($P,{})}),s.jsx(Bt,{path:"content",element:s.jsx(fV,{})}),s.jsx(Bt,{path:"referral-settings",element:s.jsx($k,{})}),s.jsx(Bt,{path:"author-settings",element:s.jsx(Em,{to:"/settings?tab=author",replace:!0})}),s.jsx(Bt,{path:"vip-roles",element:s.jsx(RV,{})}),s.jsx(Bt,{path:"mentors",element:s.jsx(V4,{})}),s.jsx(Bt,{path:"mentor-consultations",element:s.jsx(PV,{})}),s.jsx(Bt,{path:"admin-users",element:s.jsx(Em,{to:"/settings?tab=admin",replace:!0})}),s.jsx(Bt,{path:"settings",element:s.jsx(wV,{})}),s.jsx(Bt,{path:"payment",element:s.jsx(jV,{})}),s.jsx(Bt,{path:"site",element:s.jsx(EV,{})}),s.jsx(Bt,{path:"qrcodes",element:s.jsx(TV,{})}),s.jsx(Bt,{path:"find-partner",element:s.jsx(qV,{})}),s.jsx(Bt,{path:"match",element:s.jsx(AV,{})}),s.jsx(Bt,{path:"match-records",element:s.jsx(IV,{})}),s.jsx(Bt,{path:"api-doc",element:s.jsx(GV,{})}),s.jsx(Bt,{path:"api-docs",element:s.jsx(B4,{})})]}),s.jsx(Bt,{path:"*",element:s.jsx(JV,{})})]})}TE.createRoot(document.getElementById("root")).render(s.jsx(b.StrictMode,{children:s.jsx(IT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(YV,{})})})); diff --git a/soul-admin/dist/assets/index-BcWuvM_a.css b/soul-admin/dist/assets/index-BcWuvM_a.css deleted file mode 100644 index 73baa660..00000000 --- a/soul-admin/dist/assets/index-BcWuvM_a.css +++ /dev/null @@ -1 +0,0 @@ -.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:450px;max-height:720px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-rose-400:oklch(71.2% .194 13.428);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-\[75vh\]{height:75vh}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[2rem\]{min-height:2rem}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[72px\]{min-height:72px}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-\[280px\]{width:280px}.w-fit{width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[96px\]{max-width:96px}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-gray-700\/60{border-color:#36415399}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/60{border-color:color-mix(in oklab,var(--color-gray-700)60%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-inherit{border-color:inherit}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-red-600\/50{border-color:#e4001480}@supports (color:color-mix(in lab,red,red)){.border-red-600\/50{border-color:color-mix(in oklab,var(--color-red-600)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0a1628\]\/60{background-color:#0a162899}.bg-\[\#0b1828\]{background-color:#0b1828}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#050c18\]{background-color:#050c18}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/20{background-color:#4a556533}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/20{background-color:color-mix(in oklab,var(--color-gray-600)20%,transparent)}}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-900\/80{background-color:#82181acc}@supports (color:color-mix(in lab,red,red)){.bg-red-900\/80{background-color:color-mix(in oklab,var(--color-red-900)80%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/80{color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400)80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-400{color:var(--color-emerald-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/90{color:#05df72e6}@supports (color:color-mix(in lab,red,red)){.text-green-400\/90{color:color-mix(in oklab,var(--color-green-400)90%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-100{color:var(--color-red-100)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-rose-400{color:var(--color-rose-400)}.text-sky-300{color:var(--color-sky-300)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-\[\#38bdac\]{accent-color:#38bdac}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-\[\#38bdac\]\/70:hover{border-color:#38bdacb3}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#0a1628\]\/80:hover{background-color:#0a1628cc}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-red-800\/50:hover{background-color:#9f071280}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-800\/50:hover{background-color:color-mix(in oklab,var(--color-red-800)50%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#5fe0cd\]:hover{color:#5fe0cd}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-200:hover{color:var(--color-amber-200)}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-sky-200:hover{color:var(--color-sky-200)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-red-500:focus-visible{--tw-ring-color:var(--color-red-500)}.focus-visible\:ring-offset-0:focus-visible{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:calc(var(--spacing)*2)}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/assets/index-CKdDSrMs.css b/soul-admin/dist/assets/index-CKdDSrMs.css deleted file mode 100644 index 7012a9bd..00000000 --- a/soul-admin/dist/assets/index-CKdDSrMs.css +++ /dev/null @@ -1 +0,0 @@ -.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:300px;max-height:500px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}.mention-trigger-btn{color:#38bdac!important}.mention-trigger-btn:hover{background:#38bdac33!important}.upload-progress-bar{display:flex;align-items:center;gap:8px;padding:4px 10px;background:#0f1d32;border-bottom:1px solid #374151}.upload-progress-track{flex:1;height:4px;background:#1f2937;border-radius:2px;overflow:hidden}.upload-progress-fill{height:100%;background:linear-gradient(90deg,#38bdac,#4ae3ce);border-radius:2px;transition:width .3s ease}.upload-progress-text{font-size:11px;color:#38bdac;white-space:nowrap}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-rose-400:oklch(71.2% .194 13.428);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-auto{height:auto}.h-full{height:100%}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[200px\]{max-height:200px}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[450px\]{max-height:450px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[72px\]{min-height:72px}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-\[200px\]{width:200px}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.rotate-90{rotate:90deg}.rotate-270{rotate:270deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.grid-cols-\[60px_1fr_100px_100px_80px_120px\]{grid-template-columns:60px 1fr 100px 100px 80px 120px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-gray-700\/60{border-color:#36415399}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/60{border-color:color-mix(in oklab,var(--color-gray-700)60%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-inherit{border-color:inherit}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0a1628\]\/60{background-color:#0a162899}.bg-\[\#0b1828\]{background-color:#0b1828}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#050c18\]{background-color:#050c18}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/10{background-color:#6a72821a}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/10{background-color:color-mix(in oklab,var(--color-gray-500)10%,transparent)}}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/20{background-color:#4a556533}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/20{background-color:color-mix(in oklab,var(--color-gray-600)20%,transparent)}}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-400\/10{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.bg-green-400\/10{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/80{color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/50{color:#90c5ff80}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/50{color:color-mix(in oklab,var(--color-blue-300)50%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-400{color:var(--color-emerald-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/90{color:#05df72e6}@supports (color:color-mix(in lab,red,red)){.text-green-400\/90{color:color-mix(in oklab,var(--color-green-400)90%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/50{color:#ffb96d80}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/50{color:color-mix(in oklab,var(--color-orange-300)50%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-rose-400{color:var(--color-rose-400)}.text-sky-300{color:var(--color-sky-300)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-\[\#38bdac\]{accent-color:#38bdac}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-\[\#38bdac\]\/70:hover{border-color:#38bdacb3}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#0a1628\]\/80:hover{background-color:#0a1628cc}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-400\/10:hover{background-color:#ff8b1a1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-400\/10:hover{background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#5fe0cd\]:hover{color:#5fe0cd}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-200:hover{color:var(--color-amber-200)}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-green-400:hover{color:var(--color-green-400)}.hover\:text-orange-300:hover{color:var(--color-orange-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-sky-200:hover{color:var(--color-sky-200)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-red-500:focus-visible{--tw-ring-color:var(--color-red-500)}.focus-visible\:ring-offset-0:focus-visible{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/assets/index-D5RkA1Qc.js b/soul-admin/dist/assets/index-D5RkA1Qc.js deleted file mode 100644 index 4faddb40..00000000 --- a/soul-admin/dist/assets/index-D5RkA1Qc.js +++ /dev/null @@ -1,914 +0,0 @@ -function yE(t,e){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Iw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bm={exports:{}},kc={},vm={exports:{}},ft={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var yv;function bE(){if(yv)return ft;yv=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g($){return $===null||typeof $!="object"?null:($=m&&$[m]||$["@@iterator"],typeof $=="function"?$:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,w={};function v($,H,oe){this.props=$,this.context=H,this.refs=w,this.updater=oe||y}v.prototype.isReactComponent={},v.prototype.setState=function($,H){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,H,"setState")},v.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function k(){}k.prototype=v.prototype;function C($,H,oe){this.props=$,this.context=H,this.refs=w,this.updater=oe||y}var E=C.prototype=new k;E.constructor=C,N(E,v.prototype),E.isPureReactComponent=!0;var T=Array.isArray,R=Object.prototype.hasOwnProperty,D={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function P($,H,oe){var q,me={},Z=null,ce=null;if(H!=null)for(q in H.ref!==void 0&&(ce=H.ref),H.key!==void 0&&(Z=""+H.key),H)R.call(H,q)&&!_.hasOwnProperty(q)&&(me[q]=H[q]);var he=arguments.length-2;if(he===1)me.children=oe;else if(1>>1,H=z[$];if(0>>1;$a(me,K))Za(ce,me)?(z[$]=ce,z[Z]=K,$=Z):(z[$]=me,z[q]=K,$=q);else if(Za(ce,K))z[$]=ce,z[Z]=K,$=Z;else break e}}return re}function a(z,re){var K=z.sortIndex-re.sortIndex;return K!==0?K:z.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,y=!1,N=!1,w=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(z){for(var re=n(h);re!==null;){if(re.callback===null)r(h);else if(re.startTime<=z)r(h),re.sortIndex=re.expirationTime,e(u,re);else break;re=n(h)}}function T(z){if(w=!1,E(z),!N)if(n(u)!==null)N=!0,O(R);else{var re=n(h);re!==null&&G(T,re.startTime-z)}}function R(z,re){N=!1,w&&(w=!1,k(P),P=-1),y=!0;var K=g;try{for(E(re),m=n(u);m!==null&&(!(m.expirationTime>re)||z&&!X());){var $=m.callback;if(typeof $=="function"){m.callback=null,g=m.priorityLevel;var H=$(m.expirationTime<=re);re=t.unstable_now(),typeof H=="function"?m.callback=H:m===n(u)&&r(u),E(re)}else r(u);m=n(u)}if(m!==null)var oe=!0;else{var q=n(h);q!==null&&G(T,q.startTime-re),oe=!1}return oe}finally{m=null,g=K,y=!1}}var D=!1,_=null,P=-1,L=5,F=-1;function X(){return!(t.unstable_now()-Fz||125$?(z.sortIndex=K,e(h,z),n(u)===null&&z===n(h)&&(w?(k(P),P=-1):w=!0,G(T,K-$))):(z.sortIndex=H,e(u,z),N||y||(N=!0,O(R))),z},t.unstable_shouldYield=X,t.unstable_wrapCallback=function(z){var re=g;return function(){var K=g;g=re;try{return z.apply(this,arguments)}finally{g=K}}}})(jm)),jm}var jv;function jE(){return jv||(jv=1,wm.exports=wE()),wm.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var kv;function kE(){if(kv)return Tr;kv=1;var t=fd(),e=jE();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function y(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function N(l,d,p,x){if(d===null||typeof d>"u"||y(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function w(l,d,p,x,j,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=j,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){v[l]=new w(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];v[d]=new w(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){v[l]=new w(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){v[l]=new w(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){v[l]=new w(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){v[l]=new w(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){v[l]=new w(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){v[l]=new w(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){v[l]=new w(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function C(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,C);v[d]=new w(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,C);v[d]=new w(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,C);v[d]=new w(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){v[l]=new w(l,1,!1,l.toLowerCase(),null,!1,!1)}),v.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){v[l]=new w(l,1,!1,l.toLowerCase(),null,!0,!0)});function E(l,d,p,x){var j=v.hasOwnProperty(d)?v[d]:null;(j!==null?j.type!==0:x||!(2B||j[A]!==S[B]){var U=` -`+j[A].replace(" at new "," at ");return l.displayName&&U.includes("")&&(U=U.replace("",l.displayName)),U}while(1<=A&&0<=B);break}}}finally{oe=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?H(l):""}function me(l){switch(l.tag){case 5:return H(l.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return l=q(l.type,!1),l;case 11:return l=q(l.type.render,!1),l;case 1:return l=q(l.type,!0),l;default:return""}}function Z(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 _:return"Fragment";case D:return"Portal";case L:return"Profiler";case P:return"StrictMode";case ue:return"Suspense";case ae:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case X:return(l.displayName||"Context")+".Consumer";case F:return(l._context.displayName||"Context")+".Provider";case te:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case I:return d=l.displayName||null,d!==null?d:Z(l.type)||"Memo";case O:d=l._payload,l=l._init;try{return Z(l(d))}catch{}}return null}function ce(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 Z(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 ve(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function Ae(l){var d=ve(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 Be(l){l._valueTracker||(l._valueTracker=Ae(l))}function $e(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=ve(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function pt(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 Et(l,d){var p=d.checked;return K({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function ln(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 yt(l,d){d=d.checked,d!=null&&E(l,"checked",d,!1)}function nn(l,d){yt(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")?Tt(l,d.type,p):d.hasOwnProperty("defaultValue")&&Tt(l,d.type,he(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function An(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 Tt(l,d,p){(d!=="number"||pt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Yt=Array.isArray;function rn(l,d,p,x){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=qe.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function lt(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var nt={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},gt=["Webkit","ms","Moz","O"];Object.keys(nt).forEach(function(l){gt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),nt[d]=nt[l]})});function It(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||nt.hasOwnProperty(l)&&nt[l]?(""+d).trim():d+"px"}function gn(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=It(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,j):l[p]=j}}var mr=K({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 wr(l,d){if(d){if(mr[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 As(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 Wr=null;function Is(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var fe=null,ge=null,Rt=null;function Pn(l){if(l=cc(l)){if(typeof fe!="function")throw Error(n(280));var d=l.stateNode;d&&(d=zd(d),fe(l.stateNode,l.type,d))}}function Qs(l){ge?Rt?Rt.push(l):Rt=[l]:ge=l}function Xs(){if(ge){var l=ge,d=Rt;if(Rt=ge=null,Pn(l),d)for(l=0;l>>=0,l===0?32:31-(Dn(l)/gr|0)|0}var Qt=64,Un=4194304;function ps(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 Os(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=ps(B):(S&=A,S!==0&&(x=ps(S)))}else A=p&~j,A!==0?x=ps(A):S!==0&&(x=ps(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 zi(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 jd(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=ec),uy=" ",hy=!1;function fy(l,d){switch(l){case"keyup":return f3.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function py(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Lo=!1;function m3(l,d){switch(l){case"compositionend":return py(d);case"keypress":return d.which!==32?null:(hy=!0,uy);case"textInput":return l=d.data,l===uy&&hy?null:l;default:return null}}function g3(l,d){if(Lo)return l==="compositionend"||!Zf&&fy(l,d)?(l=ay(),Ed=qf=Da=null,Lo=!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=Ny(p)}}function jy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?jy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function ky(){for(var l=window,d=pt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=pt(l.document)}return d}function np(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 S3(l){var d=ky(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&jy(p.ownerDocument.documentElement,p)){if(x!==null&&np(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=wy(p,S);var A=wy(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,_o=null,rp=null,sc=null,sp=!1;function Sy(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;sp||_o==null||_o!==pt(x)||(x=_o,"selectionStart"in x&&np(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}),sc&&rc(sc,x)||(sc=x,x=Dd(rp,"onSelect"),0Vo||(l.current=gp[Vo],gp[Vo]=null,Vo--)}function Vt(l,d){Vo++,gp[Vo]=l.current,l.current=d}var Fa={},tr=za(Fa),jr=za(!1),Vi=Fa;function Ho(l,d){var p=l.type.contextTypes;if(!p)return Fa;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 kr(l){return l=l.childContextTypes,l!=null}function Fd(){Gt(jr),Gt(tr)}function $y(l,d,p){if(tr.current!==Fa)throw Error(n(168));Vt(tr,d),Vt(jr,p)}function By(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,ce(l)||"Unknown",j));return K({},p,x)}function $d(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Fa,Vi=tr.current,Vt(tr,l),Vt(jr,jr.current),!0}function Vy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=By(l,d,Vi),x.__reactInternalMemoizedMergedChildContext=l,Gt(jr),Gt(tr),Vt(tr,l)):Gt(jr),Vt(jr,p)}var sa=null,Bd=!1,xp=!1;function Hy(l){sa===null?sa=[l]:sa.push(l)}function _3(l){Bd=!0,Hy(l)}function $a(){if(!xp&&sa!==null){xp=!0;var l=0,d=vt;try{var p=sa;for(vt=1;l>=A,j-=A,aa=1<<32-tt(d)+j|p<at?(Fn=Ze,Ze=null):Fn=Ze.sibling;var Nt=Ne(se,Ze,le[at],Me);if(Nt===null){Ze===null&&(Ze=Fn);break}l&&Ze&&Nt.alternate===null&&d(se,Ze),Q=S(Nt,Q,at),Xe===null?Ve=Nt:Xe.sibling=Nt,Xe=Nt,Ze=Fn}if(at===le.length)return p(se,Ze),Xt&&Wi(se,at),Ve;if(Ze===null){for(;atat?(Fn=Ze,Ze=null):Fn=Ze.sibling;var Ja=Ne(se,Ze,Nt.value,Me);if(Ja===null){Ze===null&&(Ze=Fn);break}l&&Ze&&Ja.alternate===null&&d(se,Ze),Q=S(Ja,Q,at),Xe===null?Ve=Ja:Xe.sibling=Ja,Xe=Ja,Ze=Fn}if(Nt.done)return p(se,Ze),Xt&&Wi(se,at),Ve;if(Ze===null){for(;!Nt.done;at++,Nt=le.next())Nt=ke(se,Nt.value,Me),Nt!==null&&(Q=S(Nt,Q,at),Xe===null?Ve=Nt:Xe.sibling=Nt,Xe=Nt);return Xt&&Wi(se,at),Ve}for(Ze=x(se,Ze);!Nt.done;at++,Nt=le.next())Nt=Pe(Ze,se,at,Nt.value,Me),Nt!==null&&(l&&Nt.alternate!==null&&Ze.delete(Nt.key===null?at:Nt.key),Q=S(Nt,Q,at),Xe===null?Ve=Nt:Xe.sibling=Nt,Xe=Nt);return l&&Ze.forEach(function(xE){return d(se,xE)}),Xt&&Wi(se,at),Ve}function yn(se,Q,le,Me){if(typeof le=="object"&&le!==null&&le.type===_&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case R:e:{for(var Ve=le.key,Xe=Q;Xe!==null;){if(Xe.key===Ve){if(Ve=le.type,Ve===_){if(Xe.tag===7){p(se,Xe.sibling),Q=j(Xe,le.props.children),Q.return=se,se=Q;break e}}else if(Xe.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===O&&Jy(Ve)===Xe.type){p(se,Xe.sibling),Q=j(Xe,le.props),Q.ref=dc(se,Xe,le),Q.return=se,se=Q;break e}p(se,Xe);break}else d(se,Xe);Xe=Xe.sibling}le.type===_?(Q=Xi(le.props.children,se.mode,Me,le.key),Q.return=se,se=Q):(Me=mu(le.type,le.key,le.props,null,se.mode,Me),Me.ref=dc(se,Q,le),Me.return=se,se=Me)}return A(se);case D:e:{for(Xe=le.key;Q!==null;){if(Q.key===Xe)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=pm(le,se.mode,Me),Q.return=se,se=Q}return A(se);case O:return Xe=le._init,yn(se,Q,Xe(le._payload),Me)}if(Yt(le))return Le(se,Q,le,Me);if(re(le))return Fe(se,Q,le,Me);Ud(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=fm(le,se.mode,Me),Q.return=se,se=Q),A(se)):p(se,Q)}return yn}var qo=Yy(!0),Qy=Yy(!1),Kd=za(null),qd=null,Go=null,jp=null;function kp(){jp=Go=qd=null}function Sp(l){var d=Kd.current;Gt(Kd),l._currentValue=d}function Cp(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){qd=l,jp=Go=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(Sr=!0),l.firstContext=null)}function Xr(l){var d=l._currentValue;if(jp!==l)if(l={context:l,memoizedValue:d,next:null},Go===null){if(qd===null)throw Error(n(308));Go=l,qd.dependencies={lanes:0,firstContext:l}}else Go=Go.next=l;return d}var Ui=null;function Ep(l){Ui===null?Ui=[l]:Ui.push(l)}function Xy(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,Ep(d)):(p.next=j.next,j.next=p),d.interleaved=p,oa(l,x)}function oa(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 Ba=!1;function Tp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zy(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 la(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Va(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(bt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,oa(l,p)}return j=x.interleaved,j===null?(d.next=d,Ep(x)):(d.next=j.next,j.next=d),x.interleaved=d,oa(l,p)}function Gd(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,Fi(l,p)}}function eb(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 Jd(l,d,p,x){var j=l.updateQueue;Ba=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,B=j.shared.pending;if(B!==null){j.shared.pending=null;var U=B,de=U.next;U.next=null,A===null?S=de:A.next=de,A=U;var we=l.alternate;we!==null&&(we=we.updateQueue,B=we.lastBaseUpdate,B!==A&&(B===null?we.firstBaseUpdate=de:B.next=de,we.lastBaseUpdate=U))}if(S!==null){var ke=j.baseState;A=0,we=de=U=null,B=S;do{var Ne=B.lane,Pe=B.eventTime;if((x&Ne)===Ne){we!==null&&(we=we.next={eventTime:Pe,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Le=l,Fe=B;switch(Ne=d,Pe=p,Fe.tag){case 1:if(Le=Fe.payload,typeof Le=="function"){ke=Le.call(Pe,ke,Ne);break e}ke=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=Fe.payload,Ne=typeof Le=="function"?Le.call(Pe,ke,Ne):Le,Ne==null)break e;ke=K({},ke,Ne);break e;case 2:Ba=!0}}B.callback!==null&&B.lane!==0&&(l.flags|=64,Ne=j.effects,Ne===null?j.effects=[B]:Ne.push(B))}else Pe={eventTime:Pe,lane:Ne,tag:B.tag,payload:B.payload,callback:B.callback,next:null},we===null?(de=we=Pe,U=ke):we=we.next=Pe,A|=Ne;if(B=B.next,B===null){if(B=j.shared.pending,B===null)break;Ne=B,B=Ne.next,Ne.next=null,j.lastBaseUpdate=Ne,j.shared.pending=null}}while(!0);if(we===null&&(U=ke),j.baseState=U,j.firstBaseUpdate=de,j.lastBaseUpdate=we,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);Gi|=A,l.lanes=A,l.memoizedState=ke}}function tb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Pp.transition;Pp.transition={};try{l(!1),d()}finally{vt=p,Pp.transition=x}}function vb(){return Zr().memoizedState}function B3(l,d,p){var x=Ka(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},Nb(l))wb(d,p);else if(p=Xy(l,d,p,x),p!==null){var j=yr();Ns(p,l,x,j),jb(p,d,x)}}function V3(l,d,p){var x=Ka(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(Nb(l))wb(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,gs(B,A)){var U=d.interleaved;U===null?(j.next=j,Ep(d)):(j.next=U.next,U.next=j),d.interleaved=j;return}}catch{}finally{}p=Xy(l,d,j,x),p!==null&&(j=yr(),Ns(p,l,x,j),jb(p,d,x))}}function Nb(l){var d=l.alternate;return l===an||d!==null&&d===an}function wb(l,d){pc=Xd=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function jb(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Fi(l,p)}}var tu={readContext:Xr,useCallback:nr,useContext:nr,useEffect:nr,useImperativeHandle:nr,useInsertionEffect:nr,useLayoutEffect:nr,useMemo:nr,useReducer:nr,useRef:nr,useState:nr,useDebugValue:nr,useDeferredValue:nr,useTransition:nr,useMutableSource:nr,useSyncExternalStore:nr,useId:nr,unstable_isNewReconciler:!1},H3={readContext:Xr,useCallback:function(l,d){return _s().memoizedState=[l,d===void 0?null:d],l},useContext:Xr,useEffect:hb,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Zd(4194308,4,mb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Zd(4194308,4,l,d)},useInsertionEffect:function(l,d){return Zd(4,2,l,d)},useMemo:function(l,d){var p=_s();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=_s();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=B3.bind(null,an,l),[x.memoizedState,l]},useRef:function(l){var d=_s();return l={current:l},d.memoizedState=l},useState:db,useDebugValue:$p,useDeferredValue:function(l){return _s().memoizedState=l},useTransition:function(){var l=db(!1),d=l[0];return l=$3.bind(null,l[1]),_s().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=an,j=_s();if(Xt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),zn===null)throw Error(n(349));(qi&30)!==0||ab(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,hb(ob.bind(null,x,S,l),[l]),x.flags|=2048,xc(9,ib.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=_s(),d=zn.identifierPrefix;if(Xt){var p=ia,x=aa;p=(x&~(1<<32-tt(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=mc++,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[Ds]=d,l[lc]=x,Hb(l,d,!1,!1),d.stateNode=l;e:{switch(A=As(p,x),p){case"dialog":qt("cancel",l),qt("close",l),j=x;break;case"iframe":case"object":case"embed":qt("load",l),j=x;break;case"video":case"audio":for(j=0;jel&&(d.flags|=128,x=!0,yc(S,!1),d.lanes=4194304)}else{if(!x)if(l=Yd(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),yc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Xt)return rr(d),null}else 2*Pt()-S.renderingStartTime>el&&p!==1073741824&&(d.flags|=128,x=!0,yc(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=Pt(),d.sibling=null,p=sn.current,Vt(sn,x?p&1|2:p&1),d):(rr(d),null);case 22:case 23:return dm(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Lr&1073741824)!==0&&(rr(d),d.subtreeFlags&6&&(d.flags|=8192)):rr(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function Q3(l,d){switch(bp(d),d.tag){case 1:return kr(d.type)&&Fd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Yo(),Gt(jr),Gt(tr),Rp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Ap(d),null;case 13:if(Gt(sn),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 Gt(sn),null;case 4:return Yo(),null;case 10:return Sp(d.type._context),null;case 22:case 23:return dm(),null;case 24:return null;default:return null}}var au=!1,sr=!1,X3=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){dn(l,d,x)}else p.current=null}function Xp(l,d,p){try{p()}catch(x){dn(l,d,x)}}var Kb=!1;function Z3(l,d){if(dp=Sd,l=ky(),np(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,U=-1,de=0,we=0,ke=l,Ne=null;t:for(;;){for(var Pe;ke!==p||j!==0&&ke.nodeType!==3||(B=A+j),ke!==S||x!==0&&ke.nodeType!==3||(U=A+x),ke.nodeType===3&&(A+=ke.nodeValue.length),(Pe=ke.firstChild)!==null;)Ne=ke,ke=Pe;for(;;){if(ke===l)break t;if(Ne===p&&++de===j&&(B=A),Ne===S&&++we===x&&(U=A),(Pe=ke.nextSibling)!==null)break;ke=Ne,Ne=ke.parentNode}ke=Pe}p=B===-1||U===-1?null:{start:B,end:U}}else p=null}p=p||{start:0,end:0}}else p=null;for(up={focusedElem:l,selectionRange:p},Sd=!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 Le=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Le!==null){var Fe=Le.memoizedProps,yn=Le.memoizedState,se=d.stateNode,Q=se.getSnapshotBeforeUpdate(d.elementType===d.type?Fe:ys(d.type,Fe),yn);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(Me){dn(d,d.return,Me)}if(l=d.sibling,l!==null){l.return=d.return,De=l;break}De=d.return}return Le=Kb,Kb=!1,Le}function bc(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&&Xp(d,p,S)}j=j.next}while(j!==x)}}function iu(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 Zp(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 qb(l){var d=l.alternate;d!==null&&(l.alternate=null,qb(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Ds],delete d[lc],delete d[mp],delete d[D3],delete d[L3])),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 Gb(l){return l.tag===5||l.tag===3||l.tag===4}function Jb(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Gb(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 em(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=_d));else if(x!==4&&(l=l.child,l!==null))for(em(l,d,p),l=l.sibling;l!==null;)em(l,d,p),l=l.sibling}function tm(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(tm(l,d,p),l=l.sibling;l!==null;)tm(l,d,p),l=l.sibling}var Kn=null,bs=!1;function Ha(l,d,p){for(p=p.child;p!==null;)Yb(l,d,p),p=p.sibling}function Yb(l,d,p){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(V,p)}catch{}switch(p.tag){case 5:sr||Xo(p,d);case 6:var x=Kn,j=bs;Kn=null,Ha(l,d,p),Kn=x,bs=j,Kn!==null&&(bs?(l=Kn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Kn.removeChild(p.stateNode));break;case 18:Kn!==null&&(bs?(l=Kn,p=p.stateNode,l.nodeType===8?pp(l.parentNode,p):l.nodeType===1&&pp(l,p),Ql(l)):pp(Kn,p.stateNode));break;case 4:x=Kn,j=bs,Kn=p.stateNode.containerInfo,bs=!0,Ha(l,d,p),Kn=x,bs=j;break;case 0:case 11:case 14:case 15:if(!sr&&(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)&&Xp(p,d,A),j=j.next}while(j!==x)}Ha(l,d,p);break;case 1:if(!sr&&(Xo(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(B){dn(p,d,B)}Ha(l,d,p);break;case 21:Ha(l,d,p);break;case 22:p.mode&1?(sr=(x=sr)||p.memoizedState!==null,Ha(l,d,p),sr=x):Ha(l,d,p);break;default:Ha(l,d,p)}}function Qb(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new X3),d.forEach(function(x){var j=lE.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function vs(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=A),x&=~S}if(x=j,x=Pt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*tE(x/1960))-x,10l?16:l,Ua===null)var x=!1;else{if(l=Ua,Ua=null,uu=0,(bt&6)!==0)throw Error(n(331));var j=bt;for(bt|=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 U=0;UPt()-sm?Yi(l,0):rm|=p),Er(l,d)}function dv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Un,Un<<=1,(Un&130023424)===0&&(Un=4194304)));var p=yr();l=oa(l,d),l!==null&&(zi(l,d,p),Er(l,p))}function oE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),dv(l,p)}function lE(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),dv(l,p)}var uv;uv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||jr.current)Sr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return Sr=!1,J3(l,d,p);Sr=(l.flags&131072)!==0}else Sr=!1,Xt&&(d.flags&1048576)!==0&&Wy(d,Hd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;su(l,d),l=d.pendingProps;var j=Ho(d,tr.current);Jo(d,p),j=Dp(null,d,x,l,j,p);var S=Lp();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,kr(x)?(S=!0,$d(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Tp(d),j.updater=nu,d.stateNode=j,j._reactInternals=d,Vp(d,x,l,p),d=Kp(null,d,x,!0,S,p)):(d.tag=0,Xt&&S&&yp(d),xr(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(su(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=dE(x),l=ys(x,l),j){case 0:d=Up(null,d,x,l,p);break e;case 1:d=_b(null,d,x,l,p);break e;case 11:d=Rb(null,d,x,l,p);break e;case 14:d=Pb(null,d,x,ys(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:ys(x,j),Up(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ys(x,j),_b(l,d,x,j,p);case 3:e:{if(zb(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,Zy(l,d),Jd(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=Fb(l,d,x,p,j);break e}else if(x!==j){j=Qo(Error(n(424)),d),d=Fb(l,d,x,p,j);break e}else for(Dr=_a(d.stateNode.containerInfo.firstChild),Or=d,Xt=!0,xs=null,p=Qy(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Ko(),x===j){d=ca(l,d,p);break e}xr(l,d,x,p)}d=d.child}return d;case 5:return nb(d),l===null&&Np(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,hp(x,j)?A=null:S!==null&&hp(x,S)&&(d.flags|=32),Lb(l,d),xr(l,d,A,p),d.child;case 6:return l===null&&Np(d),null;case 13:return $b(l,d,p);case 4:return Mp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=qo(d,null,x,p):xr(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ys(x,j),Rb(l,d,x,j,p);case 7:return xr(l,d,d.pendingProps,p),d.child;case 8:return xr(l,d,d.pendingProps.children,p),d.child;case 12:return xr(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,Vt(Kd,x._currentValue),x._currentValue=A,S!==null)if(gs(S.value,A)){if(S.children===j.children&&!jr.current){d=ca(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 U=B.firstContext;U!==null;){if(U.context===x){if(S.tag===1){U=la(-1,p&-p),U.tag=2;var de=S.updateQueue;if(de!==null){de=de.shared;var we=de.pending;we===null?U.next=U:(U.next=we.next,we.next=U),de.pending=U}}S.lanes|=p,U=S.alternate,U!==null&&(U.lanes|=p),Cp(S.return,p,d),B.lanes|=p;break}U=U.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),Cp(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}xr(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,Jo(d,p),j=Xr(j),x=x(j),d.flags|=1,xr(l,d,x,p),d.child;case 14:return x=d.type,j=ys(x,d.pendingProps),j=ys(x.type,j),Pb(l,d,x,j,p);case 15:return Ob(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ys(x,j),su(l,d),d.tag=1,kr(x)?(l=!0,$d(d)):l=!1,Jo(d,p),Sb(d,x,j),Vp(d,x,j,p),Kp(null,d,x,!0,l,p);case 19:return Vb(l,d,p);case 22:return Db(l,d,p)}throw Error(n(156,d.tag))};function hv(l,d){return Gr(l,d)}function cE(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 ts(l,d,p,x){return new cE(l,d,p,x)}function hm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function dE(l){if(typeof l=="function")return hm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===te)return 11;if(l===I)return 14}return 2}function Ga(l,d){var p=l.alternate;return p===null?(p=ts(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 mu(l,d,p,x,j,S){var A=2;if(x=l,typeof l=="function")hm(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case _:return Xi(p.children,j,S,d);case P:A=8,j|=8;break;case L:return l=ts(12,p,d,j|2),l.elementType=L,l.lanes=S,l;case ue:return l=ts(13,p,d,j),l.elementType=ue,l.lanes=S,l;case ae:return l=ts(19,p,d,j),l.elementType=ae,l.lanes=S,l;case G:return gu(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case F:A=10;break e;case X:A=9;break e;case te:A=11;break e;case I:A=14;break e;case O:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=ts(A,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function Xi(l,d,p,x){return l=ts(7,l,x,d),l.lanes=p,l}function gu(l,d,p,x){return l=ts(22,l,x,d),l.elementType=G,l.lanes=p,l.stateNode={isHidden:!1},l}function fm(l,d,p){return l=ts(6,l,null,d),l.lanes=p,l}function pm(l,d,p){return d=ts(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function uE(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=Ul(0),this.expirationTimes=Ul(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ul(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function mm(l,d,p,x,j,S,A,B,U){return l=new uE(l,d,p,B,U),d===1?(d=1,S===!0&&(d|=8)):d=0,S=ts(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tp(S),l}function hE(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(),Nm.exports=kE(),Nm.exports}var Cv;function SE(){if(Cv)return ju;Cv=1;var t=Rw();return ju.createRoot=t.createRoot,ju.hydrateRoot=t.hydrateRoot,ju}var CE=SE(),pd=Rw();const Pw=Iw(pd);/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Yc(){return Yc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Ox(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function TE(){return Math.random().toString(36).substr(2,8)}function Tv(t,e){return{usr:t.state,key:t.key,idx:e}}function wg(t,e,n,r){return n===void 0&&(n=null),Yc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Rl(e):e,{state:n,key:e&&e.key||r||TE()})}function oh(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 ME(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=oi.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Yc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=oi.Pop;let v=f(),k=v==null?null:v-h;h=v,u&&u({action:c,location:w.location,delta:k})}function g(v,k){c=oi.Push;let C=wg(w.location,v,k);h=f()+1;let E=Tv(C,h),T=w.createHref(C);try{o.pushState(E,"",T)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(T)}i&&u&&u({action:c,location:w.location,delta:1})}function y(v,k){c=oi.Replace;let C=wg(w.location,v,k);h=f();let E=Tv(C,h),T=w.createHref(C);o.replaceState(E,"",T),i&&u&&u({action:c,location:w.location,delta:0})}function N(v){let k=a.location.origin!=="null"?a.location.origin:a.location.href,C=typeof v=="string"?v:oh(v);return C=C.replace(/ $/,"%20"),vn(k,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,k)}let w={get action(){return c},get location(){return t(a,o)},listen(v){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Ev,m),u=v,()=>{a.removeEventListener(Ev,m),u=null}},createHref(v){return e(a,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(v){return o.go(v)}};return w}var Mv;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Mv||(Mv={}));function AE(t,e,n){return n===void 0&&(n="/"),IE(t,e,n)}function IE(t,e,n,r){let a=typeof e=="string"?Rl(e):e,i=Dx(a.pathname||"/",n);if(i==null)return null;let o=Ow(t);RE(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};u.relativePath.startsWith("/")&&(vn(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=hi([r,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(vn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),Ow(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:FE(h,i.index),routesMeta:f})};return t.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let u of Dw(i.path))a(i,o,u)}),e}function Dw(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=Dw(r.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function RE(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:$E(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const PE=/^:[\w-]+$/,OE=3,DE=2,LE=1,_E=10,zE=-2,Av=t=>t==="*";function FE(t,e){let n=t.split("/"),r=n.length;return n.some(Av)&&(r+=zE),e&&(r+=DE),n.filter(a=>!Av(a)).reduce((a,i)=>a+(PE.test(i)?OE:i===""?LE:_E),r)}function $E(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function BE(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const N=c[m];return y&&!N?h[g]=void 0:h[g]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function HE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Ox(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=[],a="^"+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:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function WE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ox(!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 Dx(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 UE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,KE=t=>UE.test(t);function qE(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Rl(t):t,i;if(n)if(KE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Ox(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Iv(n.substring(1),"/"):i=Iv(n,e)}else i=e;return{pathname:i,search:YE(r),hash:QE(a)}}function Iv(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function km(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 GE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Lx(t,e){let n=GE(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function _x(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Rl(t):(a=Yc({},t),vn(!a.pathname||!a.pathname.includes("?"),km("?","pathname","search",a)),vn(!a.pathname||!a.pathname.includes("#"),km("#","pathname","hash",a)),vn(!a.search||!a.search.includes("#"),km("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.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;a.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=qE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const hi=t=>t.join("/").replace(/\/\/+/g,"/"),JE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),YE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,QE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function XE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Lw=["post","put","patch","delete"];new Set(Lw);const ZE=["get",...Lw];new Set(ZE);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Qc(){return Qc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=_x(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:hi([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const rT=b.createContext(null);function sT(t){let e=b.useContext(Ea).outlet;return e&&b.createElement(rT.Provider,{value:t},e)}function Fw(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(ki),{matches:a}=b.useContext(Ea),{pathname:i}=Si(),o=JSON.stringify(Lx(a,r.v7_relativeSplatPath));return b.useMemo(()=>_x(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function aT(t,e){return iT(t,e)}function iT(t,e,n,r){Pl()||vn(!1);let{navigator:a}=b.useContext(ki),{matches:i}=b.useContext(Ea),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Si(),f;if(e){var m;let v=typeof e=="string"?Rl(e):e;u==="/"||(m=v.pathname)!=null&&m.startsWith(u)||vn(!1),f=v}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let v=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let N=AE(t,{pathname:y}),w=uT(N&&N.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:hi([u,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?u:hi([u,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return e&&w?b.createElement(uf.Provider,{value:{location:Qc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:oi.Pop}},w):w}function oT(){let t=mT(),e=XE(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:a},n):null,null)}const lT=b.createElement(oT,null);class cT extends b.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?b.createElement(Ea.Provider,{value:this.props.routeContext},b.createElement(_w.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function dT(t){let{routeContext:e,match:n,children:r}=t,a=b.useContext(zx);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Ea.Provider,{value:e},r)}function uT(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||vn(!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,N=!1,w=null,v=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,w=m.route.errorElement||lT,u&&(h<0&&g===0?(xT("route-fallback"),N=!0,v=null):h===g&&(N=!0,v=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),C=()=>{let E;return y?E=w:N?E=v:m.route.Component?E=b.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=f,b.createElement(dT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:E})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(cT,{location:n.location,revalidation:n.revalidation,component:w,error:y,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):C()},null)}var $w=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})($w||{}),Bw=(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})(Bw||{});function hT(t){let e=b.useContext(zx);return e||vn(!1),e}function fT(t){let e=b.useContext(eT);return e||vn(!1),e}function pT(t){let e=b.useContext(Ea);return e||vn(!1),e}function Vw(t){let e=pT(),n=e.matches[e.matches.length-1];return n.route.id||vn(!1),n.route.id}function mT(){var t;let e=b.useContext(_w),n=fT(),r=Vw();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function gT(){let{router:t}=hT($w.UseNavigateStable),e=Vw(Bw.UseNavigateStable),n=b.useRef(!1);return zw(()=>{n.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Qc({fromRouteId:e},i)))},[t,e])}const Rv={};function xT(t,e,n){Rv[t]||(Rv[t]=!0)}function yT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Sm(t){let{to:e,replace:n,state:r,relative:a}=t;Pl()||vn(!1);let{future:i,static:o}=b.useContext(ki),{matches:c}=b.useContext(Ea),{pathname:u}=Si(),h=Ci(),f=_x(e,Lx(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:a}),[h,m,a,n,r]),null}function bT(t){return sT(t.context)}function Ht(t){vn(!1)}function vT(t){let{basename:e="/",children:n=null,location:r,navigationType:a=oi.Pop,navigator:i,static:o=!1,future:c}=t;Pl()&&vn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:i,static:o,future:Qc({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=Rl(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:N="default"}=r,w=b.useMemo(()=>{let v=Dx(f,u);return v==null?null:{location:{pathname:v,search:m,hash:g,state:y,key:N},navigationType:a}},[u,f,m,g,y,N,a]);return w==null?null:b.createElement(ki.Provider,{value:h},b.createElement(uf.Provider,{children:n,value:w}))}function NT(t){let{children:e,location:n}=t;return aT(jg(e),n)}new Promise(()=>{});function jg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,a)=>{if(!b.isValidElement(r))return;let i=[...e,a];if(r.type===b.Fragment){n.push.apply(n,jg(r.props.children,i));return}r.type!==Ht&&vn(!1),!r.props.index||!r.props.children||vn(!1);let o={id:r.props.id||i.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=jg(r.props.children,i)),n.push(o)}),n}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function kg(){return kg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function jT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function kT(t,e){return t.button===0&&(!e||e==="_self")&&!jT(t)}function Sg(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(a=>[n,a]):[[n,r]])},[]))}function ST(t,e){let n=Sg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const CT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ET="6";try{window.__reactRouterVersion=ET}catch{}const TT="startTransition",Pv=df[TT];function MT(t){let{basename:e,children:n,future:r,window:a}=t,i=b.useRef();i.current==null&&(i.current=EE({window:a,v5Compat:!0}));let o=i.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&Pv?Pv(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>yT(r),[r]),b.createElement(vT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const AT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",IT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Cg=b.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=wT(e,CT),{basename:y}=b.useContext(ki),N,w=!1;if(typeof h=="string"&&IT.test(h)&&(N=h,AT))try{let E=new URL(window.location.href),T=h.startsWith("//")?new URL(E.protocol+h):new URL(h),R=Dx(T.pathname,y);T.origin===E.origin&&R!=null?h=R+T.search+T.hash:w=!0}catch{}let v=tT(h,{relative:a}),k=RT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function C(E){r&&r(E),E.defaultPrevented||k(E)}return b.createElement("a",kg({},g,{href:N||v,onClick:w||i?r:C,ref:n,target:u}))});var Ov;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Ov||(Ov={}));var Dv;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Dv||(Dv={}));function RT(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Ci(),h=Si(),f=Fw(t,{relative:o});return b.useCallback(m=>{if(kT(m,n)){m.preventDefault();let g=r!==void 0?r:oh(h)===oh(f);u(t,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function Hw(t){let e=b.useRef(Sg(t)),n=b.useRef(!1),r=Si(),a=b.useMemo(()=>ST(r.search,n.current?null:e.current),[r.search]),i=Ci(),o=b.useCallback((c,u)=>{const h=Sg(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,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 PT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),OT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Lv=t=>{const e=OT(t);return e.charAt(0).toUpperCase()+e.slice(1)},Ww=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),DT=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. - * See the LICENSE file in the root directory of this source tree. - */var LT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _T=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...LT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Ww("lucide",a),...!i&&!DT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(i)?i:[i]]));/** - * @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 Te=(t,e)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement(_T,{ref:i,iconNode:e,className:Ww(`lucide-${PT(Lv(t))}`,`lucide-${t}`,r),...a}));return n.displayName=Lv(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 zT=[["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"}]],Cm=Te("arrow-up-down",zT);/** - * @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 FT=[["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"}]],_v=Te("bitcoin",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 $T=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],BT=Te("bold",$T);/** - * @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 VT=[["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"}]],Br=Te("book-open",VT);/** - * @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 HT=[["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"}]],lh=Te("calendar",HT);/** - * @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 WT=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],UT=Te("chart-column",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 KT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],hf=Te("check",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:"m6 9 6 6 6-6",key:"qrunsl"}]],Xc=Te("chevron-down",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=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],JT=Te("chevron-left",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 YT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fl=Te("chevron-right",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=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Uw=Te("chevron-up",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=[["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"}]],Kw=Te("circle-alert",XT);/** - * @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 ZT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],zv=Te("circle-check-big",ZT);/** - * @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 eM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Eg=Te("circle-check",eM);/** - * @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 tM=[["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"}]],qw=Te("circle-question-mark",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=[["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"}]],Em=Te("circle-user",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=[["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"}]],Gw=Te("circle-x",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=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Tg=Te("clock",sM);/** - * @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 aM=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],iM=Te("cloud",aM);/** - * @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 oM=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],lM=Te("code",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 cM=[["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"}]],Fx=Te("copy",cM);/** - * @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 dM=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Fv=Te("credit-card",dM);/** - * @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 uM=[["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=Te("crown",uM);/** - * @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 hM=[["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"}]],ch=Te("dollar-sign",hM);/** - * @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:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],pM=Te("download",fM);/** - * @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 mM=[["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"}]],Us=Te("external-link",mM);/** - * @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 gM=[["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"}]],Mg=Te("eye",gM);/** - * @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 xM=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Jw=Te("file-text",xM);/** - * @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 yM=[["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"}]],Yw=Te("funnel",yM);/** - * @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 bM=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],Qw=Te("gift",bM);/** - * @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 vM=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],NM=Te("git-merge",vM);/** - * @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 wM=[["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"}]],Ag=Te("globe",wM);/** - * @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 jM=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],kM=Te("graduation-cap",jM);/** - * @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=[["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"}]],ua=Te("grip-vertical",SM);/** - * @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 CM=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],EM=Te("handshake",CM);/** - * @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 TM=[["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"}]],$v=Te("hash",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 MM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],AM=Te("heading-1",MM);/** - * @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 IM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],RM=Te("heading-2",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 PM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],OM=Te("heading-3",PM);/** - * @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 DM=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],LM=Te("house",DM);/** - * @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 _M=[["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"}]],Xw=Te("image",_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 zM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ku=Te("info",zM);/** - * @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=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],$M=Te("italic",FM);/** - * @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 BM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Zw=Te("key",BM);/** - * @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 VM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],HM=Te("layout-dashboard",VM);/** - * @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 WM=[["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"}]],Ss=Te("link-2",WM);/** - * @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 UM=[["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"}]],Ig=Te("link",UM);/** - * @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 KM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],qM=Te("list-ordered",KM);/** - * @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 GM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],JM=Te("list",GM);/** - * @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 YM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],QM=Te("lock",YM);/** - * @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 XM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],ZM=Te("log-out",XM);/** - * @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:"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"}]],ej=Te("map-pin",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=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],nA=Te("menu",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 rA=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],sA=Te("message-circle",rA);/** - * @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:"M5 12h14",key:"1ays0h"}]],iA=Te("minus",aA);/** - * @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 oA=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],pl=Te("navigation",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 lA=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],cA=Te("palette",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 dA=[["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"}]],Wt=Te("pen-line",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 uA=[["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"}]],tj=Te("pencil",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 hA=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],fA=Te("percent",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 pA=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],mA=Te("phone",pA);/** - * @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 gA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],xA=Te("pin",gA);/** - * @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 yA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],hn=Te("plus",yA);/** - * @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=[["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"}]],Bv=Te("qr-code",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 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],NA=Te("quote",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 wA=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],jA=Te("redo",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 kA=[["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"}]],Ke=Te("refresh-cw",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:"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"}]],bn=Te("save",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:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Na=Te("search",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:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],TA=Te("send",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 MA=[["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"}]],wl=Te("settings",MA);/** - * @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:"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"}]],Su=Te("settings-2",AA);/** - * @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 IA=[["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"}]],$x=Te("shield-check",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 RA=[["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"}]],Rg=Te("shopping-bag",RA);/** - * @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:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],yi=Te("smartphone",PA);/** - * @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 OA=[["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=Te("star",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:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],LA=Te("strikethrough",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 _A=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],zA=Te("table",_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 FA=[["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"}]],_c=Te("tag",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 $A=[["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"}]],Jn=Te("trash-2",$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 BA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],zc=Te("trending-up",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:"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"}]],Pg=Te("trophy",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:"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"}]],nj=Te("undo-2",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:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],UA=Te("undo",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 KA=[["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"}]],dh=Te("upload",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:"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"}]],Og=Te("user-plus",qA);/** - * @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 GA=[["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"}]],lo=Te("user",GA);/** - * @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 JA=[["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"}]],Zn=Te("users",JA);/** - * @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 YA=[["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=Te("wallet",YA);/** - * @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:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ir=Te("x",QA);/** - * @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 XA=[["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"}]],li=Te("zap",XA),Bx="admin_token";function ff(){try{return localStorage.getItem(Bx)}catch{return null}}function ZA(t){try{localStorage.setItem(Bx,t)}catch{}}function Tm(){try{localStorage.removeItem(Bx)}catch{}}const e5="https://soulapi.quwanzhi.com",t5=15e3,Vv=6e4,n5=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):e5};function mo(t){const e=n5(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function pf(t,e={}){const{data:n,...r}=e,a=mo(t),i=new Headers(r.headers),o=ff();o&&i.set("Authorization",`Bearer ${o}`),n!=null&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=r.timeout??t5,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),y=(m.headers.get("Content-Type")||"").includes("application/json")?await m.json():m,N=w=>{const v=w,k=((v==null?void 0:v.message)||(v==null?void 0:v.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){N(y);const w=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw w.status=m.status,w.data=y,w}return N(y),y}function Oe(t,e){return pf(t,{...e,method:"GET"})}function wt(t,e,n){return pf(t,{...n,method:"POST",data:e})}function _t(t,e,n){return pf(t,{...n,method:"PUT",data:e})}function Bs(t,e){return pf(t,{...e,method:"DELETE"})}function r5(){const[t,e]=b.useState(!1),[n,r]=b.useState("");return b.useEffect(()=>{const a=i=>{const o=i.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",a),()=>window.removeEventListener("recharge-alert",a)},[]),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(Kw,{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(ir,{className:"w-4 h-4"})})]}):null}const s5=[{icon:HM,label:"数据概览",href:"/dashboard"},{icon:Br,label:"内容管理",href:"/content"},{icon:Zn,label:"用户管理",href:"/users"},{icon:NM,label:"找伙伴",href:"/find-partner"},{icon:jl,label:"推广中心",href:"/distribution"}];function a5(){const t=Si(),e=Ci(),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;if(!ff()){e("/login",{replace:!0});return}return Oe("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(Tm(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(Tm(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{Tm();try{await wt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?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:[s5.map(c=>{const u=t.pathname===c.href;return s.jsxs(Cg,{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(Cg,{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(wl,{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(ZM,{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(r5,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(bT,{})})]})]})}function Hv(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Vx(...t){return e=>{let n=!1;const r=t.map(a=>{const i=Hv(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;rj(i)&&typeof uh=="function"&&(i=uh(i._payload));const c=b.Children.toArray(i),u=c.find(d5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var aj=sj("Slot");function l5(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(rj(a)&&typeof uh=="function"&&(a=uh(a._payload)),b.isValidElement(a)){const o=h5(a),c=u5(i,a.props);return a.type!==b.Fragment&&(c.ref=r?Vx(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var c5=Symbol("radix.slottable");function d5(t){return b.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 a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function h5(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function ij(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Uv=oj,lj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Uv(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const g=Wv(f)||Wv(m);return a[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(N=>{let[w,v]=N;return Array.isArray(v)?v.includes({...i,...c}[w]):{...i,...c}[w]===v})?[...h,m,g]:h},[]);return Uv(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},f5=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),cj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),hh="-",Kv=[],m5="arbitrary..",g5=t=>{const e=y5(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return x5(o);const c=o.split(hh),u=c[0]===""&&c.length>1?1:0;return dj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?f5(h,u):u:h||Kv}return n[o]||Kv}}},dj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=dj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(hh):t.slice(e).join(hh),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?m5+r:void 0})(),y5=t=>{const{theme:e,classGroups:n}=t;return b5(n,e)},b5=(t,e)=>{const n=cj();for(const r in t){const a=t[r];Hx(a,n,r,e)}return n},Hx=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){N5(t,e,n);return}if(typeof t=="function"){w5(t,e,n,r);return}j5(t,e,n,r)},N5=(t,e,n)=>{const r=t===""?e:uj(e,t);r.classGroupId=n},w5=(t,e,n,r)=>{if(k5(t)){Hx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(p5(n,t))},j5=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(hh),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,S5=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const a=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},Dg="!",qv=":",C5=[],Gv=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),E5=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let w=0;wu?h-u:void 0;return Gv(i,y,g,N)};if(e){const a=e+qv,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):Gv(C5,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},T5=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i0&&(a.sort(),r.push(...a),a=[]),r.push(o)):a.push(o)}return a.length>0&&(a.sort(),r.push(...a)),r}},M5=t=>({cache:S5(t.cacheSize),parseClassName:E5(t),sortModifiers:T5(t),...g5(t)}),A5=/\s+/,I5=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(A5);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:N,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let v=!!w,k=r(v?N.substring(0,w):N);if(!k){if(!v){u=f+(u.length>0?" "+u:u);continue}if(k=r(N),!k){u=f+(u.length>0?" "+u:u);continue}v=!1}const C=g.length===0?"":g.length===1?g[0]:i(g).join(":"),E=y?C+Dg:C,T=E+k;if(o.indexOf(T)>-1)continue;o.push(T);const R=a(k,v);for(let D=0;D0?" "+u:u)}return u},R5=(...t)=>{let e=0,n,r,a="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,a,i;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=M5(h),r=n.cache.get,a=n.cache.set,i=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=I5(u,n);return a(u,f),f};return i=o,(...u)=>i(R5(...u))},O5=[],Tn=t=>{const e=n=>n[t]||O5;return e.isThemeGetter=!0,e},fj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,D5=/^\d+\/\d+$/,L5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_5=/\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$/,z5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,F5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nl=t=>D5.test(t),dt=t=>!!t&&!Number.isNaN(Number(t)),Ya=t=>!!t&&Number.isInteger(Number(t)),Mm=t=>t.endsWith("%")&&dt(t.slice(0,-1)),ha=t=>L5.test(t),B5=()=>!0,V5=t=>_5.test(t)&&!z5.test(t),mj=()=>!1,H5=t=>F5.test(t),W5=t=>$5.test(t),U5=t=>!_e(t)&&!ze(t),K5=t=>Ol(t,yj,mj),_e=t=>fj.test(t),Zi=t=>Ol(t,bj,V5),Am=t=>Ol(t,Q5,dt),Jv=t=>Ol(t,gj,mj),q5=t=>Ol(t,xj,W5),Cu=t=>Ol(t,vj,H5),ze=t=>pj.test(t),Sc=t=>Dl(t,bj),G5=t=>Dl(t,X5),Yv=t=>Dl(t,gj),J5=t=>Dl(t,yj),Y5=t=>Dl(t,xj),Eu=t=>Dl(t,vj,!0),Ol=(t,e,n)=>{const r=fj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Dl=(t,e,n=!1)=>{const r=pj.exec(t);return r?r[1]?e(r[1]):n:!1},gj=t=>t==="position"||t==="percentage",xj=t=>t==="image"||t==="url",yj=t=>t==="length"||t==="size"||t==="bg-size",bj=t=>t==="length",Q5=t=>t==="number",X5=t=>t==="family-name",vj=t=>t==="shadow",Z5=()=>{const t=Tn("color"),e=Tn("font"),n=Tn("text"),r=Tn("font-weight"),a=Tn("tracking"),i=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"),N=Tn("blur"),w=Tn("perspective"),v=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"],R=()=>[...T(),ze,_e],D=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],P=()=>[ze,_e,u],L=()=>[nl,"full","auto",...P()],F=()=>[Ya,"none","subgrid",ze,_e],X=()=>["auto",{span:["full",Ya,ze,_e]},Ya,ze,_e],te=()=>[Ya,"auto",ze,_e],ue=()=>["auto","min","max","fr",ze,_e],ae=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...P()],G=()=>[nl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],z=()=>[t,ze,_e],re=()=>[...T(),Yv,Jv,{position:[ze,_e]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",J5,K5,{size:[ze,_e]}],H=()=>[Mm,Sc,Zi],oe=()=>["","none","full",h,ze,_e],q=()=>["",dt,Sc,Zi],me=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[dt,Mm,Yv,Jv],he=()=>["","none",N,ze,_e],ve=()=>["none",dt,ze,_e],Ae=()=>["none",dt,ze,_e],Be=()=>[dt,ze,_e],$e=()=>[nl,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ha],breakpoint:[ha],color:[B5],container:[ha],"drop-shadow":[ha],ease:["in","out","in-out"],font:[U5],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ha],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ha],shadow:[ha],spacing:["px",dt],text:[ha],"text-shadow":[ha],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nl,_e,ze,v]}],container:["container"],columns:[{columns:[dt,_e,ze,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:R()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],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:[Ya,"auto",ze,_e]}],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:[dt,nl,"auto","initial","none",_e]}],grow:[{grow:["",dt,ze,_e]}],shrink:[{shrink:["",dt,ze,_e]}],order:[{order:[Ya,"first","last","none",ze,_e]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...ae(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...ae()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":ae()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],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:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],w:[{w:[c,"screen",...G()]}],"min-w":[{"min-w":[c,"screen","none",...G()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",n,Sc,Zi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ze,Am]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Mm,_e]}],"font-family":[{font:[G5,_e,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:[a,ze,_e]}],"line-clamp":[{"line-clamp":[dt,"none",ze,Am]}],leading:[{leading:[i,...P()]}],"list-image":[{"list-image":["none",ze,_e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ze,_e]}],"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:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[dt,"from-font","auto",ze,Zi]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[dt,"auto",ze,_e]}],"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",ze,_e]}],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",ze,_e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:re()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ya,ze,_e],radial:["",ze,_e],conic:[Ya,ze,_e]},Y5,q5]}],"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:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:q()}],"border-w-x":[{"border-x":q()}],"border-w-y":[{"border-y":q()}],"border-w-s":[{"border-s":q()}],"border-w-e":[{"border-e":q()}],"border-w-t":[{"border-t":q()}],"border-w-r":[{"border-r":q()}],"border-w-b":[{"border-b":q()}],"border-w-l":[{"border-l":q()}],"divide-x":[{"divide-x":q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"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:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[dt,ze,_e]}],"outline-w":[{outline:["",dt,Sc,Zi]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,Eu,Cu]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",m,Eu,Cu]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[dt,Zi]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":q()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",g,Eu,Cu]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[dt,ze,_e]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"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":[dt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"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":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"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":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"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":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"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":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"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":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"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":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[ze,_e]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"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":[dt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"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:re()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ze,_e]}],filter:[{filter:["","none",ze,_e]}],blur:[{blur:he()}],brightness:[{brightness:[dt,ze,_e]}],contrast:[{contrast:[dt,ze,_e]}],"drop-shadow":[{"drop-shadow":["","none",y,Eu,Cu]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",dt,ze,_e]}],"hue-rotate":[{"hue-rotate":[dt,ze,_e]}],invert:[{invert:["",dt,ze,_e]}],saturate:[{saturate:[dt,ze,_e]}],sepia:[{sepia:["",dt,ze,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",ze,_e]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[dt,ze,_e]}],"backdrop-contrast":[{"backdrop-contrast":[dt,ze,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dt,ze,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dt,ze,_e]}],"backdrop-invert":[{"backdrop-invert":["",dt,ze,_e]}],"backdrop-opacity":[{"backdrop-opacity":[dt,ze,_e]}],"backdrop-saturate":[{"backdrop-saturate":[dt,ze,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",dt,ze,_e]}],"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",ze,_e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dt,"initial",ze,_e]}],ease:[{ease:["linear","initial",k,ze,_e]}],delay:[{delay:[dt,ze,_e]}],animate:[{animate:["none",C,ze,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,ze,_e]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:Ae()}],"scale-x":[{"scale-x":Ae()}],"scale-y":[{"scale-y":Ae()}],"scale-z":[{"scale-z":Ae()}],"scale-3d":["scale-3d"],skew:[{skew:Be()}],"skew-x":[{"skew-x":Be()}],"skew-y":[{"skew-y":Be()}],transform:[{transform:[ze,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:$e()}],"translate-x":[{"translate-x":$e()}],"translate-y":[{"translate-y":$e()}],"translate-z":[{"translate-z":$e()}],"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",ze,_e]}],"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",ze,_e]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[dt,Sc,Zi,Am]}],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"]}},eI=P5(Z5);function Ct(...t){return eI(oj(t))}const tI=lj("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 ee({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?aj:"button";return s.jsx(i,{"data-slot":"button",className:Ct(tI({variant:e,size:n,className:t})),...a})}function ne({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 nI(){const t=Ci(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.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)){ZA(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($x,{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(lo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ne,{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(QM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ne,{type:"password",value:r,onChange:f=>a(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()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(ee,{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 Ce=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ce.displayName="Card";const Je=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex flex-col space-y-1.5 p-6",t),...e}));Je.displayName="CardHeader";const Ye=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Ct("font-semibold leading-none tracking-tight",t),...e}));Ye.displayName="CardTitle";const Ft=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Ct("text-sm text-muted-foreground",t),...e}));Ft.displayName="CardDescription";const Ee=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("p-6 pt-0",t),...e}));Ee.displayName="CardContent";const rI=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex items-center p-6 pt-0",t),...e}));rI.displayName="CardFooter";const sI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Im(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=sI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.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:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.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 ie={success:(t,e)=>Im(t,"success",e),error:(t,e)=>Im(t,"error",e),info:(t,e)=>Im(t,"info",e)};function ot(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function aI(t,e){const n=b.createContext(e),r=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,a]}function Ei(t,e=[]){let n=[];function r(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...N}=m,w=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,v=b.useMemo(()=>N,Object.values(N));return s.jsx(w.Provider,{value:v,children:y})};h.displayName=i+"Provider";function f(m,g){var w;const y=((w=g==null?void 0:g[t])==null?void 0:w[u])||c,N=b.useContext(y);if(N)return N;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,iI(a,...e)]}function iI(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(i)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var or=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},oI=df[" useId ".trim().toString()]||(()=>{}),lI=0;function fi(t){const[e,n]=b.useState(oI());return or(()=>{n(r=>r??String(lI++))},[t]),e?`radix-${e}`:""}var cI=df[" useInsertionEffect ".trim().toString()]||or;function go({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=dI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=b.useRef(t!==void 0);b.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=b.useCallback(f=>{var m;if(c){const g=uI(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function dI({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return cI(()=>{i.current=e},[e]),b.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function uI(t){return typeof t=="function"}function Zc(t){const e=hI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(pI);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function hI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=gI(a),c=mI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?Vx(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var fI=Symbol("radix.slottable");function pI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===fI}function mI(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function gI(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var xI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ut=xI.reduce((t,e)=>{const n=Zc(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function yI(t,e){t&&pd.flushSync(()=>t.dispatchEvent(e))}function bi(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function bI(t,e=globalThis==null?void 0:globalThis.document){const n=bi(t);b.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var vI="DismissableLayer",Lg="dismissableLayer.update",NI="dismissableLayer.pointerDownOutside",wI="dismissableLayer.focusOutside",Qv,Nj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wx=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(Nj),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),N=St(e,_=>m(_)),w=Array.from(h.layers),[v]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(v),C=f?w.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,T=C>=k,R=SI(_=>{const P=_.target,L=[...h.branches].some(F=>F.contains(P));!T||L||(a==null||a(_),o==null||o(_),_.defaultPrevented||c==null||c())},g),D=CI(_=>{const P=_.target;[...h.branches].some(F=>F.contains(P))||(i==null||i(_),o==null||o(_),_.defaultPrevented||c==null||c())},g);return bI(_=>{C===h.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&c&&(_.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Qv=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Xv(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Qv)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Xv())},[f,h]),b.useEffect(()=>{const _=()=>y({});return document.addEventListener(Lg,_),()=>document.removeEventListener(Lg,_)},[]),s.jsx(ut.div,{...u,ref:N,style:{pointerEvents:E?T?"auto":"none":void 0,...t.style},onFocusCapture:ot(t.onFocusCapture,D.onFocusCapture),onBlurCapture:ot(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:ot(t.onPointerDownCapture,R.onPointerDownCapture)})});Wx.displayName=vI;var jI="DismissableLayerBranch",kI=b.forwardRef((t,e)=>{const n=b.useContext(Nj),r=b.useRef(null),a=St(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(ut.div,{...t,ref:a})});kI.displayName=jI;function SI(t,e=globalThis==null?void 0:globalThis.document){const n=bi(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){wj(NI,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=u,e.addEventListener("click",a.current,{once:!0})):u()}else e.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function CI(t,e=globalThis==null?void 0:globalThis.document){const n=bi(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&wj(wI,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Xv(){const t=new CustomEvent(Lg);document.dispatchEvent(t)}function wj(t,e,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),r?yI(a,i):a.dispatchEvent(i)}var Rm="focusScope.autoFocusOnMount",Pm="focusScope.autoFocusOnUnmount",Zv={bubbles:!1,cancelable:!0},EI="FocusScope",Ux=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=bi(a),f=bi(i),m=b.useRef(null),g=St(e,w=>u(w)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let w=function(E){if(y.paused||!c)return;const T=E.target;c.contains(T)?m.current=T:Za(m.current,{select:!0})},v=function(E){if(y.paused||!c)return;const T=E.relatedTarget;T!==null&&(c.contains(T)||Za(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const R of E)R.removedNodes.length>0&&Za(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",v);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",v),C.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){t1.add(y);const w=document.activeElement;if(!c.contains(w)){const k=new CustomEvent(Rm,Zv);c.addEventListener(Rm,h),c.dispatchEvent(k),k.defaultPrevented||(TI(PI(jj(c)),{select:!0}),document.activeElement===w&&Za(c))}return()=>{c.removeEventListener(Rm,h),setTimeout(()=>{const k=new CustomEvent(Pm,Zv);c.addEventListener(Pm,f),c.dispatchEvent(k),k.defaultPrevented||Za(w??document.body,{select:!0}),c.removeEventListener(Pm,f),t1.remove(y)},0)}}},[c,h,f,y]);const N=b.useCallback(w=>{if(!n&&!r||y.paused)return;const v=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(v&&k){const C=w.currentTarget,[E,T]=MI(C);E&&T?!w.shiftKey&&k===T?(w.preventDefault(),n&&Za(E,{select:!0})):w.shiftKey&&k===E&&(w.preventDefault(),n&&Za(T,{select:!0})):k===C&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(ut.div,{tabIndex:-1,...o,ref:g,onKeyDown:N})});Ux.displayName=EI;function TI(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Za(r,{select:e}),document.activeElement!==n)return}function MI(t){const e=jj(t),n=e1(e,t),r=e1(e.reverse(),t);return[n,r]}function jj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function e1(t,e){for(const n of t)if(!AI(n,{upTo:e}))return n}function AI(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 II(t){return t instanceof HTMLInputElement&&"select"in t}function Za(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&II(t)&&e&&t.select()}}var t1=RI();function RI(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=n1(t,e),t.unshift(e)},remove(e){var n;t=n1(t,e),(n=t[0])==null||n.resume()}}}function n1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function PI(t){return t.filter(e=>e.tagName!=="A")}var OI="Portal",Kx=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);or(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?Pw.createPortal(s.jsx(ut.div,{...r,ref:e}),o):null});Kx.displayName=OI;function DI(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var md=t=>{const{present:e,children:n}=t,r=LI(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=St(r.ref,_I(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};md.displayName="Presence";function LI(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=DI(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=Tu(r.current);i.current=c==="mounted"?h:"none"},[c]),or(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,y=Tu(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),or(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const w=Tu(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(u("ANIMATION_END"),!a.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=y=>{y.target===e&&(i.current=Tu(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:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Tu(t){return(t==null?void 0:t.animationName)||"none"}function _I(t){var r,a;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=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Om=0;function kj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??r1()),document.body.insertAdjacentElement("beforeend",t[1]??r1()),Om++,()=>{Om===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Om--}},[])}function r1(){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 Vs=function(){return Vs=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return eR;var e=tR(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])}},rR=Tj(),yl="data-scroll-locked",sR=function(t,e,n,r){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` - .`.concat(FI,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(yl,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(a,`px; - padding-top: `).concat(i,`px; - padding-right: `).concat(o,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(Qu,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(Xu,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(Qu," .").concat(Qu,` { - right: 0 `).concat(r,`; - } - - .`).concat(Xu," .").concat(Xu,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(yl,`] { - `).concat($I,": ").concat(c,`px; - } -`)},a1=function(){var t=parseInt(document.body.getAttribute(yl)||"0",10);return isFinite(t)?t:0},aR=function(){b.useEffect(function(){return document.body.setAttribute(yl,(a1()+1).toString()),function(){var t=a1()-1;t<=0?document.body.removeAttribute(yl):document.body.setAttribute(yl,t.toString())}},[])},iR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;aR();var i=b.useMemo(function(){return nR(a)},[a]);return b.createElement(rR,{styles:sR(i,!e,a,n?"":"!important")})},_g=!1;if(typeof window<"u")try{var Mu=Object.defineProperty({},"passive",{get:function(){return _g=!0,!0}});window.addEventListener("test",Mu,Mu),window.removeEventListener("test",Mu,Mu)}catch{_g=!1}var rl=_g?{passive:!1}:!1,oR=function(t){return t.tagName==="TEXTAREA"},Mj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!oR(t)&&n[e]==="visible")},lR=function(t){return Mj(t,"overflowY")},cR=function(t){return Mj(t,"overflowX")},i1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Aj(t,r);if(a){var i=Ij(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},dR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},uR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Aj=function(t,e){return t==="v"?lR(e):cR(e)},Ij=function(t,e){return t==="v"?dR(e):uR(e)},hR=function(t,e){return t==="h"&&e==="rtl"?-1:1},fR=function(t,e,n,r,a){var i=hR(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=Ij(t,c),N=y[0],w=y[1],v=y[2],k=w-v-i*N;(N||k)&&Aj(t,c)&&(m+=k,g+=N);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},Au=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},o1=function(t){return[t.deltaX,t.deltaY]},l1=function(t){return t&&"current"in t?t.current:t},pR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},mR=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},gR=0,sl=[];function xR(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(gR++)[0],i=b.useState(Tj)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var w=zI([t.lockRef.current],(t.shards||[]).map(l1),!0).filter(Boolean);return w.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),w.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(w,v){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var k=Au(w),C=n.current,E="deltaX"in w?w.deltaX:C[0]-k[0],T="deltaY"in w?w.deltaY:C[1]-k[1],R,D=w.target,_=Math.abs(E)>Math.abs(T)?"h":"v";if("touches"in w&&_==="h"&&D.type==="range")return!1;var P=window.getSelection(),L=P&&P.anchorNode,F=L?L===D||L.contains(D):!1;if(F)return!1;var X=i1(_,D);if(!X)return!0;if(X?R=_:(R=_==="v"?"h":"v",X=i1(_,D)),!X)return!1;if(!r.current&&"changedTouches"in w&&(E||T)&&(r.current=R),!R)return!0;var te=r.current||R;return fR(te,v,w,te==="h"?E:T)},[]),u=b.useCallback(function(w){var v=w;if(!(!sl.length||sl[sl.length-1]!==i)){var k="deltaY"in v?o1(v):Au(v),C=e.current.filter(function(R){return R.name===v.type&&(R.target===v.target||v.target===R.shadowParent)&&pR(R.delta,k)})[0];if(C&&C.should){v.cancelable&&v.preventDefault();return}if(!C){var E=(o.current.shards||[]).map(l1).filter(Boolean).filter(function(R){return R.contains(v.target)}),T=E.length>0?c(v,E[0]):!o.current.noIsolation;T&&v.cancelable&&v.preventDefault()}}},[]),h=b.useCallback(function(w,v,k,C){var E={name:w,delta:v,target:k,should:C,shadowParent:yR(k)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(T){return T!==E})},1)},[]),f=b.useCallback(function(w){n.current=Au(w),r.current=void 0},[]),m=b.useCallback(function(w){h(w.type,o1(w),w.target,c(w,t.lockRef.current))},[]),g=b.useCallback(function(w){h(w.type,Au(w),w.target,c(w,t.lockRef.current))},[]);b.useEffect(function(){return sl.push(i),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(w){return w!==i}),document.removeEventListener("wheel",u,rl),document.removeEventListener("touchmove",u,rl),document.removeEventListener("touchstart",f,rl)}},[]);var y=t.removeScrollBar,N=t.inert;return b.createElement(b.Fragment,null,N?b.createElement(i,{styles:mR(a)}):null,y?b.createElement(iR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function yR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const bR=qI(Ej,xR);var qx=b.forwardRef(function(t,e){return b.createElement(mf,Vs({},t,{ref:e,sideCar:bR}))});qx.classNames=mf.classNames;var vR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},al=new WeakMap,Iu=new WeakMap,Ru={},zm=0,Rj=function(t){return t&&(t.host||Rj(t.parentNode))},NR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Rj(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})},wR=function(t,e,n,r){var a=NR(e,Array.isArray(t)?t:[t]);Ru[n]||(Ru[n]=new WeakMap);var i=Ru[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.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),N=y!==null&&y!=="false",w=(al.get(g)||0)+1,v=(i.get(g)||0)+1;al.set(g,w),i.set(g,v),o.push(g),w===1&&N&&Iu.set(g,!0),v===1&&g.setAttribute(n,"true"),N||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),zm++,function(){o.forEach(function(m){var g=al.get(m)-1,y=i.get(m)-1;al.set(m,g),i.set(m,y),g||(Iu.has(m)||m.removeAttribute(r),Iu.delete(m)),y||m.removeAttribute(n)}),zm--,zm||(al=new WeakMap,al=new WeakMap,Iu=new WeakMap,Ru={})}},Pj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=vR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),wR(r,a,n,"aria-hidden")):function(){return null}},gf="Dialog",[Oj]=Ei(gf),[jR,Ts]=Oj(gf),Dj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=go({prop:r,defaultProp:a??!1,onChange:i,caller:gf});return s.jsx(jR,{scope:e,triggerRef:c,contentRef:u,contentId:fi(),titleId:fi(),descriptionId:fi(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Dj.displayName=gf;var Lj="DialogTrigger",kR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ts(Lj,n),i=St(e,a.triggerRef);return s.jsx(ut.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Yx(a.open),...r,ref:i,onClick:ot(t.onClick,a.onOpenToggle)})});kR.displayName=Lj;var Gx="DialogPortal",[SR,_j]=Oj(Gx,{forceMount:void 0}),zj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=Ts(Gx,e);return s.jsx(SR,{scope:e,forceMount:n,children:b.Children.map(r,o=>s.jsx(md,{present:n||i.open,children:s.jsx(Kx,{asChild:!0,container:a,children:o})}))})};zj.displayName=Gx;var fh="DialogOverlay",Fj=b.forwardRef((t,e)=>{const n=_j(fh,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Ts(fh,t.__scopeDialog);return i.modal?s.jsx(md,{present:r||i.open,children:s.jsx(ER,{...a,ref:e})}):null});Fj.displayName=fh;var CR=Zc("DialogOverlay.RemoveScroll"),ER=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ts(fh,n);return s.jsx(qx,{as:CR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(ut.div,{"data-state":Yx(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),xo="DialogContent",$j=b.forwardRef((t,e)=>{const n=_j(xo,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Ts(xo,t.__scopeDialog);return s.jsx(md,{present:r||i.open,children:i.modal?s.jsx(TR,{...a,ref:e}):s.jsx(MR,{...a,ref:e})})});$j.displayName=xo;var TR=b.forwardRef((t,e)=>{const n=Ts(xo,t.__scopeDialog),r=b.useRef(null),a=St(e,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return Pj(i)},[]),s.jsx(Bj,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ot(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ot(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:ot(t.onFocusOutside,i=>i.preventDefault())})}),MR=b.forwardRef((t,e)=>{const n=Ts(xo,t.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return s.jsx(Bj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Bj=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=Ts(xo,n),u=b.useRef(null),h=St(e,u);return kj(),s.jsxs(s.Fragment,{children:[s.jsx(Ux,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(Wx,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Yx(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(AR,{titleId:c.titleId}),s.jsx(RR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Jx="DialogTitle",Vj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ts(Jx,n);return s.jsx(ut.h2,{id:a.titleId,...r,ref:e})});Vj.displayName=Jx;var Hj="DialogDescription",Wj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ts(Hj,n);return s.jsx(ut.p,{id:a.descriptionId,...r,ref:e})});Wj.displayName=Hj;var Uj="DialogClose",Kj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Ts(Uj,n);return s.jsx(ut.button,{type:"button",...r,ref:e,onClick:ot(t.onClick,()=>a.onOpenChange(!1))})});Kj.displayName=Uj;function Yx(t){return t?"open":"closed"}var qj="DialogTitleWarning",[qV,Gj]=aI(qj,{contentName:xo,titleName:Jx,docsSlug:"dialog"}),AR=({titleId:t})=>{const e=Gj(qj),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 b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},IR="DialogDescriptionWarning",RR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Gj(IR).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},PR=Dj,OR=zj,DR=Fj,LR=$j,_R=Vj,zR=Wj,FR=Kj;function Ot(t){return s.jsx(PR,{"data-slot":"dialog",...t})}function $R(t){return s.jsx(OR,{...t})}const Jj=b.forwardRef(({className:t,...e},n)=>s.jsx(DR,{ref:n,className:Ct("fixed inset-0 z-50 bg-black/50",t),...e}));Jj.displayName="DialogOverlay";const Mt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs($R,{children:[s.jsx(Jj,{}),s.jsxs(LR,{ref:a,"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(FR,{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(ir,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Mt.displayName="DialogContent";function Dt({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col gap-2 text-center sm:text-left",t),...e})}function on({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Lt(t){return s.jsx(_R,{className:"text-lg font-semibold leading-none",...t})}function xf(t){return s.jsx(zR,{className:"text-sm text-muted-foreground",...t})}const BR=lj("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 a=n?aj:"span";return s.jsx(a,{className:Ct(BR({variant:e}),t),...r})}var VR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],HR=VR.reduce((t,e)=>{const n=sj(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),WR="Label",Yj=b.forwardRef((t,e)=>s.jsx(HR.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Yj.displayName=WR;var Qj=Yj;const Y=b.forwardRef(({className:t,...e},n)=>s.jsx(Qj,{ref:n,className:Ct("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Y.displayName=Qj.displayName;function Qx(t){const e=t+"CollectionProvider",[n,r]=Ei(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:v,children:k}=w,C=br.useRef(null),E=br.useRef(new Map).current;return s.jsx(a,{scope:v,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Zc(c),h=br.forwardRef((w,v)=>{const{scope:k,children:C}=w,E=i(c,k),T=St(v,E.collectionRef);return s.jsx(u,{ref:T,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Zc(f),y=br.forwardRef((w,v)=>{const{scope:k,children:C,...E}=w,T=br.useRef(null),R=St(v,T),D=i(f,k);return br.useEffect(()=>(D.itemMap.set(T,{ref:T,...E}),()=>void D.itemMap.delete(T))),s.jsx(g,{[m]:"",ref:R,children:C})});y.displayName=f;function N(w){const v=i(t+"CollectionConsumer",w);return br.useCallback(()=>{const C=v.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((D,_)=>E.indexOf(D.ref.current)-E.indexOf(_.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},N,r]}var UR=b.createContext(void 0);function yf(t){const e=b.useContext(UR);return t||e||"ltr"}var Fm="rovingFocusGroup.onEntryFocus",KR={bubbles:!1,cancelable:!0},gd="RovingFocusGroup",[zg,Xj,qR]=Qx(gd),[GR,Zj]=Ei(gd,[qR]),[JR,YR]=GR(gd),ek=b.forwardRef((t,e)=>s.jsx(zg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(zg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(QR,{...t,ref:e})})}));ek.displayName=gd;var QR=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=St(e,g),N=yf(i),[w,v]=go({prop:o,defaultProp:c??null,onChange:u,caller:gd}),[k,C]=b.useState(!1),E=bi(h),T=Xj(n),R=b.useRef(!1),[D,_]=b.useState(0);return b.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Fm,E),()=>P.removeEventListener(Fm,E)},[E]),s.jsx(JR,{scope:n,orientation:r,dir:N,loop:a,currentTabStopId:w,onItemFocus:b.useCallback(P=>v(P),[v]),onItemShiftTab:b.useCallback(()=>C(!0),[]),onFocusableItemAdd:b.useCallback(()=>_(P=>P+1),[]),onFocusableItemRemove:b.useCallback(()=>_(P=>P-1),[]),children:s.jsx(ut.div,{tabIndex:k||D===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:ot(t.onMouseDown,()=>{R.current=!0}),onFocus:ot(t.onFocus,P=>{const L=!R.current;if(P.target===P.currentTarget&&L&&!k){const F=new CustomEvent(Fm,KR);if(P.currentTarget.dispatchEvent(F),!F.defaultPrevented){const X=T().filter(O=>O.focusable),te=X.find(O=>O.active),ue=X.find(O=>O.id===w),I=[te,ue,...X].filter(Boolean).map(O=>O.ref.current);rk(I,f)}}R.current=!1}),onBlur:ot(t.onBlur,()=>C(!1))})})}),tk="RovingFocusGroupItem",nk=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=fi(),h=i||u,f=YR(tk,n),m=f.currentTabStopId===h,g=Xj(n),{onFocusableItemAdd:y,onFocusableItemRemove:N,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return y(),()=>N()},[r,y,N]),s.jsx(zg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(ut.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:ot(t.onMouseDown,v=>{r?f.onItemFocus(h):v.preventDefault()}),onFocus:ot(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:ot(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=eP(v,f.orientation,f.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.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(v.currentTarget);E=f.loop?tP(E,T+1):E.slice(T+1)}setTimeout(()=>rk(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});nk.displayName=tk;var XR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ZR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function eP(t,e,n){const r=ZR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return XR[r]}function rk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function tP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var nP=ek,rP=nk,bf="Tabs",[sP]=Ei(bf,[Zj]),sk=Zj(),[aP,Xx]=sP(bf),ak=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=yf(c),[m,g]=go({prop:r,onChange:a,defaultProp:i??"",caller:bf});return s.jsx(aP,{scope:n,baseId:fi(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(ut.div,{dir:f,"data-orientation":o,...h,ref:e})})});ak.displayName=bf;var ik="TabsList",ok=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=Xx(ik,n),o=sk(n);return s.jsx(nP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(ut.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});ok.displayName=ik;var lk="TabsTrigger",ck=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=Xx(lk,n),c=sk(n),u=hk(o.baseId,r),h=fk(o.baseId,r),f=r===o.value;return s.jsx(rP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(ut.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:ot(t.onMouseDown,m=>{!a&&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&&!a&&m&&o.onValueChange(r)})})})});ck.displayName=lk;var dk="TabsContent",uk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=Xx(dk,n),u=hk(c.baseId,r),h=fk(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(md,{present:a||f,children:({present:g})=>s.jsx(ut.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&&i})})});uk.displayName=dk;function hk(t,e){return`${t}-trigger-${e}`}function fk(t,e){return`${t}-content-${e}`}var iP=ak,pk=ok,mk=ck,gk=uk;const xd=iP,Ll=b.forwardRef(({className:t,...e},n)=>s.jsx(pk,{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=pk.displayName;const Zt=b.forwardRef(({className:t,...e},n)=>s.jsx(mk,{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}));Zt.displayName=mk.displayName;const en=b.forwardRef(({className:t,...e},n)=>s.jsx(gk,{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}));en.displayName=gk.displayName;function Zx(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function e0(t){const[e,n]=b.useState(void 0);return or(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,c;if("borderBoxSize"in i){const u=i.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 vf="Switch",[oP]=Ei(vf),[lP,cP]=oP(vf),xk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),N=St(e,E=>y(E)),w=b.useRef(!1),v=g?f||!!g.closest("form"):!0,[k,C]=go({prop:a,defaultProp:i??!1,onChange:h,caller:vf});return s.jsxs(lP,{scope:n,checked:k,disabled:c,children:[s.jsx(ut.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":Nk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:ot(t.onClick,E=>{C(T=>!T),v&&(w.current=E.isPropagationStopped(),w.current||E.stopPropagation())})}),v&&s.jsx(vk,{control:g,bubbles:!w.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});xk.displayName=vf;var yk="SwitchThumb",bk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=cP(yk,n);return s.jsx(ut.span,{"data-state":Nk(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});bk.displayName=yk;var dP="SwitchBubbleInput",vk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=St(o,i),u=Zx(n),h=e0(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const N=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(N)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});vk.displayName=dP;function Nk(t){return t?"checked":"unchecked"}var wk=xk,uP=bk;const At=b.forwardRef(({className:t,...e},n)=>s.jsx(wk,{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(uP,{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")})}));At.displayName=wk.displayName;function t0({open:t,onClose:e,userId:n,onUserUpdated:r}){var Is;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(null),[g,y]=b.useState(!1),[N,w]=b.useState(!1),[v,k]=b.useState(!1),[C,E]=b.useState("info"),[T,R]=b.useState(""),[D,_]=b.useState(""),[P,L]=b.useState([]),[F,X]=b.useState(""),[te,ue]=b.useState(""),[ae,I]=b.useState(""),[O,G]=b.useState(!1),[z,re]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[K,$]=b.useState([]),[H,oe]=b.useState(!1),[q,me]=b.useState(""),[Z,ce]=b.useState(""),[he,ve]=b.useState(!1),[Ae,Be]=b.useState(!1),[$e,pt]=b.useState(null),[Et,ln]=b.useState(null),[yt,nn]=b.useState(""),[An,Tt]=b.useState(""),[Yt,rn]=b.useState(""),[In,pr]=b.useState(!1),[Rn,Hn]=b.useState(null),[W,He]=b.useState("");b.useEffect(()=>{t&&n&&(E("info"),pt(null),ln(null),Hn(null),He(""),ue(""),I(""),qe(),Oe("/api/db/vip-roles").then(fe=>{fe!=null&&fe.success&&fe.data&&$(fe.data)}).catch(()=>{}))},[t,n]);async function qe(){if(n){y(!0);try{const fe=await Oe(`/api/db/users?id=${encodeURIComponent(n)}`);if(fe!=null&&fe.success&&fe.user){const ge=fe.user;i(ge),R(ge.phone||""),_(ge.nickname||""),nn(ge.phone||""),Tt(ge.wechatId||""),rn(ge.openId||"");try{L(typeof ge.tags=="string"?JSON.parse(ge.tags||"[]"):[])}catch{L([])}re({isVip:!!(ge.isVip??!1),vipExpireDate:ge.vipExpireDate?String(ge.vipExpireDate).slice(0,10):"",vipRole:String(ge.vipRole??""),vipName:String(ge.vipName??""),vipProject:String(ge.vipProject??""),vipContact:String(ge.vipContact??""),vipBio:String(ge.vipBio??"")})}try{const ge=await Oe(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=50`);ge!=null&&ge.success&&ge.tracks&&c(ge.tracks)}catch{c([])}try{const ge=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ge!=null&&ge.success&&ge.referrals&&h(ge.referrals)}catch{h([])}try{const ge=await Oe(`/api/admin/users/${encodeURIComponent(n)}/balance`);ge!=null&&ge.success&&ge.data?m(ge.data):m(null)}catch{m(null)}}catch(fe){console.error("Load user detail error:",fe)}finally{y(!1)}}}async function xt(){if(!(a!=null&&a.phone)){ie.info("用户未绑定手机号,无法同步");return}w(!0);try{const fe=await wt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});fe!=null&&fe.success?(ie.success("同步成功"),qe()):ie.error("同步失败: "+(fe==null?void 0:fe.error))}catch(fe){console.error("Sync CKB error:",fe),ie.error("同步失败")}finally{w(!1)}}async function lt(){if(a){if(z.isVip&&!z.vipExpireDate.trim()){ie.error("开启 VIP 请填写有效到期日");return}k(!0);try{const fe={id:a.id,phone:T||void 0,nickname:D||void 0,tags:JSON.stringify(P),isVip:z.isVip,vipExpireDate:z.isVip?z.vipExpireDate:void 0,vipRole:z.vipRole||void 0,vipName:z.vipName||void 0,vipProject:z.vipProject||void 0,vipContact:z.vipContact||void 0,vipBio:z.vipBio||void 0},ge=await _t("/api/db/users",fe);ge!=null&&ge.success?(ie.success("保存成功"),qe(),r==null||r()):ie.error("保存失败: "+(ge==null?void 0:ge.error))}catch(fe){console.error("Save user error:",fe),ie.error("保存失败")}finally{k(!1)}}}const nt=()=>{F&&!P.includes(F)&&(L([...P,F]),X(""))},gt=fe=>L(P.filter(ge=>ge!==fe));async function It(){if(a){if(!te){ie.error("请输入新密码");return}if(te!==ae){ie.error("两次密码不一致");return}if(te.length<6){ie.error("密码至少 6 位");return}G(!0);try{const fe=await _t("/api/db/users",{id:a.id,password:te});fe!=null&&fe.success?(ie.success("修改成功"),ue(""),I("")):ie.error("修改失败: "+((fe==null?void 0:fe.error)||""))}catch{ie.error("修改失败")}finally{G(!1)}}}async function gn(){if(!a)return;const fe=parseFloat(q);if(Number.isNaN(fe)||fe===0){ie.error("请输入有效金额(正数增加、负数扣减)");return}ve(!0);try{const ge=await wt(`/api/admin/users/${a.id}/balance/adjust`,{amount:fe,remark:Z||void 0});ge!=null&&ge.success?(ie.success("余额已调整"),oe(!1),me(""),ce(""),qe(),r==null||r()):ie.error("调整失败: "+((ge==null?void 0:ge.error)||""))}catch{ie.error("调整失败")}finally{ve(!1)}}async function mr(){if(!yt&&!Yt&&!An){ln("请至少输入手机号、微信号或 OpenID 中的一项");return}Be(!0),ln(null),pt(null);try{const fe=new URLSearchParams;yt&&fe.set("phone",yt),Yt&&fe.set("openId",Yt),An&&fe.set("wechatId",An);const ge=await Oe(`/api/admin/shensheshou/query?${fe}`);ge!=null&&ge.success&&ge.data?(pt(ge.data),a&&await wr(ge.data)):ln((ge==null?void 0:ge.error)||"未查询到数据,该用户可能未在神射手收录")}catch(fe){console.error("SSS query error:",fe),ln("请求失败,请检查神射手接口配置")}finally{Be(!1)}}async function wr(fe){if(a)try{await wt("/api/admin/shensheshou/enrich",{userId:a.id,phone:yt||a.phone||"",openId:Yt||a.openId||"",wechatId:An||a.wechatId||""}),qe()}catch(ge){console.error("SSS enrich error:",ge)}}async function As(){if(a){pr(!0),Hn(null);try{const fe={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:P}]},ge=await wt("/api/admin/shensheshou/ingest",fe);ge!=null&&ge.success&&ge.data?Hn(ge.data):Hn({error:(ge==null?void 0:ge.error)||"推送失败"})}catch(fe){console.error("SSS ingest error:",fe),Hn({error:"请求失败"})}finally{pr(!1)}}}const Wr=fe=>{const Rt={view_chapter:Br,purchase:Rg,match:Zn,login:lo,register:lo,share:Ss,bind_phone:mA,bind_wechat:sA,fill_profile:_c,visit_page:pl}[fe]||Tg;return s.jsx(Rt,{className:"w-4 h-4"})};return t?s.jsxs(s.Fragment,{children:[s.jsx(Ot,{open:t,onOpenChange:()=>e(),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(lo,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?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:a.avatar?s.jsx("img",{src:a.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Is=a.nickname)==null?void 0:Is.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:a.nickname}),a.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),a.hasFullBook&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),a.vipRole&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:a.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[a.phone?`📱 ${a.phone}`:"未绑定手机",a.wechatId&&` · 💬 ${a.wechatId}`,a.mbti&&` · ${a.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",a.id.slice(0,16),"…"]}),a.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:a.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(a.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(xd,{value:C,onValueChange:E,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(Zt,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),s.jsx(Zt,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),s.jsxs(Zt,{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(Zt,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),s.jsxs(Zt,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(li,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),s.jsxs(en,{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(Y,{className:"text-gray-300",children:"手机号"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:T,onChange:fe=>R(fe.target.value),disabled:!!(a!=null&&a.phone)}),(a==null?void 0:a.phone)&&s.jsx("p",{className:"text-xs text-gray-500",children:"编辑时手机号不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"昵称"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:D,onChange:fe=>_(fe.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.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:a.openId})]}),a.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(ej,{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:a.region})]})]}),a.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:a.industry})]}),a.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:a.position})]})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 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:a.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:["¥",(a.pendingEarnings??0).toFixed(2)]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg flex flex-col 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]",children:["¥",((f==null?void 0:f.balance)??0).toFixed(2)]})]}),s.jsx(ee,{size:"sm",variant:"outline",className:"mt-2 border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 text-xs",onClick:()=>{me(""),ce(""),oe(!0)},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-sm text-white",children:a.createdAt?new Date(a.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(Zw,{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(ne,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:te,onChange:fe=>ue(fe.target.value)}),s.jsx(ne,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:ae,onChange:fe=>I(fe.target.value)}),s.jsx(ee,{size:"sm",onClick:It,disabled:O||!te||!ae,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:O?"保存中...":"确认修改"})]})]}),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(Y,{className:"text-gray-400 text-sm",children:"VIP 会员"}),s.jsx(At,{checked:z.isVip,onCheckedChange:fe=>re(ge=>({...ge,isVip:fe}))})]}),z.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(ne,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:z.vipExpireDate,onChange:fe=>re(ge=>({...ge,vipExpireDate:fe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{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:z.vipRole,onChange:fe=>re(ge=>({...ge,vipRole:fe.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),K.map(fe=>s.jsx("option",{value:fe.name,children:fe.name},fe.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:z.vipName,onChange:fe=>re(ge=>({...ge,vipName:fe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"项目"}),s.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"如:某某科技",value:z.vipProject,onChange:fe=>re(ge=>({...ge,vipProject:fe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"联系方式"}),s.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"微信/手机等",value:z.vipContact,onChange:fe=>re(ge=>({...ge,vipContact:fe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"简介"}),s.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"简短介绍",value:z.vipBio,onChange:fe=>re(ge=>({...ge,vipBio:fe.target.value}))})]})]})]})]}),a.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:a.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:a.vipName})]}),a.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:a.vipProject})]}),a.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:a.vipContact})]}),a.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(a.vipExpireDate).toLocaleDateString()})]})]}),a.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:a.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(yi,{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(ne,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:W,onChange:fe=>He(fe.target.value)}),s.jsxs(ee,{size:"sm",onClick:async()=>{if(!(!W||!a))try{await _t("/api/db/users",{id:a.id,wechatId:W}),ie.success("已保存微信归属"),qe()}catch{ie.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[s.jsx(bn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),a.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:a.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(Ss,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(ee,{size:"sm",onClick:xt,disabled:N||!a.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:N?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ke,{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:"同步状态:"}),a.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:a.ckbSyncedAt?new Date(a.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),s.jsxs(en,{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(_c,{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(Eg,{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(fe=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:fe.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:fe.tags.map(ge=>s.jsxs("button",{type:"button",onClick:()=>{P.includes(ge)?gt(ge):L([...P,ge])},className:`px-2 py-0.5 rounded text-xs border transition-all ${P.includes(ge)?"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:[P.includes(ge)?"✓ ":"",ge]},ge))})]},fe.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:[P.map((fe,ge)=>s.jsxs(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[fe,s.jsx("button",{type:"button",onClick:()=>gt(fe),className:"ml-1 hover:text-red-400",children:s.jsx(ir,{className:"w-3 h-3"})})]},ge)),P.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:F,onChange:fe=>X(fe.target.value),onKeyDown:fe=>fe.key==="Enter"&&nt()}),s.jsx(ee,{onClick:nt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),(()=>{const fe=a.tags||a.ckbTags||"";let ge=[];try{const Pn=typeof fe=="string"?JSON.parse(fe||"[]"):[];ge=Array.isArray(Pn)?Pn:typeof fe=="string"?fe.split(","):[]}catch{ge=typeof fe=="string"?fe.split(","):[]}const Rt=ge.map(Pn=>String(Pn).trim()).filter(Boolean);return Rt.length===0?null: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(_c,{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:Rt.map((Pn,Qs)=>s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:Pn},Qs))})]})})()]}),s.jsxs(en,{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((fe,ge)=>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:Wr(fe.action)}),ge0?u.map((fe,ge)=>{var Pn;const Rt=fe;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:((Pn=Rt.nickname)==null?void 0:Pn.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:Rt.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Rt.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:Rt.createdAt?new Date(Rt.createdAt).toLocaleDateString():""})]})]},Rt.id||ge)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),s.jsxs(en,{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(li,{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(Y,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),s.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:yt,onChange:fe=>nn(fe.target.value)})]}),s.jsxs("div",{children:[s.jsx(Y,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:An,onChange:fe=>Tt(fe.target.value)})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx(Y,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),s.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:Yt,onChange:fe=>rn(fe.target.value)})]})]}),s.jsx(ee,{onClick:mr,disabled:Ae,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:Ae?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Na,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),Et&&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:Et}),$e&&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:$e.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:$e.user_level??"-"})]})]}),$e.tags&&$e.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:$e.tags.map((fe,ge)=>s.jsx(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:fe},ge))})]}),$e.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",$e.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(li,{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(ee,{onClick:As,disabled:In||!a.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:In?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(li,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!a.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),Rn&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:Rn.error?s.jsx("p",{className:"text-red-400",children:String(Rn.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(Eg,{className:"w-4 h-4"})," 推送成功"]}),Rn.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(Rn.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(ee,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ir,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(ee,{onClick:lt,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Ot,{open:H,onOpenChange:oe,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsx(Lt,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(Y,{className:"text-gray-300 text-sm",children:"调整金额(元)"}),s.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"正数增加,负数扣减,如 10 或 -5",value:q,onChange:fe=>me(fe.target.value)})]}),s.jsxs("div",{children:[s.jsx(Y,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:Z,onChange:fe=>ce(fe.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ee,{variant:"outline",onClick:()=>oe(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(ee,{onClick:gn,disabled:he,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:he?"提交中...":"确认调整"})]})]})})]}):null}function hP(){const t=Ci(),[e,n]=b.useState(!0),[r,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,g]=b.useState(0),[y,N]=b.useState(0),[w,v]=b.useState(0),[k,C]=b.useState(0),[E,T]=b.useState(null),[R,D]=b.useState(null),[_,P]=b.useState(!1),L=ae=>{const I=ae;if((I==null?void 0:I.status)===401)T("登录已过期,请重新登录");else{if((I==null?void 0:I.name)==="AbortError")return;T("加载失败,请检查网络或联系管理员")}};async function F(ae){const I=ae?{signal:ae}:void 0;n(!0),T(null);try{const z=await Oe("/api/admin/dashboard/stats",I);z!=null&&z.success&&(g(z.totalUsers??0),N(z.paidOrderCount??0),v(z.totalRevenue??0),C(z.conversionRate??0))}catch(z){if((z==null?void 0:z.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",z);try{const re=await Oe("/api/admin/dashboard/overview",I);re!=null&&re.success&&(g(re.totalUsers??0),N(re.paidOrderCount??0),v(re.totalRevenue??0),C(re.conversionRate??0))}catch(re){L(re)}}}finally{n(!1)}a(!0),o(!0);const O=async()=>{try{const z=await Oe("/api/admin/dashboard/recent-orders",I);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 re=await Oe("/api/admin/orders?page=1&pageSize=20&status=paid",I),$=((re==null?void 0:re.orders)??[]).filter(H=>["paid","completed","success"].includes(H.status||""));f($.slice(0,5))}catch{f([])}}finally{a(!1)}},G=async()=>{try{const z=await Oe("/api/admin/dashboard/new-users",I);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 re=await Oe("/api/db/users?page=1&pageSize=10",I);u((re==null?void 0:re.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([O(),G()])}b.useEffect(()=>{const ae=new AbortController;F(ae.signal);const I=setInterval(()=>F(),3e4);return()=>{ae.abort(),clearInterval(I)}},[]);const X=m,te=ae=>{const I=ae.productType||"",O=ae.description||"";if(I==="balance_recharge")return{title:`余额充值 ¥${typeof ae.amount=="number"?ae.amount.toFixed(2):parseFloat(String(ae.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(O){if(I==="section"&&O.includes("章节")){if(O.includes("-")){const G=O.split("-");if(G.length>=3)return{title:`第${G[1]}章 第${G[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:O,subtitle:"章节购买"}}return I==="fullbook"||O.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:I==="vip"||O.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:I==="match"||O.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:O,subtitle:I==="section"?"单章":I==="fullbook"?"全书":"其他"}}return I==="section"?{title:`章节 ${ae.productId||""}`,subtitle:"单章购买"}:I==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:I==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:I==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:I||"其他"}},ue=[{title:"总用户数",value:e?null:X,icon:Zn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,icon:zc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,icon:Rg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,icon:Br,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:()=>F(),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:ue.map((ae,I)=>s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>ae.link&&t(ae.link),children:[s.jsxs(Je,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(Ye,{className:"text-sm font-medium text-gray-400",children:ae.title}),s.jsx("div",{className:`p-2 rounded-lg ${ae.bg}`,children:s.jsx(ae.icon,{className:`w-4 h-4 ${ae.color}`})})]}),s.jsx(Ee,{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:ae.value!=null?ae.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Ke,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),s.jsx(fl,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},I))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{className:"flex flex-row items-center justify-between",children:[s.jsx(Ye,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>F(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(Ke,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Ke,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),s.jsx(Ee,{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(Ke,{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(ae=>{var re;const I=ae.referrerId?c.find(K=>K.id===ae.referrerId):void 0,O=ae.referralCode||(I==null?void 0:I.referralCode)||(I==null?void 0:I.nickname)||(ae.referrerId?String(ae.referrerId).slice(0,8):""),G=te(ae),z=ae.userNickname||((re=c.find(K=>K.id===ae.userId))==null?void 0:re.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:[ae.userAvatar?s.jsx("img",{src:ae.userAvatar,alt:z,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:K=>{K.currentTarget.style.display="none";const $=K.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 ${ae.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:()=>{ae.userId&&(D(ae.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:G.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[G.subtitle&&G.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:G.subtitle}),s.jsx("span",{children:new Date(ae.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),O&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",O]})]})]}),s.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(ae.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:ae.paymentMethod||"微信"})]})]},ae.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Rg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Je,{children:s.jsx(Ye,{className:"text-white",children:"新注册用户"})}),s.jsx(Ee,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ke,{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(ae=>{var I;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:((I=ae.nickname)==null?void 0:I.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{D(ae.id),P(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:ae.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:ae.phone||"-"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:ae.createdAt?new Date(ae.createdAt).toLocaleDateString():"-"})]},ae.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsx(t0,{open:_,onClose:()=>{P(!1),D(null)},userId:R,onUserUpdated:()=>F()})]})}const lr=b.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})}));lr.displayName="Table";const cr=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Ct("[&_tr]:border-b",t),...e}));cr.displayName="TableHeader";const dr=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Ct("[&_tr:last-child]:border-0",t),...e}));dr.displayName="TableBody";const it=b.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=b.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 ye=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Ct("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ye.displayName="TableCell";function n0(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function is({page:t,totalPages:e,total:n,pageSize:r,onPageChange:a,onPageSizeChange:i,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!i?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," 条"]}),i&&s.jsx("select",{value:r,onChange:c=>i(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:()=>a(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:()=>a(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:()=>a(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:()=>a(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 fP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[N,w]=b.useState(""),v=n0(N,300),[k,C]=b.useState("all"),[E,T]=b.useState(!0),[R,D]=b.useState(null),[_,P]=b.useState(null),[L,F]=b.useState(""),[X,te]=b.useState(!1);async function ue(){T(!0),D(null);try{const K=k==="all"?"":k==="completed"?"completed":k,$=new URLSearchParams({page:String(f),pageSize:String(g),...K&&{status:K},...v&&{search:v}}),[H,oe]=await Promise.all([Oe(`/api/admin/orders?${$}`),Oe("/api/db/users?page=1&pageSize=500")]);H!=null&&H.success&&(e(H.orders||[]),i(H.total??0),c(H.totalRevenue??0),h(H.todayRevenue??0)),oe!=null&&oe.success&&oe.users&&r(oe.users)}catch(K){console.error("加载订单失败",K),D("加载订单失败,请检查网络后重试")}finally{T(!1)}}b.useEffect(()=>{m(1)},[v,k]),b.useEffect(()=>{ue()},[f,g,v,k]);const ae=K=>{var $;return K.userNickname||(($=n.find(H=>H.id===K.userId))==null?void 0:$.nickname)||"匿名用户"},I=K=>{var $;return(($=n.find(H=>H.id===K))==null?void 0:$.phone)||"-"},O=K=>{const $=K.productType||K.type||"",H=K.description||"";if($==="balance_recharge")return{name:`余额充值 ¥${Number(K.amount||0).toFixed(2)}`,type:"余额充值"};if(H){if($==="section"&&H.includes("章节")){if(H.includes("-")){const oe=H.split("-");if(oe.length>=3)return{name:`第${oe[1]}章 第${oe[2]}节`,type:"《一场Soul的创业实验》"}}return{name:H,type:"章节购买"}}return $==="fullbook"||H.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:$==="vip"||H.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:$==="match"||H.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:H,type:"其他"}}return $==="section"?{name:`章节 ${K.productId||K.sectionId||""}`,type:"单章"}:$==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:$==="vip"?{name:"超级个体开通费用",type:"超级个体"}:$==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:$||"其他"}},G=Math.ceil(a/g)||1;async function z(){var K;if(!(!(_!=null&&_.orderSn)&&!(_!=null&&_.id))){te(!0),D(null);try{const $=await _t("/api/admin/orders/refund",{orderSn:_.orderSn||_.id,reason:L||void 0});$!=null&&$.success?(P(null),F(""),ue()):D(($==null?void 0:$.error)||"退款失败")}catch($){const H=$;D(((K=H==null?void 0:H.data)==null?void 0:K.error)||"退款失败,请检查网络后重试")}finally{te(!1)}}}function re(){if(t.length===0){ie.info("暂无数据可导出");return}const K=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],$=t.map(Z=>{const ce=O(Z);return[Z.orderSn||Z.id||"",ae(Z),I(Z.userId),ce.name,Number(Z.amount||0).toFixed(2),Z.paymentMethod==="wechat"?"微信支付":Z.paymentMethod==="balance"?"余额支付":Z.paymentMethod==="alipay"?"支付宝":Z.paymentMethod||"微信支付",Z.status==="refunded"?"已退款":Z.status==="paid"||Z.status==="completed"?"已完成":Z.status==="pending"||Z.status==="created"?"待支付":"已失败",Z.status==="refunded"&&Z.refundReason?Z.refundReason:"-",Z.referrerEarnings?Number(Z.referrerEarnings).toFixed(2):"-",Z.createdAt?new Date(Z.createdAt).toLocaleString("zh-CN"):""].join(",")}),H="\uFEFF"+[K.join(","),...$].join(` -`),oe=new Blob([H],{type:"text/csv;charset=utf-8"}),q=URL.createObjectURL(oe),me=document.createElement("a");me.href=q,me.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,me.click(),URL.revokeObjectURL(q)}return s.jsxs("div",{className:"p-8 w-full",children:[R&&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:R}),s.jsx("button",{type:"button",onClick:()=>D(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(ee,{variant:"outline",onClick:ue,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{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(Na,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ne,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:N,onChange:K=>w(K.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Yw,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:K=>C(K.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(ee,{variant:"outline",onClick:re,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(pM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ee,{className:"p-0",children:E?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ke,{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(lr,{children:[s.jsx(cr,{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(dr,{children:[t.map(K=>{const $=O(K);return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(ye,{className:"font-mono text-xs text-gray-400",children:[(K.orderSn||K.id||"").slice(0,12),"..."]}),s.jsx(ye,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[ae(K),K.payerUserId&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:I(K.userId)}),K.payerUserId&&K.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:["代付人:",K.payerNickname]})]})}),s.jsx(ye,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[$.name,(K.productType||K.type)==="vip"&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:$.type})]})}),s.jsxs(ye,{className:"text-[#38bdac] font-bold",children:["¥",Number(K.amount||0).toFixed(2)]}),s.jsx(ye,{className:"text-gray-300",children:K.paymentMethod==="wechat"?"微信支付":K.paymentMethod==="balance"?"余额支付":K.paymentMethod==="alipay"?"支付宝":K.paymentMethod||"微信支付"}),s.jsx(ye,{children:K.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):K.status==="paid"||K.status==="completed"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):K.status==="pending"||K.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(ye,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:K.refundReason,children:K.status==="refunded"&&K.refundReason?K.refundReason:"-"}),s.jsx(ye,{className:"text-[#FFD700]",children:K.referrerEarnings?`¥${Number(K.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(ye,{className:"text-gray-400 text-sm",children:new Date(K.createdAt).toLocaleString("zh-CN")}),s.jsx(ye,{children:(K.status==="paid"||K.status==="completed")&&K.paymentMethod!=="balance"&&s.jsxs(ee,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{P(K),F("")},children:[s.jsx(nj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},K.id)}),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(is,{page:f,totalPages:G,total:a,pageSize:g,onPageChange:m,onPageSizeChange:K=>{y(K),m(1)}})]})})}),s.jsx(Ot,{open:!!_,onOpenChange:K=>!K&&P(null),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Dt,{children:s.jsx(Lt,{className:"text-white",children:"订单退款"})}),_&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",_.orderSn||_.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(_.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(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:L,onChange:K=>F(K.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>P(null),disabled:X,children:"取消"}),s.jsx(ee,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:z,disabled:X,children:X?"退款中...":"确认退款"})]})]})})]})}const _l=b.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 Pu=[{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 pP(){var fs,Di,Ps,Li,Pa;const[t,e]=Hw(),n=t.get("pool"),[r,a]=b.useState([]),[i,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=n0(m,300),N=n==="vip"?"vip":n==="complete"?"complete":"all",[w,v]=b.useState(N),[k,C]=b.useState(!0),[E,T]=b.useState(!1),[R,D]=b.useState(null),[_,P]=b.useState(!1),[L,F]=b.useState("desc");b.useEffect(()=>{n==="vip"?v("vip"):n==="complete"?v("complete"):n==="all"&&v("all")},[n]);const[X,te]=b.useState(!1),[ue,ae]=b.useState(null),[I,O]=b.useState(!1),[G,z]=b.useState(!1),[re,K]=b.useState({referrals:[],stats:{}}),[$,H]=b.useState(!1),[oe,q]=b.useState(null),[me,Z]=b.useState(!1),[ce,he]=b.useState(null),[ve,Ae]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Be,$e]=b.useState([]),[pt,Et]=b.useState(!1),[ln,yt]=b.useState(!1),[nn,An]=b.useState(null),[Tt,Yt]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[rn,In]=b.useState([]),[pr,Rn]=b.useState(!1),[Hn,W]=b.useState(null),[He,qe]=b.useState(null),[xt,lt]=b.useState({}),[nt,gt]=b.useState(!1);async function It(V=!1){var Re;C(!0),V&&T(!0),D(null);try{if(_){const et=new URLSearchParams({search:y,limit:String(h*5)}),tt=await Oe(`/api/db/users/rfm?${et}`);if(tt!=null&&tt.success){let Dn=tt.users||[];L==="asc"&&(Dn=[...Dn].reverse());const gr=(c-1)*h;a(Dn.slice(gr,gr+h)),o(((Re=tt.users)==null?void 0:Re.length)??0),Dn.length===0&&(P(!1),D("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else P(!1),D((tt==null?void 0:tt.error)||"RFM 加载失败,已切回普通模式")}else{const et=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...w==="vip"&&{vip:"true"},...w==="complete"&&{pool:"complete"}}),tt=await Oe(`/api/db/users?${et}`);tt!=null&&tt.success?(a(tt.users||[]),o(tt.total??0)):D((tt==null?void 0:tt.error)||"加载失败")}}catch(et){console.error("Load users error:",et),D("网络错误")}finally{C(!1),V&&T(!1)}}b.useEffect(()=>{u(1)},[y,w,_]),b.useEffect(()=>{It()},[c,h,y,w,_,L]);const gn=Math.ceil(i/h)||1,mr=()=>{_?L==="desc"?F("asc"):(P(!1),F("desc")):(P(!0),F("desc"))},wr=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 As(V){if(confirm("确定要删除这个用户吗?"))try{const Re=await Bs(`/api/db/users?id=${encodeURIComponent(V)}`);Re!=null&&Re.success?It():ie.error("删除失败: "+((Re==null?void 0:Re.error)||""))}catch{ie.error("删除失败")}}const Wr=V=>{ae(V),Ae({phone:V.phone||"",nickname:V.nickname||"",password:"",isAdmin:!!(V.isAdmin??!1),hasFullBook:!!(V.hasFullBook??!1)}),te(!0)},Is=()=>{ae(null),Ae({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),te(!0)};async function fe(){if(!ve.phone||!ve.nickname){ie.error("请填写手机号和昵称");return}O(!0);try{if(ue){const V=await _t("/api/db/users",{id:ue.id,phone:ve.phone||void 0,nickname:ve.nickname,isAdmin:ve.isAdmin,hasFullBook:ve.hasFullBook,...ve.password&&{password:ve.password}});if(!(V!=null&&V.success)){ie.error("更新失败: "+((V==null?void 0:V.error)||""));return}}else{const V=await wt("/api/db/users",{phone:ve.phone,nickname:ve.nickname,password:ve.password,isAdmin:ve.isAdmin});if(!(V!=null&&V.success)){ie.error("创建失败: "+((V==null?void 0:V.error)||""));return}}te(!1),It()}catch{ie.error("保存失败")}finally{O(!1)}}async function ge(V){q(V),z(!0),H(!0);try{const Re=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(V.id)}`);Re!=null&&Re.success?K({referrals:Re.referrals||[],stats:Re.stats||{}}):K({referrals:[],stats:{}})}catch{K({referrals:[],stats:{}})}finally{H(!1)}}const Rt=b.useCallback(async()=>{Et(!0);try{const V=await Oe("/api/db/user-rules");V!=null&&V.success&&$e(V.rules||[])}catch{}finally{Et(!1)}},[]);async function Pn(){if(!Tt.title){ie.error("请填写规则标题");return}O(!0);try{if(nn){const V=await _t("/api/db/user-rules",{id:nn.id,...Tt});if(!(V!=null&&V.success)){ie.error("更新失败: "+((V==null?void 0:V.error)||""));return}}else{const V=await wt("/api/db/user-rules",Tt);if(!(V!=null&&V.success)){ie.error("创建失败: "+((V==null?void 0:V.error)||""));return}}yt(!1),Rt()}catch{ie.error("保存失败")}finally{O(!1)}}async function Qs(V){if(confirm("确定删除?"))try{const Re=await Bs(`/api/db/user-rules?id=${V}`);Re!=null&&Re.success&&Rt()}catch{}}async function Xs(V){try{await _t("/api/db/user-rules",{id:V.id,enabled:!V.enabled}),Rt()}catch{}}const Wn=b.useCallback(async()=>{Rn(!0);try{const V=await Oe("/api/db/vip-members?limit=500");if(V!=null&&V.success&&V.data){const Re=[...V.data].map((et,tt)=>({...et,vipSort:typeof et.vipSort=="number"?et.vipSort:tt+1}));Re.sort((et,tt)=>(et.vipSort??999999)-(tt.vipSort??999999)),In(Re)}else V&&V.error&&ie.error(V.error)}catch{ie.error("加载超级个体列表失败")}finally{Rn(!1)}},[]),[Zs,ht]=b.useState(!1),[xn,Ur]=b.useState(null),[Ir,ds]=b.useState(""),[On,us]=b.useState(!1),hs=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],Rs=V=>{Ur(V),ds(V.vipRole||""),ht(!0)},Ma=async V=>{const Re=V.trim();if(xn){if(!Re){ie.error("请选择或输入标签");return}us(!0);try{const et=await _t("/api/db/users",{id:xn.id,vipRole:Re});if(!(et!=null&&et.success)){ie.error((et==null?void 0:et.error)||"更新超级个体标签失败");return}ie.success("已更新超级个体标签"),ht(!1),Ur(null),await Wn()}catch{ie.error("更新超级个体标签失败")}finally{us(!1)}}},[er,Kr]=b.useState(!1),[ea,Rr]=b.useState(null),[Pi,Aa]=b.useState(""),[Io,Ia]=b.useState(!1),qr=V=>{Rr(V),Aa(V.vipSort!=null?String(V.vipSort):""),Kr(!0)},Gr=async()=>{if(!ea)return;const V=Number(Pi);if(!Number.isFinite(V)){ie.error("请输入有效的数字序号");return}Ia(!0);try{const Re=await _t("/api/db/users",{id:ea.id,vipSort:V});if(!(Re!=null&&Re.success)){ie.error((Re==null?void 0:Re.error)||"更新排序序号失败");return}ie.success("已更新排序序号"),Kr(!1),Rr(null),await Wn()}catch{ie.error("更新排序序号失败")}finally{Ia(!1)}},Ra=(V,Re)=>{V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",Re),W(Re)},Hl=(V,Re)=>{V.preventDefault(),He!==Re&&qe(Re)},ta=()=>{W(null),qe(null)},Pt=async(V,Re)=>{V.preventDefault();const et=V.dataTransfer.getData("text/plain")||Hn;if(W(null),qe(null),!et||et===Re)return;const tt=rn.find(Qt=>Qt.id===et),Dn=rn.find(Qt=>Qt.id===Re);if(!tt||!Dn)return;const gr=tt.vipSort??rn.findIndex(Qt=>Qt.id===et)+1,Ro=Dn.vipSort??rn.findIndex(Qt=>Qt.id===Re)+1;In(Qt=>{const Un=[...Qt],ps=Un.findIndex(Oa=>Oa.id===et),Os=Un.findIndex(Oa=>Oa.id===Re);if(ps===-1||Os===-1)return Qt;const na=[...Un],[Wl,_i]=[na[ps],na[Os]];return na[ps]={..._i,vipSort:gr},na[Os]={...Wl,vipSort:Ro},na});try{const[Qt,Un]=await Promise.all([_t("/api/db/users",{id:et,vipSort:Ro}),_t("/api/db/users",{id:Re,vipSort:gr})]);if(!(Qt!=null&&Qt.success)||!(Un!=null&&Un.success)){ie.error((Qt==null?void 0:Qt.error)||(Un==null?void 0:Un.error)||"更新排序失败"),await Wn();return}ie.success("已更新排序"),await Wn()}catch{ie.error("更新排序失败"),await Wn()}},Oi=b.useCallback(async()=>{gt(!0);try{const V=await Oe("/api/db/users/journey-stats");V!=null&&V.success&&V.stats&<(V.stats)}catch{}finally{gt(!1)}},[]);return s.jsxs("div",{className:"p-8 w-full",children:[R&&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:R}),s.jsx("button",{type:"button",onClick:()=>D(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:["共 ",i," 位注册用户",_&&" · RFM 排序中"]})]})}),s.jsxs(xd,{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(Zt,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Zn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(Zt,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Oi,children:[s.jsx(pl,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(Zt,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Rt,children:[s.jsx(wl,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(Zt,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Wn,children:[s.jsx(xl,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(en,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(ee,{variant:"outline",onClick:()=>It(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:w,onChange:V=>{const Re=V.target.value;v(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:_,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(Na,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ne,{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(ee,{onClick:Is,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Og,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ee,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ke,{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(lr,{children:[s.jsx(cr,{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:mr,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(zc,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),_?L==="desc"?s.jsx(Xc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Uw,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Cm,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),_&&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(dr,{children:[r.map(V=>{var Re,et,tt;return s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ye,{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),Z(!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&&!((et=V.id)!=null&&et.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)+"...":(tt=V.id)==null?void 0:tt.slice(0,12)})]})]})}),s.jsx(ye,{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(ye,{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(ye,{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:()=>ge(V),role:"button",tabIndex:0,onKeyDown:Dn=>Dn.key==="Enter"&&ge(V),children:[s.jsx(Zn,{className:"w-3 h-3"})," 绑定",V.referralCount||0,"人"]})]})}),s.jsx(ye,{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 ${wr(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(ye,{className:"text-gray-400",children:V.createdAt?new Date(V.createdAt).toLocaleDateString():"-"}),s.jsx(ye,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>{he(V.id),Z(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(Mg,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Wr(V),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(Wt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>As(V.id),title:"删除",children:s.jsx(Jn,{className:"w-4 h-4"})})]})})]},V.id)}),r.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(is,{page:c,totalPages:gn,total:i,pageSize:h,onPageChange:u,onPageSizeChange:V=>{f(V),u(1)}})]})})})]}),s.jsxs(en,{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(ee,{variant:"outline",onClick:Oi,disabled:nt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${nt?"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:Pu.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(et=>et.startsWith("text-"))}`,children:V.label}),xt[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:xt[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(Br,{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:"实时更新"})]}),nt?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ke,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(xt).length>0?s.jsx("div",{className:"space-y-2",children:Pu.map(V=>{const Re=xt[V.id]||0,et=Math.max(...Pu.map(Dn=>xt[Dn.id]||0),1),tt=Math.round(Re/et*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:`${tt}%`}})}),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(en,{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(ee,{variant:"outline",onClick:Rt,disabled:pt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${pt?"animate-spin":""}`})," 刷新"]}),s.jsxs(ee,{onClick:()=>{An(null),Yt({title:"",description:"",trigger:"",sort:0,enabled:!0}),yt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(hn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),pt?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Be.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Br,{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(ee,{onClick:Rt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ke,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Be.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(Wt,{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(At,{checked:V.enabled,onCheckedChange:()=>Xs(V)}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>{An(V),Yt({title:V.title,description:V.description,trigger:V.trigger,sort:V.sort,enabled:V.enabled}),yt(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Wt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Qs(V.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Jn,{className:"w-4 h-4"})})]})]})},V.id))})]}),s.jsxs(en,{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(ee,{variant:"outline",onClick:Wn,disabled:pr,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${pr?"animate-spin":""}`})," ","刷新"]})})]}),pr?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):rn.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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ee,{className:"p-0",children:s.jsxs(lr,{children:[s.jsx(cr,{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(dr,{children:rn.map((V,Re)=>{var Dn;const et=Hn===V.id,tt=He===V.id;return s.jsxs(it,{draggable:!0,onDragStart:gr=>Ra(gr,V.id),onDragOver:gr=>Hl(gr,V.id),onDrop:gr=>Pt(gr,V.id),onDragEnd:ta,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${et?"opacity-60":""} ${tt?"bg-[#38bdac]/10":""}`,children:[s.jsx(ye,{className:"text-gray-300",children:Re+1}),s.jsx(ye,{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:((Dn=V.name)==null?void 0:Dn[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:V.name})})]})}),s.jsx(ye,{className:"text-gray-300 whitespace-nowrap",children:V.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(ye,{className:"text-gray-300",children:V.vipSort??Re+1}),s.jsx(ye,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>Rs(V),title:"设置超级个体标签",children:s.jsx(_c,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{he(V.id),Z(!0)},title:"编辑资料",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>qr(V),title:"设置排序序号",children:s.jsx(Cm,{className:"w-3.5 h-3.5"})})]})})]},V.id)})})]})})})]})]}),s.jsx(Ot,{open:er,onOpenChange:V=>{Kr(V),V||Rr(null)},children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(Cm,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",ea==null?void 0:ea.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Y,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:Pi,onChange:V=>Aa(V.target.value)})]}),s.jsxs(on,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>Kr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:Gr,disabled:Io,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),Io?"保存中...":"保存"]})]})]})}),s.jsx(Ot,{open:Zs,onOpenChange:V=>{ht(V),V||Ur(null)},children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(xl,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",xn==null?void 0:xn.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Y,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:hs.map(V=>s.jsx(ee,{variant:Ir===V?"default":"outline",size:"sm",className:Ir===V?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>ds(V),children:V},V))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:Ir,onChange:V=>ds(V.target.value)})]})]}),s.jsxs(on,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>ht(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:()=>Ma(Ir),disabled:On,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),On?"保存中...":"保存"]})]})]})}),s.jsx(Ot,{open:X,onOpenChange:te,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[ue?s.jsx(Wt,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Og,{className:"w-5 h-5 text-[#38bdac]"}),ue?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"手机号"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ve.phone,onChange:V=>Ae({...ve,phone:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"昵称"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ve.nickname,onChange:V=>Ae({...ve,nickname:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:ue?"新密码 (留空则不修改)":"密码"}),s.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:ue?"留空则不修改":"请输入密码",value:ve.password,onChange:V=>Ae({...ve,password:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Y,{className:"text-gray-300",children:"管理员权限"}),s.jsx(At,{checked:ve.isAdmin,onCheckedChange:V=>Ae({...ve,isAdmin:V})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Y,{className:"text-gray-300",children:"已购全书"}),s.jsx(At,{checked:ve.hasFullBook,onCheckedChange:V=>Ae({...ve,hasFullBook:V})})]})]}),s.jsxs(on,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>te(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:fe,disabled:I,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),I?"保存中...":"保存"]})]})]})}),s.jsx(Ot,{open:ln,onOpenChange:yt,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(Wt,{className:"w-5 h-5 text-[#38bdac]"}),nn?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Tt.title,onChange:V=>Yt({...Tt,title:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"规则描述"}),s.jsx(_l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Tt.description,onChange:V=>Yt({...Tt,description:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"触发条件"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Tt.trigger,onChange:V=>Yt({...Tt,trigger:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(Y,{className:"text-gray-300",children:"启用状态"})}),s.jsx(At,{checked:Tt.enabled,onCheckedChange:V=>Yt({...Tt,enabled:V})})]})]}),s.jsxs(on,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>yt(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:Pn,disabled:I,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),I?"保存中...":"保存"]})]})]})}),s.jsx(Ot,{open:G,onOpenChange:z,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(Zn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",oe==null?void 0:oe.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:((fs=re.stats)==null?void 0:fs.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:((Di=re.stats)==null?void 0:Di.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:["¥",(((Ps=re.stats)==null?void 0:Ps.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:["¥",(((Li=re.stats)==null?void 0:Li.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(Ke,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Pa=re.referrals)==null?void 0:Pa.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(re.referrals??[]).map((V,Re)=>{var tt;const et=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:((tt=et.nickname)==null?void 0:tt.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:et.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:et.phone||(et.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[et.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),et.status==="paid"&&s.jsxs(Ue,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",et.purchasedSections,"章"]}),et.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:et.createdAt?new Date(et.createdAt).toLocaleDateString():""})]})]},et.id||Re)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(on,{children:s.jsx(ee,{variant:"outline",onClick:()=>z(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(t0,{open:me,onClose:()=>Z(!1),userId:ce,onUserUpdated:It})]})}function ph(t,[e,n]){return Math.min(n,Math.max(e,t))}var jk=["PageUp","PageDown"],kk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Sk={"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",[Fg,mP,gP]=Qx(zl),[Ck]=Ei(zl,[gP]),[xP,Nf]=Ck(zl),Ek=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:N,...w}=t,v=b.useRef(new Set),k=b.useRef(0),E=o==="horizontal"?yP:bP,[T=[],R]=go({prop:f,defaultProp:h,onChange:X=>{var ue;(ue=[...v.current][k.current])==null||ue.focus(),m(X)}}),D=b.useRef(T);function _(X){const te=kP(T,X);F(X,te)}function P(X){F(X,k.current)}function L(){const X=D.current[k.current];T[k.current]!==X&&g(T)}function F(X,te,{commit:ue}={commit:!1}){const ae=TP(i),I=MP(Math.round((X-r)/i)*i+r,ae),O=ph(I,[r,a]);R((G=[])=>{const z=wP(G,O,te);if(EP(z,u*i)){k.current=z.indexOf(O);const re=String(z)!==String(G);return re&&ue&&g(z),re?z:G}else return G})}return s.jsx(xP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:v.current,values:T,orientation:o,form:N,children:s.jsx(Fg.Provider,{scope:t.__scopeSlider,children:s.jsx(Fg.Slot,{scope:t.__scopeSlider,children:s.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:ot(w.onPointerDown,()=>{c||(D.current=T)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:_,onSlideMove:c?void 0:P,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&F(r,0,{commit:!0}),onEndKeyDown:()=>!c&&F(a,T.length-1,{commit:!0}),onStepKeyDown:({event:X,direction:te})=>{if(!c){const I=jk.includes(X.key)||X.shiftKey&&kk.includes(X.key)?10:1,O=k.current,G=T[O],z=i*I*te;F(G+z,O,{commit:!0})}}})})})})});Ek.displayName=zl;var[Tk,Mk]=Ck(zl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),yP=b.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=St(e,E=>g(E)),N=b.useRef(void 0),w=yf(a),v=w==="ltr",k=v&&!i||!v&&i;function C(E){const T=N.current||m.getBoundingClientRect(),R=[0,T.width],_=r0(R,k?[n,r]:[r,n]);return N.current=T,_(E-T.left)}return s.jsx(Tk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(Ak,{dir:w,"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:()=>{N.current=void 0,u==null||u()},onStepKeyDown:E=>{const R=Sk[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:R?-1:1})}})})}),bP=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=St(e,f),g=b.useRef(void 0),y=!a;function N(w){const v=g.current||f.current.getBoundingClientRect(),k=[0,v.height],E=r0(k,y?[r,n]:[n,r]);return g.current=v,E(w-v.top)}return s.jsx(Tk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(Ak,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const v=N(w.clientY);i==null||i(v)},onSlideMove:w=>{const v=N(w.clientY);o==null||o(v)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const k=Sk[y?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:k?-1:1})}})})}),Ak=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=Nf(zl,n);return s.jsx(ut.span,{...h,ref:e,onKeyDown:ot(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):jk.concat(kk).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)&&a(m)}),onPointerUp:ot(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),Ik="SliderTrack",Rk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Nf(Ik,n);return s.jsx(ut.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});Rk.displayName=Ik;var $g="SliderRange",Pk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Nf($g,n),i=Mk($g,n),o=b.useRef(null),c=St(e,o),u=a.values.length,h=a.values.map(g=>Lk(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(ut.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});Pk.displayName=$g;var Bg="SliderThumb",Ok=b.forwardRef((t,e)=>{const n=mP(t.__scopeSlider),[r,a]=b.useState(null),i=St(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(vP,{...t,ref:i,index:o})}),vP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=Nf(Bg,n),c=Mk(Bg,n),[u,h]=b.useState(null),f=St(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=e0(u),y=o.values[r],N=y===void 0?0:Lk(y,o.min,o.max),w=jP(r,o.values.length),v=g==null?void 0:g[c.size],k=v?SP(v,N,c.direction):0;return b.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(${N}% + ${k}px)`},children:[s.jsx(Fg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(ut.span,{role:"slider","aria-label":t["aria-label"]||w,"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,...i,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:ot(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(Dk,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Ok.displayName=Bg;var NP="RadioBubbleInput",Dk=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=St(a,r),o=Zx(e);return b.useEffect(()=>{const c=a.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(ut.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});Dk.displayName=NP;function wP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function Lk(t,e,n){const i=100/(n-e)*(t-e);return ph(i,[0,100])}function jP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function kP(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),r=Math.min(...n);return n.indexOf(r)}function SP(t,e,n){const r=t/2,i=r0([0,50],[0,r]);return(r-i(e)*n)*n}function CP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function EP(t,e){if(e>0){const n=CP(t);return Math.min(...n)>=e}return!0}function r0(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 TP(t){return(String(t).split(".")[1]||"").length}function MP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var AP=Ek,IP=Rk,RP=Pk,PP=Ok;function OP({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(AP,{defaultValue:e,value:n,min:r,max:a,className:Ct("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(IP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(RP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(PP,{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 DP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function _k(t){const[e,n]=b.useState(DP),[r,a]=b.useState(!0),[i,o]=b.useState(!1);b.useEffect(()=>{Oe("/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(()=>a(!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){ie.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}ie.success(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),ie.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(ee,{onClick:c,disabled:i||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"flex items-center gap-2 text-white",children:[s.jsx(fA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Ft,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ee,{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(Y,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ku,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(ne,{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(Y,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Zn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(OP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(ne,{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(Y,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ku,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(ne,{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(Y,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ku,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(ne,{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(Y,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Zn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(ne,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"flex items-center gap-2 text-white",children:[s.jsx(jl,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Ft,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ee,{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(Y,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(ne,{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(Y,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(Je,{children:s.jsxs(Ye,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(ku,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ee,{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 LP(){var Hn;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[N,w]=b.useState(null),[v,k]=b.useState(""),[C,E]=b.useState("all"),[T,R]=b.useState(1),[D,_]=b.useState(10),[P,L]=b.useState(0),[F,X]=b.useState(new Set),[te,ue]=b.useState(null),[ae,I]=b.useState(""),[O,G]=b.useState(!1),[z,re]=b.useState(null),[K,$]=b.useState(""),[H,oe]=b.useState(!1),[q,me]=b.useState([]),[Z,ce]=b.useState(1),[he,ve]=b.useState(0),[Ae,Be]=b.useState("");b.useEffect(()=>{$e()},[]),b.useEffect(()=>{R(1)},[t,C]),b.useEffect(()=>{pt(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&pt(t,!0),t==="giftPay"&&pt("giftPay",!0)},[T,D,C,v,Z,Ae]);async function $e(){w(null);try{const W=await Oe("/api/admin/distribution/overview");W!=null&&W.success&&W.overview&&i(W.overview)}catch(W){console.error("[Admin] 概览接口异常:",W),w("加载概览失败")}try{const W=await Oe("/api/db/users");m((W==null?void 0:W.users)||[])}catch(W){console.error("[Admin] 用户数据加载失败:",W)}}async function pt(W,He=!1){var qe;if(!(!He&&F.has(W))){y(!0);try{const xt=f;switch(W){case"overview":break;case"orders":{try{const lt=new URLSearchParams({page:String(T),pageSize:String(D),...C!=="all"&&{status:C},...v&&{search:v}}),nt=await Oe(`/api/admin/orders?${lt}`);if(nt!=null&&nt.success&&nt.orders){const gt=nt.orders.map(It=>{const gn=xt.find(wr=>wr.id===It.userId),mr=It.referrerId?xt.find(wr=>wr.id===It.referrerId):null;return{...It,amount:parseFloat(String(It.amount))||0,userNickname:(gn==null?void 0:gn.nickname)||It.userNickname||"未知用户",userPhone:(gn==null?void 0:gn.phone)||It.userPhone||"-",referrerNickname:(mr==null?void 0:mr.nickname)||null,referrerCode:(mr==null?void 0:mr.referralCode)??null,type:It.productType||It.type}});r(gt),L(nt.total??gt.length)}else r([]),L(0)}catch(lt){console.error(lt),w("加载订单失败"),r([])}break}case"bindings":{try{const lt=new URLSearchParams({page:String(T),pageSize:String(D),...C!=="all"&&{status:C}}),nt=await Oe(`/api/db/distribution?${lt}`);c((nt==null?void 0:nt.bindings)||[]),L((nt==null?void 0:nt.total)??((qe=nt==null?void 0:nt.bindings)==null?void 0:qe.length)??0)}catch(lt){console.error(lt),w("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const lt=C==="completed"?"success":C==="rejected"?"failed":C,nt=new URLSearchParams({...lt&<!=="all"&&{status:lt},page:String(T),pageSize:String(D)}),gt=await Oe(`/api/admin/withdrawals?${nt}`);if(gt!=null&>.success&>.withdrawals){const It=gt.withdrawals.map(gn=>({...gn,account:gn.account??"未绑定微信号",status:gn.status==="success"?"completed":gn.status==="failed"?"rejected":gn.status}));h(It),L((gt==null?void 0:gt.total)??It.length)}else gt!=null&>.success||w(`获取提现记录失败: ${(gt==null?void 0:gt.error)||"未知错误"}`),h([])}catch(lt){console.error(lt),w("加载提现数据失败"),h([])}break}case"giftPay":{try{const lt=new URLSearchParams({page:String(Z),pageSize:"20",...Ae&&{status:Ae}}),nt=await Oe(`/api/admin/gift-pay-requests?${lt}`);nt!=null&&nt.success&&nt.data?(me(nt.data),ve(nt.total??nt.data.length)):(me([]),ve(0))}catch(lt){console.error(lt),w("加载代付请求失败"),me([])}break}}X(lt=>new Set(lt).add(W))}catch(xt){console.error(xt)}finally{y(!1)}}}async function Et(){w(null),X(W=>{const He=new Set(W);return He.delete(t),He}),t==="overview"&&$e(),await pt(t,!0)}async function ln(W){if(confirm("确认审核通过并打款?"))try{const He=await _t("/api/admin/withdrawals",{id:W,action:"approve"});if(!(He!=null&&He.success)){const qe=(He==null?void 0:He.message)||(He==null?void 0:He.error)||"操作失败";ie.error(qe);return}await Et()}catch(He){console.error(He),ie.error("操作失败")}}function yt(W){re(W),$("")}async function nn(){const W=z;if(!W)return;const He=K.trim();if(!He){ie.error("请填写拒绝原因");return}oe(!0);try{const qe=await _t("/api/admin/withdrawals",{id:W,action:"reject",errorMessage:He});if(!(qe!=null&&qe.success)){ie.error((qe==null?void 0:qe.error)||"操作失败");return}ie.success("已拒绝该提现申请"),re(null),$(""),await Et()}catch(qe){console.error(qe),ie.error("操作失败")}finally{oe(!1)}}function An(){z&&ie.info("已取消操作"),re(null),$("")}async function Tt(){var W;if(!(!(te!=null&&te.orderSn)&&!(te!=null&&te.id))){G(!0),w(null);try{const He=await _t("/api/admin/orders/refund",{orderSn:te.orderSn||te.id,reason:ae||void 0});He!=null&&He.success?(ue(null),I(""),await pt("orders",!0)):w((He==null?void 0:He.error)||"退款失败")}catch(He){const qe=He;w(((W=qe==null?void 0:qe.data)==null?void 0:W.error)||"退款失败,请检查网络后重试")}finally{G(!1)}}}function Yt(W){const He={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:`${He[W]||"bg-gray-500/20 text-gray-400"} border-0`,children:qe[W]||W})}const rn=Math.ceil(P/D)||1,In=n,pr=o.filter(W=>{var qe,xt,lt,nt;if(!v)return!0;const He=v.toLowerCase();return((qe=W.refereeNickname)==null?void 0:qe.toLowerCase().includes(He))||((xt=W.refereePhone)==null?void 0:xt.includes(He))||((lt=W.referrerName)==null?void 0:lt.toLowerCase().includes(He))||((nt=W.referrerCode)==null?void 0:nt.toLowerCase().includes(He))}),Rn=u.filter(W=>{var qe;if(!v)return!0;const He=v.toLowerCase();return((qe=W.userName)==null?void 0:qe.toLowerCase().includes(He))||W.account&&W.account.toLowerCase().includes(He)});return s.jsxs("div",{className:"p-8 w-full",children:[N&&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:N}),s.jsx("button",{type:"button",onClick:()=>w(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(ee,{onClick:Et,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Ke,{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:zc},{key:"orders",label:"订单管理",icon:ch},{key:"bindings",label:"绑定管理",icon:Ss},{key:"withdrawals",label:"提现审核",icon:jl},{key:"giftPay",label:"代付请求",icon:Qw},{key:"settings",label:"推广设置",icon:wl}].map(W=>s.jsxs("button",{type:"button",onClick:()=>{e(W.key),E("all"),k(""),W.key==="giftPay"&&(Be(""),ce(1))},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===W.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[s.jsx(W.icon,{className:"w-4 h-4"}),W.label]},W.key))}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ke,{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"&&a&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{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:a.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(Mg,{className:"w-6 h-6 text-blue-400"})})]})})}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{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:a.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(Zn,{className:"w-6 h-6 text-cyan-400"})})]})})}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{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:(a.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(zc,{className:"w-6 h-6 text-amber-400"})})]})})}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{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:a.todayBindings})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:s.jsx(Ss,{className:"w-6 h-6 text-green-400"})})]})})}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{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:a.todayConversions})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:s.jsx(zv,{className:"w-6 h-6 text-purple-400"})})]})})}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{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:["¥",a.todayEarnings.toFixed(2)]})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:s.jsx(ch,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Hn=a.todayClicksByPage)==null?void 0:Hn.length)??0)>0&&s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Mg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),s.jsx(Ee,{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:[...a.todayClicksByPage??[]].sort((W,He)=>He.clicks-W.clicks).map((W,He)=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:W.page||"(未区分)"}),s.jsx("td",{className:"py-2 pr-4 text-right text-white",children:W.clicks}),s.jsxs("td",{className:"py-2 text-right text-gray-400",children:[a.todayClicks>0?(W.clicks/a.todayClicks*100).toFixed(1):0,"%"]})]},He))})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Ce,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ee,{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(Tg,{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:[a.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),s.jsx(Ce,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Ee,{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:[a.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",a.pendingWithdrawAmount.toFixed(2)]})]}),s.jsx(ee,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(Je,{children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(lh,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),s.jsx(Ee,{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:a.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:a.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:a.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:["¥",a.monthEarnings.toFixed(2)]})]})]})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(Je,{children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(zc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),s.jsxs(Ee,{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:a.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:a.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:a.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:["¥",a.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:[a.conversionRate,"%"]})]})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(Je,{children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Zn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),s.jsx(Ee,{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:a.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:a.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(Na,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ne,{value:v,onChange:W=>k(W.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:W=>E(W.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ee,{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:In.map(W=>{var He,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:[(He=W.id)==null?void 0:He.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:W.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:W.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const xt=W.productType||W.type,lt=W.description||"",nt=String(W.productId||W.sectionId||""),gt=xt==="vip"||lt.includes("VIP")||lt.toLowerCase().includes("vip")||nt.toLowerCase().includes("vip");return xt==="balance_recharge"?`余额充值 ¥${typeof W.amount=="number"?W.amount.toFixed(2):parseFloat(String(W.amount||"0")).toFixed(2)}`:gt?"超级个体开通费用":xt==="fullbook"?`${W.bookName||"《底层逻辑》"} - 全本`:xt==="match"?"匹配次数购买":`${W.bookName||"《底层逻辑》"} - ${W.sectionTitle||W.chapterTitle||`章节${W.productId||W.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const xt=W.productType||W.type,lt=W.description||"",nt=String(W.productId||W.sectionId||""),gt=xt==="vip"||lt.includes("VIP")||lt.toLowerCase().includes("vip")||nt.toLowerCase().includes("vip");return xt==="balance_recharge"?"余额充值":gt?"超级个体":xt==="fullbook"?"全书解锁":xt==="match"?"功能权益":W.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof W.amount=="number"?W.amount.toFixed(2):parseFloat(String(W.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:W.paymentMethod==="wechat"?"微信支付":W.paymentMethod==="balance"?"余额支付":W.paymentMethod==="alipay"?"支付宝":W.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:W.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):W.status==="completed"||W.status==="paid"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):W.status==="pending"||W.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:W.refundReason,children:W.status==="refunded"&&W.refundReason?W.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:W.referrerId||W.referralCode?s.jsxs("span",{title:W.referralCode||W.referrerCode||W.referrerId||"",children:[W.referrerNickname||W.referralCode||W.referrerCode||((qe=W.referrerId)==null?void 0:qe.slice(0,8)),(W.referralCode||W.referrerCode)&&` (${W.referralCode||W.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:W.referrerEarnings?`¥${(typeof W.referrerEarnings=="number"?W.referrerEarnings:parseFloat(String(W.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:W.createdAt?new Date(W.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(W.status==="paid"||W.status==="completed")&&s.jsxs(ee,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{ue(W),I("")},children:[s.jsx(nj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},W.id)})})]})}),t==="orders"&&s.jsx(is,{page:T,totalPages:rn,total:P,pageSize:D,onPageChange:R,onPageSizeChange:W=>{_(W),R(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(Na,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ne,{value:v,onChange:W=>k(W.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:W=>E(W.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ee,{className:"p-0",children:[pr.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:pr.map(W=>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:W.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:W.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:W.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:W.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:W.boundAt?new Date(W.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:W.expiresAt?new Date(W.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Yt(W.status)}),s.jsx("td",{className:"p-4",children:W.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",W.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},W.id))})]})}),t==="bindings"&&s.jsx(is,{page:T,totalPages:rn,total:P,pageSize:D,onPageChange:R,onPageSizeChange:W=>{_(W),R(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(Na,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ne,{value:v,onChange:W=>k(W.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:W=>E(W.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ee,{className:"p-0",children:[Rn.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:Rn.map(W=>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:[W.userAvatar?s.jsx("img",{src:W.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:(W.userName||W.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:W.userName||W.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",W.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ue,{className:W.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:W.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:W.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:W.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:W.createdAt?new Date(W.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Yt(W.status)}),s.jsx("td",{className:"p-4 text-right",children:W.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(ee,{size:"sm",onClick:()=>ln(W.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(zv,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>yt(W.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Gw,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},W.id))})]})}),t==="withdrawals"&&s.jsx(is,{page:T,totalPages:rn,total:P,pageSize:D,onPageChange:R,onPageSizeChange:W=>{_(W),R(1)}})]})})]}),t==="giftPay"&&s.jsx("div",{className:"space-y-4",children:s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(Je,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(Ye,{className:"text-white",children:"代付请求列表"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:Ae,onChange:W=>{Be(W.target.value),ce(1)},children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"paid",children:"已支付"}),s.jsx("option",{value:"cancelled",children:"已取消"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>pt("giftPay",!0),className:"border-gray-600 text-gray-300",children:[s.jsx(Ke,{className:"w-4 h-4 mr-1"}),"刷新"]})]})]})}),s.jsxs(Ee,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"请求号"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"发起人"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"商品/金额"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"代付人"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:q.map(W=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-4 font-mono text-xs text-gray-400",children:W.requestSn}),s.jsx("td",{className:"p-4",children:s.jsx("p",{className:"text-white text-sm",children:W.initiatorNick||W.initiatorUserId})}),s.jsxs("td",{className:"p-4",children:[s.jsxs("p",{className:"text-white",children:[W.productType," · ¥",W.amount.toFixed(2)]}),W.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:W.description})]}),s.jsx("td",{className:"p-4 text-gray-400",children:W.payerNick||(W.payerUserId?W.payerUserId:"-")}),s.jsx("td",{className:"p-4",children:s.jsx(Ue,{className:W.status==="paid"?"bg-green-500/20 text-green-400 border-0":W.status==="pending"?"bg-amber-500/20 text-amber-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:W.status==="paid"?"已支付":W.status==="pending"?"待支付":W.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:W.createdAt?new Date(W.createdAt).toLocaleString("zh-CN"):"-"})]},W.id))})]})}),q.length===0&&!g&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),he>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(is,{page:Z,totalPages:Math.ceil(he/20),total:he,pageSize:20,onPageChange:ce,onPageSizeChange:()=>{}})})]})]})})]}),s.jsx(Ot,{open:!!te,onOpenChange:W=>!W&&ue(null),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Dt,{children:s.jsx(Lt,{className:"text-white",children:"订单退款"})}),te&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",te.orderSn||te.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof te.amount=="number"?te.amount.toFixed(2):parseFloat(String(te.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(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:ae,onChange:W=>I(W.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>ue(null),disabled:O,children:"取消"}),s.jsx(ee,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Tt,disabled:O,children:O?"退款中...":"确认退款"})]})]})}),s.jsx(Ot,{open:!!z,onOpenChange:W=>!W&&An(),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Dt,{children:s.jsx(Lt,{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(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:K,onChange:W=>$(W.target.value)})})]})]}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:An,disabled:H,children:"取消"}),s.jsx(ee,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:nn,disabled:H||!K.trim(),children:H?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(_k,{embedded:!0})})]})}function _P(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[N,w]=b.useState(0),[v,k]=b.useState(null),[C,E]=b.useState(null),[T,R]=b.useState(""),[D,_]=b.useState(!1);async function P(){var I,O,G,z,re,K,$;i(!0),c(null);try{const H=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),oe=await Oe(`/api/admin/withdrawals?${H}`);if(oe!=null&&oe.success){const q=oe.withdrawals||[];e(q),w(oe.total??((I=oe.stats)==null?void 0:I.total)??q.length),r({total:((O=oe.stats)==null?void 0:O.total)??oe.total??q.length,pendingCount:((G=oe.stats)==null?void 0:G.pendingCount)??0,pendingAmount:((z=oe.stats)==null?void 0:z.pendingAmount)??0,successCount:((re=oe.stats)==null?void 0:re.successCount)??0,successAmount:((K=oe.stats)==null?void 0:K.successAmount)??0,failedCount:(($=oe.stats)==null?void 0:$.failedCount)??0})}else c("加载提现记录失败")}catch(H){console.error("Load withdrawals error:",H),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{P()},[u,f,g]);const L=Math.ceil(N/g)||1;async function F(I){const O=t.find(G=>G.id===I);if(O!=null&&O.userCommissionInfo&&O.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${O.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(I);try{const G=await _t("/api/admin/withdrawals",{id:I,action:"approve"});G!=null&&G.success?P():ie.error("操作失败: "+((G==null?void 0:G.error)??""))}catch{ie.error("操作失败")}finally{k(null)}}function X(I){E(I),R("")}async function te(){const I=C;if(!I)return;const O=T.trim();if(!O){ie.error("请填写拒绝原因");return}_(!0);try{const G=await _t("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:O});G!=null&&G.success?(ie.success("已拒绝该提现申请"),E(null),R(""),P()):ie.error("操作失败: "+((G==null?void 0:G.error)??""))}catch{ie.error("操作失败")}finally{_(!1)}}function ue(){C&&ie.info("已取消操作"),E(null),R("")}function ae(I){switch(I){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:I})}}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(ee,{variant:"outline",onClick:P,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Ce,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ee,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(ch,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ee,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ee,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ee,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ee,{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(I=>s.jsx(ee,{variant:u===I?"default":"outline",size:"sm",onClick:()=>h(I),className:u===I?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:I==="all"?"全部":I==="pending"?"待处理":I==="success"?"已完成":"已拒绝"},I))}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ee,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ke,{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(I=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(I.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[I.userAvatar?s.jsx("img",{src:I.userAvatar,alt:I.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:(I.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:I.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:I.userPhone??I.referralCode??(I.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(I.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:I.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:["¥",I.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:["¥",I.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:["¥",I.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:I.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",I.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[ae(I.status),I.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:I.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:I.processedAt?new Date(I.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:I.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:I.userConfirmedAt,children:["已确认 ",new Date(I.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(I.status==="pending"||I.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(ee,{size:"sm",onClick:()=>F(I.id),disabled:v===I.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(hf,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>X(I.id),disabled:v===I.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(ir,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(I.status==="success"||I.status==="completed")&&I.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:I.transactionId})]})]},I.id))})]})}),s.jsx(is,{page:f,totalPages:L,total:N,pageSize:g,onPageChange:m,onPageSizeChange:I=>{y(I),m(1)}})]})})}),s.jsx(Ot,{open:!!C,onOpenChange:I=>!I&&ue(),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Dt,{children:s.jsx(Lt,{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(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:T,onChange:I=>R(I.target.value)})})]})]}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:ue,disabled:D,children:"取消"}),s.jsx(ee,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:te,disabled:D||!T.trim(),children:D?"提交中...":"确认拒绝"})]})]})})]})}var $m={exports:{}},Bm={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var c1;function zP(){if(c1)return Bm;c1=1;var t=fd();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,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),N=r({inst:{value:y,getSnapshot:g}}),w=N[0].inst,v=N[1];return i(function(){w.value=y,w.getSnapshot=g,u(w)&&v({inst:w})},[m,y,g]),a(function(){return u(w)&&v({inst:w}),m(function(){u(w)&&v({inst:w})})},[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 Bm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Bm}var d1;function zk(){return d1||(d1=1,$m.exports=zP()),$m.exports}var Fk=zk();function Gn(t){this.content=t}Gn.prototype={constructor:Gn,find:function(t){for(var e=0;e>1}};Gn.from=function(t){if(t instanceof Gn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Gn(e)};function $k(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let o=0;a.text[o]==i.text[o];o++)n++;return n}if(a.content.size||i.content.size){let o=$k(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function Bk(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),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,a+c,i||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,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",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?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=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),a+=c.nodeSize),o=u}return new xe(r,a)}cutByIndex(e,n){return e==n?xe.empty:e==0&&n==this.content.length?this:new xe(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new xe(a,i)}addToStart(e){return new xe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new xe(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 a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?Ou(n+1,i):Ou(n,r);r=i}}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 xe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new xe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return xe.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};$t.none=[];class gh 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=Hk(this.content,e+this.openStart,n);return r&&new Ie(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ie(Vk(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,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ie(xe.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new Ie(e,r,a)}}Ie.empty=new Ie(xe.empty,0,0);function Vk(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(a==e||i.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,i.copy(Vk(i.content,e-a-1,n-a-1)))}function Hk(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),o=t.maybeChild(a);if(i==e||o.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Hk(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function FP(t,e,n){if(n.openStart>t.depth)throw new gh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new gh("Inconsistent open depths");return Wk(t,e,n,0)}function Wk(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Fc(t,e,n,r){let a=(e||t).node(n),i=0,o=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(co(t.nodeAfter,r),i++));for(let c=i;ca&&Hg(t,e,a+1),o=r.depth>a&&Hg(n,r,a+1),c=[];return Fc(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(Uk(i,o),co(uo(i,Kk(t,e,n,r,a+1)),c)):(i&&co(uo(i,xh(t,e,a+1)),c),Fc(e,n,a,c),o&&co(uo(o,xh(n,r,a+1)),c)),Fc(r,null,a,c),new xe(c)}function xh(t,e,n){let r=[];if(Fc(null,t,n,r),t.depth>n){let a=Hg(t,e,n+1);co(uo(a,xh(t,e,n+1)),r)}return Fc(e,null,n,r),new xe(r)}function $P(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(xe.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class ed{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],a=e.child(n);return r?e.child(n).cut(r):a}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],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;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 yh(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=[],a=0,i=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(i),h=i-u;if(r.push(o,c,a+u),!h||(o=o.child(c),o.isText))break;i=h-1,a+=u+1}return new ed(n,r,i)}static resolveCached(e,n){let r=u1.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}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()+")"),qk(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=xe.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;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 a=xe.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};wa.prototype.text=void 0;class bh extends wa{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):qk(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 bh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bh(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 qk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class yo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new WP(e,n);if(r.next==null)return yo.empty;let a=Gk(r);r.next&&r.err("Unexpected trailing text");let i=QP(YP(a));return XP(i,r),i}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 a=0;a{let i=a+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return i}).join(` -`)}}yo.empty=new yo(!0);class WP{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 Gk(t){let e=[];do e.push(UP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function UP(t){let e=[];do e.push(KP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function KP(t){let e=JP(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=qP(t,e);else break;return e}function h1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function qP(t,e){let n=h1(t),r=n;return t.eat(",")&&(t.next!="}"?r=h1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function GP(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let i in n){let o=n[i];o.isInGroup(e)&&a.push(o)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function JP(t){if(t.eat("(")){let e=Gk(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=GP(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 YP(t){let e=[[]];return a(i(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 a(o,c){o.forEach(u=>u.to=c)}function i(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(i(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=i(o.exprs[u],c);if(u==o.exprs.length-1)return h;a(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),a(i(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return a(i(o.expr,c),u),a(i(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(i(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||a.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let i=e[r.join(",")]=new yo(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:Qk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new wa(this,this.computeAttrs(e),xe.from(n),$t.setFrom(r))}createChecked(e=null,n,r){return n=xe.from(n),this.checkContent(n),new wa(this,this.computeAttrs(e),n,$t.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=xe.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(xe.empty,!0);return i?new wa(this,e,n.append(i),$t.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[i]=new eS(i,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function ZP(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class eO{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?ZP(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class wf{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=Zk(e,a.attrs),this.excluded=null;let i=Yk(this.attrs);this.instance=i?new $t(this,i):null}create(e=null){return!e&&this.instance?this.instance:new $t(this,Qk(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new wf(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class tS{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=Gn.from(e.nodes),n.marks=Gn.from(e.marks||{}),this.nodes=p1.compile(this.spec.nodes,this),this.marks=wf.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let i=this.nodes[a],o=i.spec.content||"",c=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=yo.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=c=="_"?null:c?m1(this,c.split(" ")):c==""||!i.inlineContent?[]:null}for(let a in this.marks){let i=this.marks[a],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:m1(this,o.split(" "))}this.nodeFromJSON=a=>wa.fromJSON(this,a),this.markFromJSON=a=>$t.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof p1){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,a)}text(e,n){let r=this.nodes.text;return new bh(r,r.defaultAttrs,e,$t.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 m1(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 tO(t){return t.tag!=null}function nO(t){return t.style!=null}class pi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(tO(a))this.tags.push(a);else if(nO(a)){let i=/[^=]*/.exec(a.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let i=e.nodes[a.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new x1(this,n,!1);return r.addAll(e,$t.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new x1(this,n,!0);return r.addAll(e,$t.none,n.from,n.to),Ie.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;ae.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(a){let i=a.priority==null?50:a.priority,o=0;for(;o{r(o=y1(o)),o.mark||o.ignore||o.clearMark||(o.mark=a)})}for(let a in e.nodes){let i=e.nodes[a].spec.parseDOM;i&&i.forEach(o=>{r(o=y1(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new pi(e,pi.schemaRules(e)))}}const nS={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},rO={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rS={ol:!0,ul:!0},td=1,Ug=2,$c=4;function g1(t,e,n){return e!=null?(e?td:0)|(e==="full"?Ug:0):t&&t.whitespace=="pre"?td|Ug:n&~$c}class Du{constructor(e,n,r,a,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=$t.none,this.match=i||(o&$c?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(xe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&td)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=xe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(xe.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&&!nS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class x1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,o=g1(null,n.preserveWhitespace,0)|(r?$c:0);a?i=new Du(a.type,a.attrs,$t.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Du(null,null,$t.none,!0,null,o):i=new Du(e.schema.topNodeType,null,$t.none,!0,null,o),this.nodes=[i],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,a=this.top,i=a.options&Ug?"full":this.localPreserveWS||(a.options&td)>0,{schema:o}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="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,a){let i,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&&(i=!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(a)this.addElement(e,r,a);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)}i&&this.sync(c)&&this.open--}addAll(e,n,r,a){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=a==null?null:e.childNodes[a];o!=c;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let a,i;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!a||a.length>h.length+c)&&(a=h,i=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!a)return null;this.sync(i);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):b1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Du(e,n,u,a,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|=td)}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 a=r.length-1;a>=0;a--)e+=r[a].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,a=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(a?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>=i;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&a?this.nodes[u].type:r&&u>=i?r.node(u-i).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 sO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&rS.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function aO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function y1(t){let e={};for(let n in t)e[n]=t[n];return e}function b1(t,e){let n=e.schema.nodes;for(let r in n){let a=n[r];if(!a.allowsMarkType(t))continue;let i=[],o=c=>{i.push(c);for(let u=0;u{if(i.length||o.marks.length){let c=0,u=0;for(;c=0;a--){let i=this.serializeMark(e.marks[a],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let a=this.marks[e.type.name];return a&&Zu(Hm(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return Zu(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new To(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=v1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return v1(e.marks)}}function v1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Hm(t){return t.document||window.document}const N1=new WeakMap;function iO(t){let e=N1.get(t);return e===void 0&&N1.set(t,e=oO(t)),e}function oO(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 a=0;a-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=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),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:N}=Zu(t,g,n,r);if(u.appendChild(y),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const sS=65535,aS=Math.pow(2,16);function lO(t,e){return t+e*aS}function w1(t){return t&sS}function cO(t){return(t-(t&sS))/aS}const iS=1,oS=2,eh=4,lS=8;class Kg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&lS)>0}get deletedBefore(){return(this.delInfo&(iS|eh))>0}get deletedAfter(){return(this.delInfo&(oS|eh))>0}get deletedAcross(){return(this.delInfo&eh)>0}}class Fr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fr.empty)return Fr.empty}recover(e){let n=0,r=w1(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+a+(g<0?0:f);if(r)return y;let N=e==(n<0?u:m)?null:lO(c/3,e-u),w=e==u?oS:e==m?iS:eh;return(n<0?e!=u:e!=m)&&(w|=lS),new Kg(y,w,N)}a+=f-h}return r?e+a:new Kg(e+a,0,null)}touches(e,n){let r=0,a=w1(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+i],f=u+h;if(e<=f&&c==a*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 a=0,i=0;a=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?r-a-1:void 0)}}invert(){let e=new nd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,i)}invert(){return new ks(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 ci(n.pos,r.pos,this.mark)}merge(e){return e instanceof ci&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ci(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 ci(n.from,n.to,e.markFromJSON(n.mark))}}fr.jsonID("addMark",ci);class ks extends fr{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(s0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return jn.fromReplace(e,this.from,this.to,r)}invert(){return new ci(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 ks(n.pos,r.pos,this.mark)}merge(e){return e instanceof ks&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ks(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 ks(n.from,n.to,e.markFromJSON(n.mark))}}fr.jsonID("removeMark",ks);class di extends fr{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return jn.fromReplace(e,this.pos,this.pos+1,new Ie(xe.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 a=0;ar.pos?null:new Bn(n.pos,r.pos,a,i,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 Bn(n.from,n.to,n.gapFrom,n.gapTo,Ie.fromJSON(e,n.slice),n.insert,!!n.structure)}}fr.jsonID("replaceAround",Bn);function qg(t,e,n){let r=t.resolve(e),a=n-e,i=r.depth;for(;a>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,a--;if(a>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;a>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,a--}}return!1}function dO(t,e,n,r){let a=[],i=[],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),N=r.addToSet(m);for(let w=0;wt.step(u)),i.forEach(u=>t.step(u))}function uO(t,e,n,r){let a=[],i=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;i++;let u=null;if(r instanceof wf){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 ks(o.from,o.to,o.style)))}function a0(t,e,n,r=n.contentMatch,a=!0){let i=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function hO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Fl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;N--)w||r.index(N)>0?(w=!0,f=xe.from(r.node(N).copy(f)),m++):u--;let g=xe.empty,y=0;for(let N=i,w=!1;N>n;N--)w||a.after(N+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=xe.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new Bn(a,i,a,i,new Ie(r,0,0),n.length,!0))}function xO(t,e,n,r,a){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof a=="function"?a(o):a;if(o.isTextblock&&!o.hasMarkup(r,u)&&yO(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",N=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!N?h=!1:!y&&N&&(h=!0)}h===!1&&dS(t,o,c,i),a0(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new Bn(m,g,m+1,g-1,new Ie(xe.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&cS(t,o,c,i),!1}})}function cS(t,e,n,r){e.forEach((a,i)=>{if(a.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(a.text);){let u=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function dS(t,e,n,r){e.forEach((a,i)=>{if(a.type==a.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(` -`))}})}function yO(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function bO(t,e,n,r,a){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,a||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Bn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Ie(xe.from(o),0,0),1,!0))}function ja(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),g=a.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),N=r&&r[f+1];N&&(y=y.replaceChild(0,N.type.create(N.attrs)));let w=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!w.type.validContent(y))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function vO(t,e,n=1,r){let a=t.doc.resolve(e),i=xe.empty,o=xe.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=xe.from(a.node(c).copy(i));let f=r&&r[h];o=xe.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new $n(e,e,new Ie(i.append(o),n,n),!0))}function Ti(t,e){let n=t.resolve(e),r=n.index();return uS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function NO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let a=0;a0?(i=r.node(a+1),c++,o=r.node(a).maybeChild(c)):(i=r.node(a).maybeChild(c-1),o=r.node(a+1)),i&&!i.isTextblock&&uS(i,o)&&r.node(a).canReplace(c,c+1))return e;if(a==0)break;e=n<0?r.before(a):r.after(a)}}function wO(t,e,n){let r=null,{linebreakReplacement:a}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(a&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(a);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);dS(t,f.node(),f.before(),c)}o.inlineContent&&a0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new $n(h,u.map(e+n,-1),Ie.empty,!0)),r===!0){let f=t.doc.resolve(h);cS(t,f.node(),f.before(),t.steps.length)}return t}function jO(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 a=r.depth-1;a>=0;a--){let i=r.index(a);if(r.node(a).canReplaceWith(i,i,n))return r.before(a+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let a=r.depth-1;a>=0;a--){let i=r.indexAfter(a);if(r.node(a).canReplaceWith(i,i,n))return r.after(a+1);if(i=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(i==1)f=h.canReplace(u,u,a);else{let m=h.contentMatchAt(u).findWrapping(a.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 kf(t,e,n=e,r=Ie.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return fS(a,i,r)?new $n(e,n,r):new kO(a,i,r).fit()}function fS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class kO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=xe.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=xe.from(e.node(a).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,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new Ie(i,o,c);return e>-1?new Bn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new $n(r.pos,a.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,a=this.unplaced.openEnd;r1&&(a=0),i.type.spec.isolating&&a<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let a,i=null;r?(i=Um(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.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(xe.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=Um(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Ie(e,n+1,Math.max(r,a.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=Um(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new Ie(Ac(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Ie(Ac(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let w=0;w1||u==0||w.content.size)&&(m=v,f.push(pS(w.mark(g.allowedMarks(w.marks)),h==1?u:0,h==c.childCount?y:-1)))}let N=h==c.childCount;N||(y=-1),this.placed=Ic(this.placed,n,xe.from(f)),this.frontier[n].match=m,N&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,v=c;w1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Km(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:i?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=Ic(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let a=e.node(r),i=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,i)}return e}openFrontierNode(e,n=null,r){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=Ic(this.placed,this.depth,xe.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(xe.empty,!0);n.childCount&&(this.placed=Ic(this.placed,this.frontier.length,n))}}function Ac(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ac(t.firstChild.content,e-1,n)))}function Ic(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ic(t.lastChild.content,e-1,n)))}function Um(t,e){for(let n=0;n1&&(r=r.replaceChild(0,pS(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(xe.empty,!0)))),t.copy(r)}function Km(t,e,n,r,a){let i=t.node(e),o=a?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let c=r.fillBefore(i.content,!0,o);return c&&!SO(n,i.content,o)?c:null}function SO(t,e,n){for(let r=n;r0;g--,y--){let N=a.node(g).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(g)>-1?c=g:a.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 N=g.firstChild;if(h.push(N),y==r.openStart)break;g=N.content}for(let g=f-1;g>=0;g--){let y=h[g],N=CO(y.type);if(N&&!y.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(N||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),N=h[y];if(N)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=a.before(y),n=i.after(y))}}function mS(t,e,n,r,a){if(er){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(xe.empty,!0))}return t}function TO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=jO(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Ie(xe.from(r),0,0))}function MO(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=gS(r,a);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),a.indexAfter(c-1))))return t.delete(r.before(c),a.after(c))}for(let o=1;o<=r.depth&&o<=a.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&a.end(o)-n!=a.depth-o&&r.start(o-1)==a.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),a.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function gS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let a=r;a>=0;a--){let i=t.start(a);if(ie.pos+(e.depth-a)||t.node(a).type.spec.isolating||e.node(a).type.spec.isolating)break;(i==e.start(a)||a==t.depth&&a==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&a&&e.start(a-1)==i-1)&&n.push(a)}return n}class bl extends fr{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 jn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return jn.fromReplace(e,this.pos,this.pos+1,new Ie(xe.from(a),0,n.isLeaf?0:1))}getMap(){return Fr.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)}}fr.jsonID("attr",bl);class rd extends fr{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jn.ok(r)}getMap(){return Fr.empty}invert(e){return new rd(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 rd(n.attr,n.value)}}fr.jsonID("docAttr",rd);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 o0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new nd}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 a=kf(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new Ie(xe.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 EO(this,e,n,r),this}replaceRangeWith(e,n,r){return TO(this,e,n,r),this}deleteRange(e,n){return MO(this,e,n),this}lift(e,n){return fO(this,e,n),this}join(e,n=1){return wO(this,e,n),this}wrap(e,n){return gO(this,e,n),this}setBlockType(e,n=e,r,a=null){return xO(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return bO(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new bl(e,n,r)),this}setDocAttribute(e,n){return this.step(new rd(e,n)),this}addNodeMark(e,n){return this.step(new di(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 $t)n.isInSet(r.marks)&&this.step(new bo(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new bo(e,i)),a=i.removeFromSet(a);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return vO(this,e,n,r),this}addMark(e,n,r){return dO(this,e,n,r),this}removeMark(e,n,r){return uO(this,e,n,r),this}clearIncompatible(e,n,r){return a0(this,e,n,r),this}}const qm=Object.create(null);class rt{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new xS(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;i--){let o=n<0?ll(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):ll(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Vr(e.node(0))}static atStart(e){return ll(e,e,0,0,1)||new Vr(e)}static atEnd(e){return ll(e,e,e.content.size,e.childCount,-1)||new Vr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=qm[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 qm)throw new RangeError("Duplicate use of selection JSON ID "+e);return qm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Qe.between(this.$anchor,this.$head).getBookmark()}}rt.prototype.visible=!0;class xS{constructor(e,n){this.$from=e,this.$to=n}}let k1=!1;function S1(t){!k1&&!t.parent.inlineContent&&(k1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Qe extends rt{constructor(e,n=e){S1(e),S1(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 rt.near(r);let a=e.resolve(n.map(this.anchor));return new Qe(a.parent.inlineContent?a: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 Sf(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 a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=rt.findFrom(n,r,!0)||rt.findFrom(n,-r,!0);if(i)n=i.$head;else return rt.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(rt.findFrom(e,-r,!0)||rt.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&Ge.isSelectable(c))return Ge.create(t,n-(a<0?c.nodeSize:0))}else{let u=ll(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function C1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(rt.near(t.doc.resolve(o),n))}const E1=1,Lu=2,T1=4;class IO extends o0{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|=Lu,this}ensureMarks(e){return $t.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&Lu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Lu,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)||$t.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,a.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(rt.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|=T1,this}get scrolledIntoView(){return(this.updated&T1)>0}}function M1(t,e){return!e||!t?t:t.bind(e)}class Rc{constructor(e,n,r){this.name=e,this.init=M1(n.init,r),this.apply=M1(n.apply,r)}}const RO=[new Rc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Rc("selection",{init(t,e){return t.selection||rt.atStart(e.doc)},apply(t){return t.selection}}),new Rc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Rc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Gm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=RO.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 Rc(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 a=e[r],i=a.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(a,this[a.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 a=new Gm(e.schema,e.plugins),i=new gl(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=wa.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=rt.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.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)){i[o.name]=h.fromJSON.call(u,e,n[c],i);return}}i[o.name]=o.init(e,i)}}),i}}function yS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=yS(a,e,{})),n[r]=a}return n}class Kt{constructor(e){this.spec=e,this.props={},e.props&&yS(e.props,this,this.props),this.key=e.key?e.key.key:bS("plugin")}getState(e){return e[this.key]}}const Jm=Object.create(null);function bS(t){return t in Jm?t+"$"+ ++Jm[t]:(Jm[t]=0,t+"$")}class tn{constructor(e="key"){this.key=bS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const c0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function vS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const NS=(t,e,n)=>{let r=vS(t,n);if(!r)return!1;let a=d0(r);if(!a){let o=r.blockRange(),c=o&&Fl(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(AS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(Sl(i,"end")||Ge.isSelectable(i)))for(let o=r.depth;;o--){let c=kf(t.doc,r.before(o),r.after(o),Ie.empty);if(c&&c.slice.size1)break}return i.isAtom&&a.depth==r.depth-1?(e&&e(t.tr.delete(a.pos-i.nodeSize,a.pos).scrollIntoView()),!0):!1},PO=(t,e,n)=>{let r=vS(t,n);if(!r)return!1;let a=d0(r);return a?wS(t,a,e):!1},OO=(t,e,n)=>{let r=kS(t,n);if(!r)return!1;let a=u0(r);return a?wS(t,a,e):!1};function wS(t,e,n){let r=e.nodeBefore,a=r,i=e.pos-1;for(;!a.isTextblock;i--){if(a.type.spec.isolating)return!1;let f=a.lastChild;if(!f)return!1;a=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=kf(t.doc,i,u,Ie.empty);if(!h||h.from!=i||h instanceof $n&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(Qe.create(f.doc,i)),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 jS=(t,e,n)=>{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=d0(r)}let o=i&&i.nodeBefore;return!o||!Ge.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ge.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function d0(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 kS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=kS(t,n);if(!r)return!1;let a=u0(r);if(!a)return!1;let i=a.nodeAfter;if(AS(t,a,e,1))return!0;if(r.parent.content.size==0&&(Sl(i,"start")||Ge.isSelectable(i))){let o=kf(t.doc,r.before(),r.after(),Ie.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)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 Ge,a;if(r){if(n.node.isTextblock||!Ti(t.doc,n.from))return!1;a=n.from}else if(a=jf(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(Ge.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},LO=(t,e)=>{let n=t.selection,r;if(n instanceof Ge){if(n.node.isTextblock||!Ti(t.doc,n.to))return!1;r=n.to}else if(r=jf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},_O=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&Fl(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},ES=(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 h0(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 a=n.node(-1),i=n.indexAfter(-1),o=h0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(rt.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},TS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Vr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=h0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(ja(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Fl(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function FO(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof Ge&&e.selection.node.isBlock)return!r.parentOffset||!ja(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],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=h0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),i.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof Qe||e.selection instanceof Vr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=ja(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=ja(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),N=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const $O=FO(),BO=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(Ge.create(t.doc,a))),!0)};function VO(t,e,n){let r=e.nodeBefore,a=e.nodeAfter,i=e.index();return!r||!a||!r.type.compatibleContent(a.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(a.isTextblock||Ti(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function AS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&VO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let y=e.pos+i.nodeSize,N=xe.empty;for(let k=o.length-1;k>=0;k--)N=xe.from(o[k].create(null,N));N=xe.from(a.copy(N));let w=t.tr.step(new Bn(e.pos-1,y,e.pos,y,new Ie(N,1,0),o.length,!0)),v=w.doc.resolve(y+2*o.length);v.nodeAfter&&v.nodeAfter.type==a.type&&Ti(w.doc,v.pos)&&w.join(v.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:rt.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&Fl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Sl(i,"start",!0)&&Sl(a,"end")){let y=a,N=[];for(;N.push(y),!y.isTextblock;)y=y.lastChild;let w=i,v=1;for(;!w.isTextblock;w=w.firstChild)v++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let k=xe.empty;for(let E=N.length-1;E>=0;E--)k=xe.from(N[E].copy(k));let C=t.tr.step(new Bn(e.pos-N.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new Ie(k,N.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function IS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(Qe.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const HO=IS(-1),WO=IS(1);function UO(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&i0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function A1(t,e=null){return function(n,r){let a=!1;for(let i=0;i{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)a=!0;else{let f=n.doc.resolve(h),m=f.index();a=f.parent.canReplaceWith(m,m+1,t)}})}if(!a)return!1;if(r){let i=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);i=new yh(u,u,e.depth),e.endIndex=0;f--)i=xe.from(n[f].type.create(n[f].attrs,i));t.step(new Bn(e.start-(r?2:0),e.end,e.start,e.end,new Ie(i,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?YO(e,n,t,i):QO(e,n,i):!0:!1}}function YO(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);iw;N--)y-=a.child(N).nodeSize,r.delete(y-1,y+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?xe.empty:xe.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new Bn(m-(c?1:0),g+(u?1:0),m+1,g-1,new Ie((c?xe.empty:xe.from(a.copy(xe.empty))).append(u?xe.empty:xe.from(a.copy(xe.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function XO(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=xe.from(h?t.create():null),m=new Ie(xe.from(t.create(null,xe.from(c.type.create(null,f)))),h?3:1,0),g=i.start,y=i.end;n(e.tr.step(new Bn(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Yn=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 Gg=null;const ya=function(t,e,n){let r=Gg||(Gg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},ZO=function(){Gg=null},vo=function(t,e,n,r){return n&&(I1(t,e,n,r,-1)||I1(t,e,n,r,1))},eD=/^(img|br|input|textarea|hr)$/i;function I1(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:as(t))){let o=t.parentNode;if(!o||o.nodeType!=1||yd(t)||eD.test(t.nodeName)||t.contentEditable=="false")return!1;e=Yn(t)+(a<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(a<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=a;else return!1;else t=o,e=a<0?as(t):0}else return!1}}function as(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function tD(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=as(t)}else if(t.parentNode&&!yd(t))e=Yn(t),t=t.parentNode;else return null}}function nD(t,e){for(;;){if(t.nodeType==3&&e2),ss=El||(Ks?/Mac/.test(Ks.platform):!1),OS=Ks?/Win/.test(Ks.platform):!1,va=/Android \d/.test(Mi),bd=!!R1&&"webkitFontSmoothing"in R1.documentElement.style,iD=bd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function oD(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 fa(t,e){return typeof t=="number"?t:t[e]}function lD(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 P1(t,e,n){let r=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Cl(o);continue}let c=o,u=c==i.body,h=u?oD(i):lD(c),f=0,m=0;if(e.toph.bottom-fa(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+fa(a,"top")-h.top:e.bottom-h.bottom+fa(a,"bottom")),e.lefth.right-fa(r,"right")&&(f=e.right-h.right+fa(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,N=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let w=c.scrollLeft-y,v=c.scrollTop-N;e={left:e.left-w,top:e.top-v,right:e.right-w,bottom:e.bottom-v}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:Cl(o)}}function cD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,a;for(let i=(e.left+e.right)/2,o=n+1;o=n-20){r=c,a=u.top;break}}return{refDOM:r,refTop:a,stack:DS(t.dom)}}function DS(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 dD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;LS(n,r==0?0:r-e)}function LS(t,e){for(let n=0;n=c){o=Math.max(N.bottom,o),c=Math.min(N.top,c);let w=N.left>e.left?N.left-e.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>e.top&&!u&&N.left<=e.left&&N.right>=e.left&&(u=f,h={left:Math.max(N.left,Math.min(N.right,e.left)),top:N.top});!n&&(e.left>=N.right&&e.top>=N.top||e.left>=N.left&&e.top>=N.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?hD(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:_S(n,a)}function hD(t,e){let n=t.nodeValue.length,r=document.createRange(),a;for(let i=0;i=(o.left+o.right)/2?1:0)};break}}return r.detach(),a||{node:t,offset:0}}function p0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function fD(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,a,i)}function mD(t,e,n,r){let a=-1;for(let i=e,o=!1;i!=t.dom;){let c=t.docView.nearestDesc(i,!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?a=c.posBefore:(!o&&u.right-1?a:t.docView.posFromDOM(e,n,-1)}function zS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;bd&&a&&r.nodeType==1&&(h=r.childNodes[a-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&a--,r==t.dom&&a==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(a==0||r.nodeType!=1||r.childNodes[a-1].nodeName!="BR")&&(c=mD(t,r,a,e))}c==null&&(c=pD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function O1(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Cc(ei(ya(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==as(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return Ym(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==as(r))){let u=r.childNodes[a-1],h=u.nodeType==3?ya(u,as(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Cc(ei(h,1),!1)}if(i==null&&a=0)}function Cc(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 Ym(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 $S(t,e,n){let r=t.state,a=t.root.activeElement;r!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),a!=t.dom&&a&&a.focus()}}function yD(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return $S(t,e,()=>{let{node:i}=t.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(i,!0);if(!c)break;if(c.node.isBlock){i=c.contentDOM||c.dom;break}i=c.dom.parentNode}let o=FS(t,a.pos,1);for(let c=i.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=ya(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 bD=/[\u0590-\u08ac]/;function vD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let a=r.parentOffset,i=!a,o=a==r.parent.content.size,c=t.domSelection();return c?!bD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:$S(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:N,focusOffset:w}=t.domSelectionRange(),v=N&&!y.contains(N.nodeType==1?N:N.parentNode)||u==N&&h==w;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),v}):r.pos==r.start()||r.pos==r.end()}let D1=null,L1=null,_1=!1;function ND(t,e,n){return D1==e&&L1==n?_1:(D1=e,L1=n,_1=n=="up"||n=="down"?yD(t,e,n):vD(t,e,n))}const cs=0,z1=1,so=2,qs=3;class vd{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=cs,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;nYn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!1;break}if(i.previousSibling)break}if(a==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!0;break}if(i.nextSibling)break}}return a??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,a=e;a;a=a.parentNode){let i=this.getDesc(a),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}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 a=e;a;a=a.parentNode){let i=this.getDesc(a);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof VS){a=e-i;break}i=c}if(a)return this.children[r].domFromPos(a-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof BS&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Yn(i.dom)+1:0}}else{let i,o=!0;for(;i=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)){a=Yn(g.dom)+1;break}e-=g.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fN&&on){let N=c;c=u,u=N}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,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?so:z1,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=qs:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?so:qs}r=o}this.dirty=so}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?so:z1;n.dirty{if(!i)return a;if(i.parent)return i.parent.posBeforeChild(i)})),!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,i=this}matchesWidget(e){return this.dirty==cs&&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 wD extends vd{constructor(e,n,r,a){super(e,[],n,null),this.textDOM=r,this.text=a}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 No extends vd{constructor(e,n,r,a,i){super(e,[],r,a),this.mark=n,this.spec=i}static create(e,n,r,a){let i=a.nodeViews[n.type.name],o=i&&i(n,a,r);return(!o||!o.dom)&&(o=To.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new No(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&qs||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qs&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=cs){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=Zg(i,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,a),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}=To.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=US(f,r,n),h?u=new jD(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new Ef(e,n,r,a,f,g,i):new gi(e,n,r,a,f,m||null,g,i,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=()=>xe.empty)}return e}matchesNode(e,n,r){return this.dirty==cs&&e.eq(this.node)&&vh(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,a=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,c=i&&i.pos<0,u=new SD(this,o&&o.node,e);TD(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?$t.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==so)&&(o&&this.protectLocalComposition(e,o),HS(this.contentDOM,this.children,e),El&&MD(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof Qe)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=AD(this.node.content,o,r-n,a-n);return c<0?null:{node:i,pos:c,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:a}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new wD(this,i,n,a);e.input.compositionNodes.push(o),this.children=Zg(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==qs||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=cs}updateOuterDeco(e){if(vh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=WS(this.dom,this.nodeDOM,Xg(this.outerDeco,this.node,n),Xg(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 F1(t,e,n,r,a){US(r,e,t);let i=new gi(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class Ef extends gi{constructor(e,n,r,a,i,o,c){super(e,n,r,a,i,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,a){return this.dirty==qs||this.dirty!=cs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=cs||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=cs,!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 a=this.node.cut(e,n),i=document.createTextNode(a.text);return new Ef(this.parent,a,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=qs)}get domAtom(){return!1}isText(e){return this.node.text==e}}class VS extends vd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==cs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class jD extends gi{constructor(e,n,r,a,i,o,c,u,h,f){super(e,n,r,a,i,o,c,h,f),this.spec=u}update(e,n,r,a){if(this.dirty==qs)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,a),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,a){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,a)}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 HS(t,e,n){let r=t.firstChild,a=!1;for(let i=0;i>1,c=Math.min(o,e.length);for(;i-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=No.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,a){let i=-1,o;if(a>=this.preMatch.index&&(o=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=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 No)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(a-1))break;--a,i.set(c,a),o.push(c)}}return{index:a,matched:i,matches:o.reverse()}}function ED(t,e){return t.type.side-e.type.side}function TD(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let N=i+g.nodeSize;if(g.isText){let v=N;o!v.inline):c.slice();r(g,w,e.forChild(i,g),y),i=N}}function MD(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 AD(t,e,n,r){for(let a=0,i=0;a=n){if(i>=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 Zg(t,e,n,r,a){let i=[];for(let o=0,c=0;o=n||f<=e?i.push(u):(hn&&i.push(u.slice(n-h,u.size,r)))}return i}function m0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),i=a&&a.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(Cf(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&Ge.isSelectable(m)&&a.parent&&!(m.isInline&&rD(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new Ge(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!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!KS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function RD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Yn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Ar&&mi<=11&&(n.disabled=!0,n.disabled=!1)}function qS(t,e){if(e instanceof Ge){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(W1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else W1(t)}function W1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function g0(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||Qe.between(e,n,r)}function U1(t){return t.editable&&!t.hasFocus()?!1:GS(t)}function GS(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 PD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return vo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ex(t,e){let{$anchor:n,$head:r}=t.selection,a=e>0?n.max(r):n.min(r),i=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return i&&rt.findFrom(i,e)}function ti(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function K1(t,e,n){let r=t.state.selection;if(r instanceof Qe)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return ti(t,new Qe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=ex(t.state,e);return a&&a instanceof Ge?ti(t,a):!1}else if(!(ss&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ge.isSelectable(i)?ti(t,new Ge(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):bd?ti(t,new Qe(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ge&&r.node.isInline)return ti(t,new Qe(e>0?r.$to:r.$from));{let a=ex(t.state,e);return a?ti(t,a):!1}}}function Nh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Vc(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?OD(t):DD(t)}function OD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(ls&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Vc(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(JS(n))break;{let c=n.previousSibling;for(;c&&Vc(c,-1);)a=n.parentNode,i=Yn(c),c=c.previousSibling;if(c)n=c,r=Nh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?tx(t,n,r):a&&tx(t,a,i)}function DD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=Nh(n),i,o;for(;;)if(r{t.state==a&&ka(t)},50)}function q1(t,e){let n=t.state.doc.resolve(e);if(!(Xn||OS)&&n.parent.inlineContent){let a=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>a.top&&o1)return i.lefta.top&&o1)return i.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function G1(t,e,n){let r=t.state.selection;if(r instanceof Qe&&!r.empty||n.indexOf("s")>-1||ss&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=ex(t.state,e);if(o&&o instanceof Ge)return ti(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Vr?rt.near(o,e):rt.findFrom(o,e);return c?ti(t,c):!1}return!1}function J1(t,e){if(!(t.state.selection instanceof Qe))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Y1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function zD(t){if(!ur||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;Y1(t,r,"true"),setTimeout(()=>Y1(t,r,"false"),20)}return!1}function FD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function $D(t,e){let n=e.keyCode,r=FD(e);if(n==8||ss&&n==72&&r=="c")return J1(t,-1)||ol(t,-1);if(n==46&&!e.shiftKey||ss&&n==68&&r=="c")return J1(t,1)||ol(t,1);if(n==13||n==27)return!0;if(n==37||ss&&n==66&&r=="c"){let a=n==37?q1(t,t.state.selection.from)=="ltr"?-1:1:-1;return K1(t,a,r)||ol(t,a)}else if(n==39||ss&&n==70&&r=="c"){let a=n==39?q1(t,t.state.selection.from)=="ltr"?1:-1:1;return K1(t,a,r)||ol(t,a)}else{if(n==38||ss&&n==80&&r=="c")return G1(t,-1,r)||ol(t,-1);if(n==40||ss&&n==78&&r=="c")return zD(t)||G1(t,1,r)||ol(t,1);if(r==(ss?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function x0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:a,openEnd:i}=e;for(;a>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,i--;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")||To.fromSchema(t.state.schema),c=t2(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=e2[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let N=c.createElement(f[y]);for(;u.firstChild;)N.appendChild(u.firstChild);u.appendChild(N),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` - -`);return{dom:u,text:g,slice:e}}function YS(t,e,n,r,a){let i=a.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,i||r,t)}),i)return c=new Ie(xe.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,r,t));if(m)c=m;else{let g=a.marks(),{schema:y}=t.state,N=To.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let v=o.appendChild(document.createElement("p"));w&&v.appendChild(N.serializeNode(y.text(w,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=WD(n),bd&&UD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||pi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!BD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=KD(Q1(c,+f[1],+f[2]),f[4]);else if(c=Ie.maxOpen(VD(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const BD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function VD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(c=>{if(!o)return;let u=a.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&i.length&&XS(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=ZS(o[o.length-1],i.length));let f=QS(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return xe.from(o)}return t}function QS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,xe.from(t));return t}function XS(t,e,n,r,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(xe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function Q1(t,e,n){return en})),Xm.createHTML(t)):t}function WD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=t2().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&e2[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=HD(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=xe.from(u.create(r[c+1],a)),i++,o++}return new Ie(a,i,o)}const vr={},Nr={},qD={touchstart:!0,touchmove:!0};class GD{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function JD(t){for(let e in vr){let n=vr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{QD(t,r)&&!y0(t,r)&&(t.editable||!(r.type in Nr))&&n(t,r)},qD[e]?{passive:!0}:void 0)}ur&&t.dom.addEventListener("input",()=>null),rx(t)}function ui(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function YD(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function rx(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>y0(t,r))})}function y0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function QD(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function XD(t,e){!y0(t,e)&&vr[e.type]&&(t.editable||!(e.type in Nr))&&vr[e.type](t,e)}Nr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!r2(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(va&&Xn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),El&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",a=>a(t,to(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||$D(t,n)?n.preventDefault():ui(t,"key")};Nr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Nr.keypress=(t,e)=>{let n=e;if(r2(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ss&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Qe)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Tf(t){return{left:t.clientX,top:t.clientY}}function ZD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function b0(t,e,n,r,a){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,c=>o>i.depth?c(t,n,i.nodeAfter,i.before(o),a,!0):c(t,n,i.node(o),i.before(o),a,!1)))return!0;return!1}function vl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function eL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ge.isSelectable(r)?(vl(t,new Ge(n)),!0):!1}function tL(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof Ge&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(Ge.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(vl(t,Ge.create(t.state.doc,a)),!0):!1}function nL(t,e,n,r,a){return b0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?tL(t,n):eL(t,n))}function rL(t,e,n,r){return b0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function sL(t,e,n,r){return b0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||aL(t,n,r)}function aL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(vl(t,Qe.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)vl(t,Qe.create(r,c+1,c+1+o.content.size));else if(Ge.isSelectable(o))vl(t,Ge.create(r,c));else continue;return!0}}function v0(t){return wh(t)}const n2=ss?"metaKey":"ctrlKey";vr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=v0(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&ZD(n,t.input.lastClick)&&!n[n2]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Tf(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new iL(t,o,n,!!r)):(i=="doubleClick"?rL:sL)(t,o.pos,o.inside,n)?n.preventDefault():ui(t,"pointer"))};class iL{constructor(e,n,r,a){this.view=e,this.pos=n,this.event=r,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[n2],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof Ge&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ls&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ui(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ka(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Tf(e))),this.updateAllowDefault(e),this.allowDefault||!n?ui(this.view,"pointer"):nL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ur&&this.mightDrag&&!this.mightDrag.node.isAtom||Xn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(vl(this.view,rt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ui(this.view,"pointer")}move(e){this.updateAllowDefault(e),ui(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}vr.touchstart=t=>{t.input.lastTouch=Date.now(),v0(t),ui(t,"pointer")};vr.touchmove=t=>{t.input.lastTouch=Date.now(),ui(t,"pointer")};vr.contextmenu=t=>v0(t);function r2(t,e){return t.composing?!0:ur&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const oL=va?5e3:-1;Nr.compositionstart=Nr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Qe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Xn&&OS&&lL(t)))t.markCursor=t.state.storedMarks||n.marks(),wh(t,!0),t.markCursor=null;else if(wh(t,!e.selection.empty),ls&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let a=r.focusNode,i=r.focusOffset;a&&a.nodeType==1&&i!=0;){let o=i<0?a.lastChild:a.childNodes[i-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else a=o,i=-1}}t.input.composing=!0}s2(t,oL)};function lL(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Nr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,s2(t,20))};function s2(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>wh(t),e))}function a2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=dL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function cL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=tD(e.focusNode,e.focusOffset),r=nD(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let a=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!a||!a.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function dL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function wh(t,e=!1){if(!(va&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),a2(t),e||t.docView&&t.docView.dirty){let n=m0(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function uL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),a=document.createRange();a.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const sd=Ar&&mi<15||El&&iD<604;vr.copy=Nr.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=sd?null:n.clipboardData,o=r.content(),{dom:c,text:u}=x0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):uL(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function hL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function fL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ad(t,r.value,null,a,e):ad(t,r.textContent,r.innerHTML,a,e)},50)}function ad(t,e,n,r,a){let i=YS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||Ie.empty)))return!0;if(!i)return!1;let o=hL(i),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function i2(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Nr.paste=(t,e)=>{let n=e;if(t.composing&&!va)return;let r=sd?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ad(t,i2(r),r.getData("text/html"),a,n)?n.preventDefault():fL(t,n)};class o2{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const pL=ss?"altKey":"ctrlKey";function l2(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[pL]}vr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let a=t.state.selection,i=a.empty?null:t.posAtCoords(Tf(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof Ge?a.to-1:a.to))){if(r&&r.mightDrag)o=Ge.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Ge.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=x0(t,c);(!n.dataTransfer.files.length||!Xn||PS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(sd?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",sd||n.dataTransfer.setData("text/plain",h),t.dragging=new o2(f,l2(t,n),o)};vr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Nr.dragover=Nr.dragenter=(t,e)=>e.preventDefault();Nr.drop=(t,e)=>{try{mL(t,e,t.dragging)}finally{t.dragging=null}};function mL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Tf(e));if(!r)return;let a=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=YS(t,i2(e.dataTransfer),sd?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&l2(t,e));if(t.someProp("handleDrop",y=>y(t,e,i||Ie.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?hS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&Ge.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new Ge(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((N,w,v,k)=>y=k),u.setSelection(g0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}vr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&ka(t)},20))};vr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};vr.beforeinput=(t,e)=>{if(Xn&&va&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,to(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in Nr)vr[t]=Nr[t];function id(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class jh{constructor(e,n){this.toDOM=e,this.spec=n||ho,this.side=this.spec.side||0}map(e,n,r,a){let{pos:i,deleted:o}=e.mapResult(n.from+a,this.side<0?-1:1);return o?null:new Mn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof jh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&id(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xi{constructor(e,n){this.attrs=e,this.spec=n||ho}map(e,n,r,a){let i=e.map(n.from+a,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+a,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Mn(i,o,this)}valid(e,n){return n.from=e&&(!i||i(c.spec))&&r.push(c.copy(c.from+a,c.to+a))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,a+c,i)}}map(e,n,r){return this==ar||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ho)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=d2(n,c,h)){for(a||(a=this.children.slice());ic&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let i=e+1,o=i+n.content.size;for(let c=0;ci&&u.type instanceof xi){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,ho));return si.from(r)}forChild(e,n){if(n.isLeaf)return zt.empty;let r=[];for(let a=0;an instanceof zt)?e:e.reduce((n,r)=>n.concat(r instanceof zt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let v=w-N-(y-g);for(let k=0;kC+f-m)continue;let E=c[k]+f-m;y>=E?c[k+1]=g<=E?-2:-1:g>=f&&v&&(c[k]+=v,c[k+1]+=v)}m+=v}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),y=g-a,{index:N,offset:w}=r.content.findIndex(m),v=r.maybeChild(N);if(v&&w==m&&w+v.nodeSize==y){let k=c[h+2].mapInner(n,v,f+1,t[h]+i+1,o);k!=ar?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=xL(c,t,e,n,a,i,o),f=kh(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=d2(t,c,u+n);if(h){i=!0;let f=kh(h,c,n+u+1,r);f!=ar&&a.push(u,u+c.nodeSize,f)}});let o=c2(i?u2(t):t,-n).sort(fo);for(let c=0;c0;)e++;t.splice(e,0,n)}function Zm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ar&&e.push(r)}),t.cursorWrapper&&e.push(zt.create(t.state.doc,[t.cursorWrapper.deco])),si.from(e)}const yL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bL=Ar&&mi<=11;class vL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class NL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new vL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():ur&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(U1(this.view)){if(this.suppressingSelectionUpdates)return ka(this.view);if(Ar&&mi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&vo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Cl(i))n.add(i);for(let i=e.anchorNode;i;i=Cl(i))if(n.has(i)){r=i;break}let a=r&&this.view.docView.nearestDesc(r);if(a&&a.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&U1(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(ls&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||kL(e,m)!=y)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),wL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,SL(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ka(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;v--){let k=r.childNodes[v-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){i=v;break}if(!C||C.size)break}let m=t.state.doc,g=t.someProp("domParser")||pi.fromSchema(t.state.schema),y=m.resolve(o),N=null,w=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:a,to:i,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:EL,context:y});if(h&&h[0].pos!=null){let v=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=v),N={anchor:v+o,head:k+o}}return{doc:w,sel:N,from:o,to:c}}function EL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ur&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||ur&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const TL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function ML(t,e,n,r,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let _=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=m0(t,_);if(P&&!t.state.selection.eq(P)){if(Xn&&va&&t.input.lastKeyCode===13&&Date.now()-100F(t,to(13,"Enter"))))return;let L=t.state.tr.setSelection(P);_=="pointer"?L.setMeta("pointer",!0):_=="key"&&L.scrollIntoView(),i&&L.setMeta("composition",i),t.dispatch(L)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=CL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||va)&&a.some(_=>_.nodeType==1&&!TL.test(_.nodeName))&&(!N||N.endA>=N.endB)&&t.someProp("handleKeyDown",_=>_(t,to(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!N)if(r&&u instanceof Qe&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))N={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let _=rN(t,t.state.doc,h.sel);if(_&&!_.eq(t.state.selection)){let P=t.state.tr.setSelection(_);i&&P.setMeta("composition",i),t.dispatch(P)}}return}t.state.selection.fromt.state.selection.from&&N.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?N.start=t.state.selection.from:N.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(N.endB+=t.state.selection.to-N.endA,N.endA=t.state.selection.to)),Ar&&mi<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>h.from&&h.doc.textBetween(N.start-h.from-1,N.start-h.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let w=h.doc.resolveNoCache(N.start-h.from),v=h.doc.resolveNoCache(N.endB-h.from),k=f.resolve(N.start),C=w.sameParent(v)&&w.parent.inlineContent&&k.end()>=N.endA;if((El&&t.input.lastIOSEnter>Date.now()-225&&(!C||a.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!C&&w.pos_(t,to(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>N.start&&IL(f,N.start,N.endA,w,v)&&t.someProp("handleKeyDown",_=>_(t,to(8,"Backspace")))){va&&Xn&&t.domObserver.suppressSelectionUpdates();return}Xn&&N.endB==N.start&&(t.input.lastChromeDelete=Date.now()),va&&!C&&w.start()!=v.start()&&v.parentOffset==0&&w.depth==v.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==N.endA&&(N.endB-=2,v=h.doc.resolveNoCache(N.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(_){return _(t,to(13,"Enter"))})},20));let E=N.start,T=N.endA,R=_=>{let P=_||t.state.tr.replace(E,T,h.doc.slice(N.start-h.from,N.endB-h.from));if(h.sel){let L=rN(t,P.doc,h.sel);L&&!(Xn&&t.composing&&L.empty&&(N.start!=N.endB||t.input.lastChromeDeleteka(t),20));let _=R(t.state.tr.delete(E,T)),P=f.resolve(N.start).marksAcross(f.resolve(N.endA));P&&_.ensureMarks(P),t.dispatch(_)}else if(N.endA==N.endB&&(D=AL(w.parent.content.cut(w.parentOffset,v.parentOffset),k.parent.content.cut(k.parentOffset,N.endA-k.start())))){let _=R(t.state.tr);D.type=="add"?_.addMark(E,T,D.mark):_.removeMark(E,T,D.mark),t.dispatch(_)}else if(w.parent.child(w.index()).isText&&w.index()==v.index()-(v.textOffset?0:1)){let _=w.parent.textBetween(w.parentOffset,v.parentOffset),P=()=>R(t.state.tr.insertText(_,E,T));t.someProp("handleTextInput",L=>L(t,E,T,_,P))||t.dispatch(P())}else t.dispatch(R());else t.dispatch(R())}function rN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:g0(t,e.resolve(n.anchor),e.resolve(n.head))}function AL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,a=n,i=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(a.length==0&&i.length==1)c=i[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||eg(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,a++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,a++}return a}function RL(t,e,n,r,a){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let u=Math.max(0,i-Math.min(o,c));r-=o+u-i}if(o=o?i-r:0;i-=u,i&&i=c?i-r:0;i-=u,i&&i=56320&&e<=57343&&n>=55296&&n<=56319}class h2{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new GD,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(cN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=oN(this),iN(this),this.nodeViews=lN(this),this.docView=F1(this.state.doc,aN(this),Zm(this),this.dom,this),this.domObserver=new NL(this,(r,a,i,o)=>ML(this,r,a,i,o)),this.domObserver.start(),JD(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&rx(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(cN),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let a=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(a2(this),o=!0),this.state=e;let c=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=lN(this);OL(y,this.nodeViews)&&(this.nodeViews=y,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&rx(this),this.editable=oN(this),iN(this);let u=Zm(this),h=aN(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&cD(this);if(o){this.domObserver.stop();let y=m&&(Ar||Xn)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&PL(a.selection,e.selection);if(m){let N=Xn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=cL(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=F1(e.doc,h,u,this.dom,this)),N&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&PD(this))?ka(this,y):(qS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&dD(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ge){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&P1(this,n.getBoundingClientRect(),e)}else P1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(i))==r.node&&(a=i)}this.dragging=new o2(e.slice,e.move,a<0?void 0:Ge.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return gD(this,e)}coordsAtPos(e,n=1){return FS(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let a=this.docView.posFromDOM(e,n,r);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,n){return ND(this,n||this.state,e)}pasteHTML(e,n){return ad(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ad(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return x0(this,e)}destroy(){this.docView&&(YD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Zm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ZO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return XD(this,e)}domSelectionRange(){let e=this.domSelection();return e?ur&&this.root.nodeType===11&&sD(this.dom.ownerDocument)==this.dom&&jL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}h2.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function aN(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Mn.node(0,t.state.doc.content.size,e)]}function iN(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Mn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function oN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function PL(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function lN(t){let e=Object.create(null);function n(r){for(let a in r)Object.prototype.hasOwnProperty.call(e,a)||(e[a]=r[a])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function OL(t,e){let n=0,r=0;for(let a in t){if(t[a]!=e[a])return!0;n++}for(let a in e)r++;return n!=r}function cN(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var vi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Sh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},DL=typeof navigator<"u"&&/Mac/.test(navigator.platform),LL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Qn=0;Qn<10;Qn++)vi[48+Qn]=vi[96+Qn]=String(Qn);for(var Qn=1;Qn<=24;Qn++)vi[Qn+111]="F"+Qn;for(var Qn=65;Qn<=90;Qn++)vi[Qn]=String.fromCharCode(Qn+32),Sh[Qn]=String.fromCharCode(Qn);for(var tg in vi)Sh.hasOwnProperty(tg)||(Sh[tg]=vi[tg]);function _L(t){var e=DL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||LL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Sh:vi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const zL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),FL=typeof navigator<"u"&&/Win/.test(navigator.platform);function $L(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,a,i,o;for(let c=0;c{for(var n in e)HL(t,n,{get:e[n],enumerable:!0})};function Mf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:a}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return a},get tr(){return r=n.selection,a=n.doc,i=n.storedMarks,n}}}var Af=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...N)=>{const w=this.buildProps(u,e),v=g(...N)(w);return o.push(v),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,i=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Mf({state:a,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},f2={};k0(f2,{blur:()=>WL,clearContent:()=>UL,clearNodes:()=>KL,command:()=>qL,createParagraphNear:()=>GL,cut:()=>JL,deleteCurrentNode:()=>YL,deleteNode:()=>QL,deleteRange:()=>XL,deleteSelection:()=>ZL,enter:()=>e8,exitCode:()=>t8,extendMarkRange:()=>n8,first:()=>r8,focus:()=>a8,forEach:()=>i8,insertContent:()=>o8,insertContentAt:()=>d8,joinBackward:()=>f8,joinDown:()=>h8,joinForward:()=>p8,joinItemBackward:()=>m8,joinItemForward:()=>g8,joinTextblockBackward:()=>x8,joinTextblockForward:()=>y8,joinUp:()=>u8,keyboardShortcut:()=>v8,lift:()=>N8,liftEmptyBlock:()=>w8,liftListItem:()=>j8,newlineInCode:()=>k8,resetAttributes:()=>S8,scrollIntoView:()=>C8,selectAll:()=>E8,selectNodeBackward:()=>T8,selectNodeForward:()=>M8,selectParentNode:()=>A8,selectTextblockEnd:()=>I8,selectTextblockStart:()=>R8,setContent:()=>P8,setMark:()=>Z8,setMeta:()=>e6,setNode:()=>t6,setNodeSelection:()=>n6,setTextDirection:()=>r6,setTextSelection:()=>s6,sinkListItem:()=>a6,splitBlock:()=>i6,splitListItem:()=>o6,toggleList:()=>l6,toggleMark:()=>c6,toggleNode:()=>d6,toggleWrap:()=>u6,undoInputRule:()=>h6,unsetAllMarks:()=>f6,unsetMark:()=>p6,unsetTextDirection:()=>m6,updateAttributes:()=>g6,wrapIn:()=>x6,wrapInList:()=>y6});var WL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),UL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),KL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const N=Fl(y);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,w)}(N||N===0)&&e.lift(y,N)})}),!0},qL=t=>e=>t(e),GL=()=>({state:t,dispatch:e})=>TS(t,e),JL=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Qe(r.doc.resolve(Math.max(o-1,0)))),!0},YL=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===r.type){if(e){const c=a.before(i),u=a.after(i);t.delete(c,u).scrollIntoView()}return!0}return!1};function kn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var QL=t=>({tr:e,state:n,dispatch:r})=>{const a=kn(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===a){if(r){const u=i.before(o),h=i.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},XL=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},ZL=()=>({state:t,dispatch:e})=>c0(t,e),e8=()=>({commands:t})=>t.keyboardShortcut("Enter"),t8=()=>({state:t,dispatch:e})=>zO(t,e);function S0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ch(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:S0(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function p2(t,e,n={}){return t.find(r=>r.type===e&&Ch(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function dN(t,e,n={}){return!!p2(t,e,n)}function C0(t,e,n){var r;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(f=>f.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(f=>f.type===e)||(n=n||((r=a.node.marks[0])==null?void 0:r.attrs),!p2([...a.node.marks],e,n)))return;let o=a.index,c=t.start()+a.offset,u=o+1,h=c+a.node.nodeSize;for(;o>0&&dN([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:a})=>{const i=Ta(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=C0(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=Qe.create(o,m.from,m.to);n.setSelection(g)}}return!0},r8=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:a,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Eh()||uN())&&r.dom.focus(),s8()&&!Eh()&&!uN()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!m2(n.state.selection))return o(),!0;const c=g2(a.doc,t)||n.state.selection,u=n.state.selection.eq(c);return i&&(u||a.setSelection(c),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),o()),!0},i8=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),o8=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),x2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&x2(r)}return t};function _u(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return x2(n)}function od(t,e,n){if(t instanceof wa||t instanceof xe)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return xe.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),od("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new tS({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?pi.fromSchema(u).parseSlice(_u(t),n.parseOptions):pi.fromSchema(u).parse(_u(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=pi.fromSchema(e);return n.slice?i.parseSlice(_u(t),n.parseOptions).content:i.parse(_u(t),n.parseOptions)}return od("",e,n)}function l8(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(rt.near(t.doc.resolve(o),n))}var c8=t=>!("type"in t),d8=(t,e,n)=>({tr:r,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{od(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(v){u(v)}try{c=od(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((c8(c)?c:[c]).forEach(v=>{v.check(),g=g?v.isText&&v.marks.length===0:!1,y=y?v.isBlock:!1}),f===m&&y){const{parent:v}=r.doc.resolve(f);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(f-=1,m+=1)}let w;if(g){if(Array.isArray(e))w=e.map(v=>v.text||"").join("");else if(e instanceof xe){let v="";e.forEach(k=>{k.text&&(v+=k.text)}),w=v}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,f,m)}else{w=c;const v=r.doc.resolve(f),k=v.node(),C=v.parentOffset===0,E=k.isText||k.isTextblock,T=k.content.size>0;C&&E&&T&&(f=Math.max(0,f-1)),r.replaceWith(f,m,w)}n.updateSelection&&l8(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:w})}return!0},u8=()=>({state:t,dispatch:e})=>DO(t,e),h8=()=>({state:t,dispatch:e})=>LO(t,e),f8=()=>({state:t,dispatch:e})=>NS(t,e),p8=()=>({state:t,dispatch:e})=>SS(t,e),m8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=jf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},g8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=jf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},x8=()=>({state:t,dispatch:e})=>PO(t,e),y8=()=>({state:t,dispatch:e})=>OO(t,e);function y2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function b8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,a,i,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:a})=>{const i=b8(t).split(/-(?!$)/),o=i.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&a&&r.maybeStep(f)}),!0};function Ni(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?kn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),N=Math.min(a,g+m.nodeSize);c.push({node:m,from:y,to:N})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Ch(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var N8=(t,e={})=>({state:n,dispatch:r})=>{const a=kn(t,n.schema);return Ni(n,a,e)?_O(n,r):!1},w8=()=>({state:t,dispatch:e})=>MS(t,e),j8=t=>({state:e,dispatch:n})=>{const r=kn(t,e.schema);return JO(r)(e,n)},k8=()=>({state:t,dispatch:e})=>ES(t,e);function If(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function hN(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,a)=>(n.includes(a)||(r[a]=t[a]),r),{})}var S8=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=If(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=kn(t,r.schema)),c==="mark"&&(o=Ta(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{i&&i===f.type&&(u=!0,a&&n.setNodeMarkup(m,void 0,hN(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(hN(g.attrs,e))))})})}),u},C8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),E8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Vr(t.doc);t.setSelection(n)}return!0},T8=()=>({state:t,dispatch:e})=>jS(t,e),M8=()=>({state:t,dispatch:e})=>CS(t,e),A8=()=>({state:t,dispatch:e})=>BO(t,e),I8=()=>({state:t,dispatch:e})=>WO(t,e),R8=()=>({state:t,dispatch:e})=>HO(t,e);function sx(t,e,n={},r={}){return od(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var P8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:a,tr:i,dispatch:o,commands:c})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const h=sx(t,a.schema,r,{errorOnInvalidContent:e??a.options.enableContentCheck});return o&&i.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??a.options.enableContentCheck})};function b2(t,e){const n=Ta(e,t.schema),{from:r,to:a,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,a,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function v2(t,e){const n=new o0(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function O8(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function N2(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Rf(t){return e=>N2(e.$from,t)}function We(t,e,n){return t.config[e]===void 0&&t.parent?We(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?We(t.parent,e,n):null}):t.config[e]}function E0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=We(e,"addExtensions",n);return r?[e,...E0(r())]:e}).flat(10)}function T0(t,e){const n=To.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function w2(t){return typeof t=="function"}function jt(t,e=void 0,...n){return w2(t)?e?t.bind(e)(...n):t(...n):t}function L8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Tl(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),r=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function j2(t){const e=[],{nodeExtensions:n,markExtensions:r}=Tl(t),a=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:a},m=We(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let N;Array.isArray(y.types)?N=y.types:y.types==="*"?N=u:y.types==="nodes"?N=o:y.types==="marks"?N=c:N=[],N.forEach(w=>{Object.entries(y.attributes).forEach(([v,k])=>{e.push({type:w,name:v,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=We(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,N])=>{const w={...i,...N};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:h.name,name:y,attribute:w})})}),e}function _8(t){const e=[];let n="",r=!1,a=!1,i=0;const o=t.length;for(let c=0;c0){i-=1,n+=u;continue}if(u===";"&&i===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function fN(t){const e=[],n=_8(t||""),r=n.length;for(let a=0;a!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([a,i])=>{if(!r[a]){r[a]=i;return}if(a==="class"){const c=i?String(i).split(" "):[],u=r[a]?r[a].split(" "):[],h=c.filter(f=>!u.includes(f));r[a]=[...u,...h].join(" ")}else if(a==="style"){const c=new Map([...fN(r[a]),...fN(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function ld(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>kt(n,r),{})}function z8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function pN(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const a=e.reduce((i,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):z8(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function mN(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&L8(n)?!1:n!=null))}function gN(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function F8(t,e){var n;const r=j2(t),{nodeExtensions:a,markExtensions:i}=Tl(t),o=(n=a.find(h=>We(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(a.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,C)=>{const E=We(C,"extendNodeSchema",m);return{...k,...E?E(h):{}}},{}),y=mN({...g,content:jt(We(h,"content",m)),marks:jt(We(h,"marks",m)),group:jt(We(h,"group",m)),inline:jt(We(h,"inline",m)),atom:jt(We(h,"atom",m)),selectable:jt(We(h,"selectable",m)),draggable:jt(We(h,"draggable",m)),code:jt(We(h,"code",m)),whitespace:jt(We(h,"whitespace",m)),linebreakReplacement:jt(We(h,"linebreakReplacement",m)),defining:jt(We(h,"defining",m)),isolating:jt(We(h,"isolating",m)),attrs:Object.fromEntries(f.map(gN))}),N=jt(We(h,"parseHTML",m));N&&(y.parseDOM=N.map(k=>pN(k,f)));const w=We(h,"renderHTML",m);w&&(y.toDOM=k=>w({node:k,HTMLAttributes:ld(k,f)}));const v=We(h,"renderText",m);return v&&(y.toText=v),[h.name,y]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(v=>v.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((v,k)=>{const C=We(k,"extendMarkSchema",m);return{...v,...C?C(h):{}}},{}),y=mN({...g,inclusive:jt(We(h,"inclusive",m)),excludes:jt(We(h,"excludes",m)),group:jt(We(h,"group",m)),spanning:jt(We(h,"spanning",m)),code:jt(We(h,"code",m)),attrs:Object.fromEntries(f.map(gN))}),N=jt(We(h,"parseHTML",m));N&&(y.parseDOM=N.map(v=>pN(v,f)));const w=We(h,"renderHTML",m);return w&&(y.toDOM=v=>w({mark:v,HTMLAttributes:ld(v,f)})),[h.name,y]}));return new tS({topNode:o,nodes:c,marks:u})}function $8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Hc(t){return t.sort((n,r)=>{const a=We(n,"priority")||100,i=We(r,"priority")||100;return a>i?-1:ar.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function S2(t,e,n){const{from:r,to:a}=e,{blockSeparator:i=` - -`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,a,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=i);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,a-h))}),c}function B8(t,e){const n={from:0,to:t.content.size};return S2(t,n,e)}function C2(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function V8(t,e){const n=kn(e,t.schema),{from:r,to:a}=t.selection,i=[];t.doc.nodesBetween(r,a,c=>{i.push(c)});const o=i.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function E2(t,e){const n=If(typeof e=="string"?e:e.name,t.schema);return n==="node"?V8(t,e):n==="mark"?b2(t,e):{}}function H8(t,e=JSON.stringify){const n={};return t.filter(r=>{const a=e(r);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function W8(t){const e=H8(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function T2(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((a,i)=>{const o=[];if(a.ranges.length)a.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[i];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(i).map(c,-1),f=e.slice(i).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),W8(r)}function M0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=C0(i,a.type);o&&r.push({mark:a,...o})}):n.nodesBetween(t,e,(a,i)=>{!a||(a==null?void 0:a.nodeSize)===void 0||r.push(...a.marks.map(o=>({from:i,to:i+a.nodeSize,mark:o})))}),r}var U8=(t,e,n,r=20)=>{const a=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const c=a.node(i);(c==null?void 0:c.type.name)===e?o=c:i-=1}return[o,i]};function Ec(t,e){return e.nodes[t]||e.marks[t]||null}function th(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const a=t.find(i=>i.type===e&&i.name===r);return a?a.attribute.keepOnSplit:!1}))}var K8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(a,i,o,c)=>{var u,h;const f=((h=(u=a.type.spec).toText)==null?void 0:h.call(u,{node:a,pos:i,parent:o,index:c}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?f:f.slice(0,Math.max(0,r-i))}),n};function ax(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?Ta(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Ch(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const y=m.pos,N=g.pos;t.doc.nodesBetween(y,N,(w,v)=>{if(i&&w.inlineContent&&!w.type.allowsMarkType(i))return!1;if(!w.isText&&!w.marks.length)return;const k=Math.max(y,v),C=Math.min(N,v+w.nodeSize),E=C-k;o+=E,c.push(...w.marks.map(T=>({mark:T,from:k,to:C})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Ch(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function q8(t,e,n={}){if(!e)return Ni(t,null,n)||ax(t,null,n);const r=If(e,t.schema);return r==="node"?Ni(t,e,n):r==="mark"?ax(t,e,n):!1}var G8=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=Rf(c=>c.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return a.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function xN(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function yN(t,e){const{nodeExtensions:n}=Tl(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=jt(We(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Pf(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let a=!0;return t.content.forEach(i=>{a!==!1&&(Pf(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function M2(t){return t instanceof Ge}var A2=class I2{constructor(e){this.position=e}static fromJSON(e){return new I2(e.position)}toJSON(){return{position:this.position}}};function Y8(t,e){const n=e.mapping.mapResult(t.position);return{position:new A2(n.pos),mapResult:n}}function Q8(t){return new A2(t)}function X8(t,e,n){var r;const{selection:a}=e;let i=null;if(m2(a)&&(i=a.$cursor),i){const c=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=a;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),N=!!n.isInSet(f.marks)||!f.marks.some(w=>w.type.excludes(n));h=y&&N}return!h}),h})}var Z8=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=Ta(t,r.schema);if(a)if(o){const h=b2(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,y)=>{const N=Math.max(y,f),w=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(N,w,u.create({...k.attrs,...e}))}):n.addMark(N,w,u.create(e))})});return X8(r,n,u)},e6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),t6=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=kn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?a().command(({commands:c})=>A1(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>A1(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},n6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=io(t,0,r.content.size),i=Ge.create(r,a);e.setSelection(i)}return!0},r6=(t,e)=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=i.from,c=i.to),a&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},s6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Qe.atStart(r).from,c=Qe.atEnd(r).to,u=io(a,o,c),h=io(i,o,c),f=Qe.create(r,u,h);e.setSelection(f)}return!0},a6=t=>({state:e,dispatch:n})=>{const r=kn(t,e.schema);return XO(r)(e,n)};function bN(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(a=>e==null?void 0:e.includes(a.type.name));t.tr.ensureMarks(r)}}var i6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:a})=>{const{selection:i,doc:o}=e,{$from:c,$to:u}=i,h=a.extensionManager.attributes,f=th(h,c.node().type.name,c.node().attrs);if(i instanceof Ge&&i.node.isBlock)return!c.parentOffset||!ja(o,c.pos)?!1:(r&&(t&&bN(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:O8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,N=ja(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!N&&ja(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(N=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(N&&(i instanceof Qe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const w=e.mapping.map(c.before()),v=e.doc.resolve(w);c.node(-1).canReplaceWith(v.index(),v.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&bN(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return N},o6=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=kn(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let k=xe.empty;const C=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-C;P>=u.depth-3;P-=1)k=xe.from(u.node(P).copy(k));const E=u.indexAfter(-1){if(_>-1)return!1;P.isTextblock&&P.content.size===0&&(_=L+1)}),_>-1&&n.setSelection(Qe.near(n.doc.resolve(_))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,N={...th(g,m.type.name,m.attrs),...e},w={...th(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const v=y?[{type:c,attrs:N},{type:y,attrs:w}]:[{type:c,attrs:N}];if(!ja(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:C}=r,{splittableMarks:E}=i.extensionManager,T=C||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!T||!a)return!0;const R=T.filter(D=>E.includes(D.type.name));n.ensureMarks(R)}return!0},rg=(t,e)=>{const n=Rf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===(a==null?void 0:a.type)&&Ti(t.doc,n.pos)&&t.join(n.pos),!0},sg=(t,e)=>{const n=Rf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===(a==null?void 0:a.type)&&Ti(t.doc,r)&&t.join(r),!0},l6=(t,e,n,r={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=a.extensionManager,y=kn(t,o.schema),N=kn(e,o.schema),{selection:w,storedMarks:v}=o,{$from:k,$to:C}=w,E=k.blockRange(C),T=v||w.$to.parentOffset&&w.$from.marks();if(!E)return!1;const R=Rf(D=>yN(D.type.name,m))(w);if(E.depth>=1&&R&&E.depth-R.depth<=1){if(R.node.type===y)return h.liftListItem(N);if(yN(R.node.type.name,m)&&y.validContent(R.node.content)&&c)return u().command(()=>(i.setNodeMarkup(R.pos,y),!0)).command(()=>rg(i,y)).command(()=>sg(i,y)).run()}return!n||!T||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>rg(i,y)).command(()=>sg(i,y)).run():u().command(()=>{const D=f().wrapInList(y,r),_=T.filter(P=>g.includes(P.type.name));return i.ensureMarks(_),D?!0:h.clearNodes()}).wrapInList(y,r).command(()=>rg(i,y)).command(()=>sg(i,y)).run()},c6=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ta(t,r.schema);return ax(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},d6=(t,e,n={})=>({state:r,commands:a})=>{const i=kn(t,r.schema),o=kn(e,r.schema),c=Ni(r,i,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?a.setNode(o,u):a.setNode(i,{...u,...n})},u6=(t,e={})=>({state:n,commands:r})=>{const a=kn(t,n.schema);return Ni(n,a,e)?r.lift(a):r.wrapIn(a,e)},h6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(i.text){const u=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else o.delete(i.from,i.to)}return!0}}return!1},f6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:a}=n;return r||e&&a.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},p6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=Ta(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:y}=c;const N=(i=h.marks().find(v=>v.type===u))==null?void 0:i.attrs,w=C0(h,u,N);w&&(g=w.from,y=w.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},m6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:a}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=a.from,o=a.to),r&&e.doc.nodesBetween(i,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},g6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=If(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=kn(t,r.schema)),c==="mark"&&(o=Ta(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,N,w;n.selection.empty?r.doc.nodesBetween(f,m,(v,k)=>{i&&i===v.type&&(u=!0,N=Math.max(k,f),w=Math.min(k+v.nodeSize,m),g=k,y=v)}):r.doc.nodesBetween(f,m,(v,k)=>{k=f&&k<=m&&(i&&i===v.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(C=>{if(o===C.type&&(u=!0,a)){const E=Math.max(k,f),T=Math.min(k+v.nodeSize,m);n.addMark(E,T,o.create({...C.attrs,...e}))}}))}),y&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(v=>{o===v.type&&a&&n.addMark(N,w,o.create({...v.attrs,...e}))}))}),u},x6=(t,e={})=>({state:n,dispatch:r})=>{const a=kn(t,n.schema);return UO(a,e)(n,r)},y6=(t,e={})=>({state:n,dispatch:r})=>{const a=kn(t,n.schema);return KO(a,e)(n,r)},b6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Of=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},v6=(t,e)=>{if(S0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function zu(t){var e;const{editor:n,from:r,to:a,text:i,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=K8(h)+i;return o.forEach(g=>{if(f)return;const y=v6(m,g.find);if(!y)return;const N=u.state.tr,w=Mf({state:u.state,transaction:N}),v={from:r-(y[0].length-i.length),to:a},{commands:k,chain:C,can:E}=new Af({editor:n,state:w});g.handler({state:w,range:v,match:y,commands:k,chain:C,can:E})===null||!N.steps.length||(g.undoable&&N.setMeta(c,{transform:N,from:r,to:a,text:i}),u.dispatch(N),f=!0)}),f}function N6(t){const{editor:e,rules:n}=t,r=new Kt({state:{init(){return null},apply(a,i,o){const c=a.getMeta(r);if(c)return c;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=T0(xe.from(f),o.schema);const{from:m}=u,g=m+f.length;zu({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return zu({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&zu({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(a,i){if(i.key!=="Enter")return!1;const{$cursor:o}=a.state.selection;return o?zu({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function w6(t){return Object.prototype.toString.call(t).slice(8,-1)}function Fu(t){return w6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function R2(t,e){const n={...t};return Fu(t)&&Fu(e)&&Object.keys(e).forEach(r=>{Fu(e[r])&&Fu(t[r])?n[r]=R2(t[r],e[r]):n[r]=e[r]}),n}var A0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...jt(We(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...jt(We(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>R2(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Mo=class P2 extends A0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new P2(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const o=a.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",a.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function j6(t){return typeof t=="number"}var k6=class{constructor(t){this.find=t.find,this.handler=t.handler}},S6=(t,e,n)=>{if(S0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(a=>{const i=[a.text];return i.index=a.index,i.input=t,i.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(a.replaceWith)),i}):[]};function C6(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Af({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(y,N)=>{var w,v,k,C,E;if((v=(w=y.type)==null?void 0:w.spec)!=null&&v.code||!(y.isText||y.isTextblock||y.isInline))return;const T=(E=(C=(k=y.content)==null?void 0:k.size)!=null?C:y.nodeSize)!=null?E:0,R=Math.max(r,N),D=Math.min(a,N+T);if(R>=D)return;const _=y.isText?y.text||"":y.textBetween(R-N,D-N,void 0,"");S6(_,i.find,o).forEach(L=>{if(L.index===void 0)return;const F=R+L.index+1,X=F+L[0].length,te={from:n.tr.mapping.map(F),to:n.tr.mapping.map(X)},ue=i.handler({state:n,range:te,match:L,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(ue)})}),m.every(y=>y!==null)}var $u=null,E6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function T6(t){const{editor:e,rules:n}=t;let r=null,a=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:N})=>{const w=f.tr,v=Mf({state:f,transaction:w});if(!(!C6({editor:e,state:v,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:N,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(f=>new Kt({view(m){const g=N=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(N.target)?m.dom.parentElement:null,r&&($u=e)},y=()=>{$u&&($u=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=r===m.dom.parentElement,c=g,!i){const y=$u;y!=null&&y.isEditable&&setTimeout(()=>{const N=y.state.selection;N&&y.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(m,g)=>{var y;const N=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const N=m[0],w=N.getMeta("uiEvent")==="paste"&&!a,v=N.getMeta("uiEvent")==="drop"&&!i,k=N.getMeta("applyPasteRules"),C=!!k;if(!w&&!v&&!C)return;if(C){let{text:R}=k;typeof R=="string"?R=R:R=T0(xe.from(R),y.schema);const{from:D}=k,_=D+R.length,P=E6(R);return u({rule:f,state:y,from:D,to:{b:_},pasteEvt:P})}const E=g.doc.content.findDiffStart(y.doc.content),T=g.doc.content.findDiffEnd(y.doc.content);if(!(!j6(E)||!T||E===T.b))return u({rule:f,state:y,from:E,to:T,pasteEvt:o})}}))}var Df=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=k2(t),this.schema=F8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ec(e.name,this.schema)},r=We(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Hc([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Ec(r.name,this.schema)},i=[],o=We(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&We(r,"exitable",a)&&(c.ArrowRight=()=>Mo.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,N])=>[y,()=>N({editor:t})]));c={...c,...g}}const u=VL(c);i.push(u);const h=We(r,"addInputRules",a);if(xN(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=N6({editor:t,rules:g}),N=Array.isArray(y)?y:[y];i.push(...N)}}const f=We(r,"addPasteRules",a);if(xN(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=T6({editor:t,rules:g});i.push(...y)}}const m=We(r,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return j2(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Tl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:kn(n.name,this.schema)},i=We(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const y=ld(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return Hc([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Ec(a.name,this.schema)},o=We(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Hc([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Ec(a.name,this.schema)},o=We(a,"transformPastedHTML",i);return o?(c,u)=>{const h=r(c,u);return o.call(i,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Tl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ta(n.name,this.schema)},i=We(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=ld(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{H6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ec(e.name,this.schema)};e.type==="mark"&&((n=jt(We(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=We(e,"onBeforeCreate",r),i=We(e,"onCreate",r),o=We(e,"onUpdate",r),c=We(e,"onSelectionUpdate",r),u=We(e,"onTransaction",r),h=We(e,"onFocus",r),f=We(e,"onBlur",r),m=We(e,"onDestroy",r);a&&this.editor.on("beforeCreate",a),i&&this.editor.on("create",i),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};Df.resolve=k2;Df.sort=Hc;Df.flatten=E0;var M6={};k0(M6,{ClipboardTextSerializer:()=>D2,Commands:()=>L2,Delete:()=>_2,Drop:()=>z2,Editable:()=>F2,FocusEvents:()=>B2,Keymap:()=>V2,Paste:()=>H2,Tabindex:()=>W2,TextDirection:()=>U2,focusEventsPluginKey:()=>$2});var mn=class O2 extends A0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new O2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},D2=mn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Kt({key:new tn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:a}=e,{ranges:i}=a,o=Math.min(...i.map(f=>f.$from.pos)),c=Math.max(...i.map(f=>f.$to.pos)),u=C2(n);return S2(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),L2=mn.create({name:"commands",addCommands(){return{...f2}}}),_2=mn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,a;const i=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=v2(t.before,[t,...e]);T2(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(N,w)=>{const v=w+N.nodeSize-2,k=y.oldRange.from<=w&&v<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:N,from:w,to:v,newFrom:f.mapping.map(w),newTo:f.mapping.map(v),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,N)=>{var w,v;if(y instanceof ks){const k=g.slice(N).map(y.from,-1),C=g.slice(N).map(y.to),E=g.invert().map(k,-1),T=g.invert().map(C),R=(w=f.doc.nodeAt(k-1))==null?void 0:w.marks.some(_=>_.eq(y.mark)),D=(v=f.doc.nodeAt(C))==null?void 0:v.marks.some(_=>_.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:E,to:T},newRange:{from:k,to:C},partial:!!(D||R),editor:this.editor,transaction:t,combinedTransform:f})}})};(a=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||a?setTimeout(i,0):i()}}),z2=mn.create({name:"drop",addProseMirrorPlugins(){return[new Kt({key:new tn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),F2=mn.create({name:"editable",addProseMirrorPlugins(){return[new Kt({key:new tn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),$2=new tn("focusEvents"),B2=mn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Kt({key:$2,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),V2=mn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,N=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,w=N.parent.type.spec.isolating,v=m.pos-m.parentOffset,k=w&&N.parent.childCount===1?v===m.pos:rt.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Eh()||y2()?i:a},addProseMirrorPlugins(){return[new Kt({key:new tn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),a=t.some(w=>w.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=rt.atStart(e.doc).from,h=rt.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Pf(n.doc))return;const g=n.tr,y=Mf({state:n,transaction:g}),{commands:N}=new Af({editor:this.editor,state:y});if(N.clearNodes(),!!g.steps.length)return g}})]}}),H2=mn.create({name:"paste",addProseMirrorPlugins(){return[new Kt({key:new tn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),W2=mn.create({name:"tabindex",addProseMirrorPlugins(){return[new Kt({key:new tn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),U2=mn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Tl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Kt({key:new tn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),A6=class Pc{constructor(e,n,r=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=a}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Pc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Pc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Pc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const a=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+r+(i?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!a&&!o&&u.depth<=this.depth)return;const h=new Pc(u,this.editor,a,a||o?n:null);a&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,a=this.parent;for(;a&&!r;){if(a.node.type.name===e)if(Object.keys(n).length>0){const i=a.node.attrs,o=Object.keys(n);for(let c=0;c{r&&a.length>0||(o.node.type.name===e&&i.every(u=>n[u]===o.node.attrs[u])&&a.push(o),!(r&&a.length>0)&&(a=a.concat(o.querySelectorAll(e,n,r))))}),a}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},I6=`.ProseMirror { - position: relative; -} - -.ProseMirror { - word-wrap: break-word; - white-space: pre-wrap; - white-space: break-spaces; - -webkit-font-variant-ligatures: none; - font-variant-ligatures: none; - font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ -} - -.ProseMirror [contenteditable="false"] { - white-space: normal; -} - -.ProseMirror [contenteditable="false"] [contenteditable="true"] { - white-space: pre-wrap; -} - -.ProseMirror pre { - white-space: pre-wrap; -} - -img.ProseMirror-separator { - display: inline !important; - border: none !important; - margin: 0 !important; - width: 0 !important; - height: 0 !important; -} - -.ProseMirror-gapcursor { - display: none; - pointer-events: none; - position: absolute; - margin: 0; -} - -.ProseMirror-gapcursor:after { - content: ""; - display: block; - position: absolute; - top: -2px; - width: 20px; - border-top: 1px solid black; - animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; -} - -@keyframes ProseMirror-cursor-blink { - to { - visibility: hidden; - } -} - -.ProseMirror-hideselection *::selection { - background: transparent; -} - -.ProseMirror-hideselection *::-moz-selection { - background: transparent; -} - -.ProseMirror-hideselection * { - caret-color: transparent; -} - -.ProseMirror-focused .ProseMirror-gapcursor { - display: block; -}`;function R6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const a=document.createElement("style");return e&&a.setAttribute("nonce",e),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}var P6=class extends b6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Y8,createMappablePosition:Q8},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:a,moved:i})=>this.options.onDrop(r,a,i)),this.on("paste",({event:r,slice:a})=>this.options.onPaste(r,a)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=g2(e,this.options.autofocus);this.editorState=gl.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=R6(I6,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=w2(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(a=>{const i=typeof a=="string"?`${a}$`:a.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[F2,D2.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),L2,B2,V2,W2,z2,H2,_2,U2.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a==null?void 0:a.type));this.extensionManager=new Df(r,this)}createCommandManager(){this.commandManager=new Af({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=sx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=sx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),a=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new h2(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:a,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),a=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!a)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return E2(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return q8(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return T0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:n={}}=t||{};return B8(this.state.doc,{blockSeparator:e,textSerializers:{...C2(this.schema),...n}})}get isEmpty(){return Pf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new A6(e,this)}get $doc(){return this.$pos(0)}};function Ml(t){return new Of({find:t.find,handler:({state:e,range:n,match:r})=>{const a=jt(t.getAttributes,void 0,r);if(a===!1||a===null)return null;const{tr:i}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(M0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==y.mark.type)).filter(y=>y.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const g=n.from+u+o.length;i.addMark(n.from+u,g,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function K2(t){return new Of({find:t.find,handler:({state:e,range:n,match:r})=>{const a=jt(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let c=n.to;const u=t.type.create(a);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];i.insertText(m,o+r[0].length-1),i.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;i.insert(h,t.type.create(a)).delete(i.mapping.map(o),i.mapping.map(c))}i.scrollIntoView()},undoable:t.undoable})}function ix(t){return new Of({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),i=jt(t.getAttributes,void 0,r)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Al(t){return new Of({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const i=jt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&i0(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,N=g||m.$to.parentOffset&&m.$from.marks();if(N){const w=N.filter(v=>y.includes(v.type.name));o.ensureMarks(w)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&Ti(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var O6=t=>"touches"in t,D6=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,a,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(a=t.options)!=null&&a.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),a=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),a&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,O6(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:a}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,a,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,a=this.startHeight;const i=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),c?a=this.startHeight+n:u&&(a=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(a=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,a,t):{width:r,height:a}}applyConstraints(t,e,n){var r,a,i,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(a=this.maxSize)!=null&&a.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",a=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:a?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function L6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ge){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let a=r.depth;for(;a>=0;){const i=r.index(a);if(r.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function _6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var z6={};k0(z6,{createAtomBlockMarkdownSpec:()=>F6,createBlockMarkdownSpec:()=>$6,createInlineMarkdownSpec:()=>q2,parseAttributes:()=>I0,parseIndentedBlocks:()=>ox,renderNestedMarkdownContent:()=>P0,serializeAttributes:()=>R0});function I0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[h]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function R0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function F6(t){const{nodeName:e,name:n,parseAttributes:r=I0,serializeAttributes:a=R0,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...i,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),N=f.match(y);if(!N)return;const w=N[1]||"",v=r(w);if(!o.find(C=>!(C in v)))return{type:e,raw:N[0],attributes:v}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=a(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function $6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=I0,serializeAttributes:i=R0,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const w=r(m);y=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const N={...o,...m.attributes};return g.createNode(e,N,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),N=(g=m.match(y))==null?void 0:g.index;return N!==void 0?N:-1},tokenize(m,g,y){var N;const w=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=m.match(w);if(!v)return;const[k,C=""]=v,E=a(C);let T=1;const R=k.length;let D="";const _=/^:::([\w-]*)(\s.*)?/gm,P=m.slice(R);for(_.lastIndex=0;;){const L=_.exec(P);if(L===null)break;const F=L.index,X=L[1];if(!((N=L[2])!=null&&N.endsWith(":::"))){if(X)T+=1;else if(T-=1,T===0){const te=P.slice(0,F);D=te.trim();const ue=m.slice(0,R+F+L[0].length);let ae=[];if(D)if(c==="block")for(ae=y.blockTokens(te),ae.forEach(I=>{I.text&&(!I.tokens||I.tokens.length===0)&&(I.tokens=y.inlineTokens(I.text))});ae.length>0;){const I=ae[ae.length-1];if(I.type==="paragraph"&&(!I.text||I.text.trim()===""))ae.pop();else break}else ae=y.inlineTokens(D);return{type:e,raw:ue,attributes:E,content:D,tokens:ae}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),N=i(y),w=N?` {${N}}`:"",v=g.renderChildren(m.content||[],` - -`);return`:::${h}${w} - -${v} - -:::`}}}function B6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r;e[a]=i||o,r=n.exec(t)}return e}function V6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function q2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=B6,serializeAttributes:i=V6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(N=>{const w=typeof N=="string"?N:N.name,v=typeof N=="string"?void 0:N.skipIfDefault;if(w in g){const k=g[w];if(v!==void 0&&k===v)return;y[w]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const N={...o,...g.attributes};if(c)return y.createNode(e,N);const w=r?r(g):g.content||"";return w?y.createNode(e,N,[y.createTextNode(w)]):y.createNode(e,N,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),N=g.match(y),w=N==null?void 0:N.index;return w!==void 0?w:-1},tokenize(g,y,N){const w=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),v=g.match(w);if(!v)return;let k="",C="";if(c){const[,T]=v;C=T}else{const[,T,R]=v;C=T,k=R||""}const E=a(C.trim());return{type:e,raw:v[0],content:k.trim(),attributes:E}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const N=f(g.attrs||{}),w=i(N),v=w?` ${w}`:"";return c?`[${h}${v}]`:`[${h}${v}]${y}[/${h}]`}}}function ox(t,e,n){var r,a,i,o;const c=t.split(` -`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} -`;continue}else return}const N=e.extractItemData(y),{indentLevel:w,mainContent:v}=N;h=`${h}${g} -`;const k=[v];for(f+=1;fF.trim()!=="");if(_===-1)break;if((((a=(r=c[f+1+_].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>w){k.push(R),h=`${h}${R} -`,f+=1;continue}else break}if((((o=(i=R.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>w)k.push(R),h=`${h}${R} -`,f+=1;else break}let C;const E=k.slice(1);if(E.length>0){const R=E.map(D=>D.slice(w+m)).join(` -`);R.trim()&&(e.customNestedParser?C=e.customNestedParser(R):C=n.blockTokens(R))}const T=e.createToken(N,C);u.push(T)}if(u.length!==0)return{items:u,raw:h}}function P0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` -`).map(g=>g?e.indent(g):"").join(` -`);u.push(m)}}),u.join(` -`)}function H6(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,y)}}),i.docChanged&&e.view.dispatch(i)}var Sn=class G2 extends A0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new G2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function wo(t){return new k6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=jt(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(M0(n.from,n.to,e.doc).filter(N=>N.mark.type.excluded.find(v=>v===t.type&&v!==N.mark.type)).filter(N=>N.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:W6,getOwnPropertySymbols:U6}=Object,{hasOwnProperty:K6}=Object.prototype;function ag(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function Bu(t){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,a);const{cache:i}=a,o=i.get(n),c=i.get(r);if(o&&c)return o===r&&c===n;i.set(n,r),i.set(r,n);const u=t(n,r,a);return i.delete(n),i.delete(r),u}}function q6(t){return t!=null?t[Symbol.toStringTag]:void 0}function vN(t){return W6(t).concat(U6(t))}const G6=Object.hasOwn||((t,e)=>K6.call(t,e));function Ao(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const J6="__v",Y6="__o",Q6="_owner",{getOwnPropertyDescriptor:NN,keys:wN}=Object;function X6(t,e){return t.byteLength===e.byteLength&&Th(new Uint8Array(t),new Uint8Array(e))}function Z6(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function e_(t,e){return t.byteLength===e.byteLength&&Th(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function t_(t,e){return Ao(t.getTime(),e.getTime())}function n_(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function r_(t,e){return t===e}function jN(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const g=o.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const s_=Ao;function a_(t,e,n){const r=wN(t);let a=r.length;if(wN(e).length!==a)return!1;for(;a-- >0;)if(!J2(t,e,n,r[a]))return!1;return!0}function Tc(t,e,n){const r=vN(t);let a=r.length;if(vN(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!J2(t,e,n,i)||(o=NN(t,i),c=NN(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function i_(t,e){return Ao(t.valueOf(),e.valueOf())}function o_(t,e){return t.source===e.source&&t.flags===e.flags}function kN(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.values();let o,c;for(;(o=i.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!a[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=a[f]=!0;break}f++}if(!h)return!1}return!0}function Th(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function l_(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function J2(t,e,n,r){return(r===Q6||r===Y6||r===J6)&&(t.$$typeof||e.$$typeof)?!0:G6(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const c_="[object ArrayBuffer]",d_="[object Arguments]",u_="[object Boolean]",h_="[object DataView]",f_="[object Date]",p_="[object Error]",m_="[object Map]",g_="[object Number]",x_="[object Object]",y_="[object RegExp]",b_="[object Set]",v_="[object String]",N_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},w_="[object URL]",j_=Object.prototype.toString;function k_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:N}){return function(v,k,C){if(v===k)return!0;if(v==null||k==null)return!1;const E=typeof v;if(E!==typeof k)return!1;if(E!=="object")return E==="number"?c(v,k,C):E==="function"?i(v,k,C):!1;const T=v.constructor;if(T!==k.constructor)return!1;if(T===Object)return u(v,k,C);if(Array.isArray(v))return e(v,k,C);if(T===Date)return r(v,k,C);if(T===RegExp)return f(v,k,C);if(T===Map)return o(v,k,C);if(T===Set)return m(v,k,C);const R=j_.call(v);if(R===f_)return r(v,k,C);if(R===y_)return f(v,k,C);if(R===m_)return o(v,k,C);if(R===b_)return m(v,k,C);if(R===x_)return typeof v.then!="function"&&typeof k.then!="function"&&u(v,k,C);if(R===w_)return y(v,k,C);if(R===p_)return a(v,k,C);if(R===d_)return u(v,k,C);if(N_[R])return g(v,k,C);if(R===c_)return t(v,k,C);if(R===h_)return n(v,k,C);if(R===u_||R===g_||R===v_)return h(v,k,C);if(N){let D=N[R];if(!D){const _=q6(v);_&&(D=N[_])}if(D)return D(v,k,C)}return!1}}function S_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:X6,areArraysEqual:n?Tc:Z6,areDataViewsEqual:e_,areDatesEqual:t_,areErrorsEqual:n_,areFunctionsEqual:r_,areMapsEqual:n?ag(jN,Tc):jN,areNumbersEqual:s_,areObjectsEqual:n?Tc:a_,arePrimitiveWrappersEqual:i_,areRegExpsEqual:o_,areSetsEqual:n?ag(kN,Tc):kN,areTypedArraysEqual:n?ag(Th,Tc):Th,areUrlsEqual:l_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=Bu(r.areArraysEqual),i=Bu(r.areMapsEqual),o=Bu(r.areObjectsEqual),c=Bu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function C_(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function E_({circular:t,comparator:e,createState:n,equals:r,strict:a}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:a})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const i={cache:void 0,equals:r,meta:void 0,strict:a};return function(c,u){return e(c,u,i)}}const T_=Ai();Ai({strict:!0});Ai({circular:!0});Ai({circular:!0,strict:!0});Ai({createInternalComparator:()=>Ao});Ai({strict:!0,createInternalComparator:()=>Ao});Ai({circular:!0,createInternalComparator:()=>Ao});Ai({circular:!0,createInternalComparator:()=>Ao,strict:!0});function Ai(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=S_(t),o=k_(i),c=n?n(o):C_(o);return E_({circular:e,comparator:o,createState:r,equals:c,strict:a})}var ig={exports:{}},og={};/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var SN;function M_(){if(SN)return og;SN=1;var t=fd(),e=zk();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return og.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var N=i(null);if(N.current===null){var w={hasValue:!1,value:null};N.current=w}else w=N.current;N=c(function(){function k(D){if(!C){if(C=!0,E=D,D=g(D),y!==void 0&&w.hasValue){var _=w.value;if(y(_,D))return T=_}return T=D}if(_=T,r(E,D))return _;var P=g(D);return y!==void 0&&y(_,P)?(E=D,_):(E=D,T=P)}var C=!1,E,T,R=m===void 0?null:m;return[function(){return k(f())},R===null?void 0:function(){return k(R())}]},[f,m,g,y]);var v=a(h,N[0],N[1]);return o(function(){w.hasValue=!0,w.value=v},[v]),u(v),v},og}var CN;function A_(){return CN||(CN=1,ig.exports=M_()),ig.exports}var I_=A_(),R_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},P_=({contentComponent:t})=>{const e=Fk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function O_(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Pw.createPortal(r.reactElement,r.element,n)},t.forEach(a=>a())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(a=>a())}}}var D_=class extends br.Component{constructor(t){var e;super(t),this.editorContentRef=br.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=O_(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:R_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(P_,{contentComponent:t.contentComponent})]})}},L_=b.forwardRef((t,e)=>{const n=br.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return br.createElement(D_,{key:n,innerRef:e,...t})}),Y2=br.memo(L_),__=typeof window<"u"?b.useLayoutEffect:b.useEffect,z_=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function F_(t){var e;const[n]=b.useState(()=>new z_(t.editor)),r=I_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:T_);return __(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var $_=!1,lx=typeof window>"u",B_=lx||!!(typeof window<"u"&&window.next),V_=class Q2{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?lx||B_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onBeforeCreate)==null?void 0:i.call(a,...r)},onBlur:(...r)=>{var a,i;return(i=(a=this.options.current).onBlur)==null?void 0:i.call(a,...r)},onCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onCreate)==null?void 0:i.call(a,...r)},onDestroy:(...r)=>{var a,i;return(i=(a=this.options.current).onDestroy)==null?void 0:i.call(a,...r)},onFocus:(...r)=>{var a,i;return(i=(a=this.options.current).onFocus)==null?void 0:i.call(a,...r)},onSelectionUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onSelectionUpdate)==null?void 0:i.call(a,...r)},onTransaction:(...r)=>{var a,i;return(i=(a=this.options.current).onTransaction)==null?void 0:i.call(a,...r)},onUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onUpdate)==null?void 0:i.call(a,...r)},onContentError:(...r)=>{var a,i;return(i=(a=this.options.current).onContentError)==null?void 0:i.call(a,...r)},onDrop:(...r)=>{var a,i;return(i=(a=this.options.current).onDrop)==null?void 0:i.call(a,...r)},onPaste:(...r)=>{var a,i;return(i=(a=this.options.current).onPaste)==null?void 0:i.call(a,...r)},onDelete:(...r)=>{var a,i;return(i=(a=this.options.current).onDelete)==null?void 0:i.call(a,...r)}};return new P6(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,i)=>{var o;return a===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Q2.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,a)=>r===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function H_(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new V_(n)),a=Fk.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(a),b.useEffect(r.onRender(e)),F_({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var X2=b.createContext({editor:null});X2.Consumer;var W_=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),U_=()=>b.useContext(W_);br.forwardRef((t,e)=>{const{onDragStart:n}=U_(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});br.createContext({markViewContentRef:()=>{}});var O0=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});O0.displayName="TiptapContext";var K_=()=>b.useContext(O0);function Z2({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=b.useMemo(()=>({editor:r}),[r]),i=b.useMemo(()=>({editor:r}),[r]);return s.jsx(X2.Provider,{value:i,children:s.jsx(O0.Provider,{value:a,children:n})})}Z2.displayName="Tiptap";function eC({...t}){const{editor:e}=K_();return s.jsx(Y2,{editor:e,...t})}eC.displayName="Tiptap.Content";Object.assign(Z2,{Content:eC});var Mh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},q_=/^\s*>\s$/,G_=Sn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Mh("blockquote",{...kt(this.options.HTMLAttributes,t),children:Mh("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(a=>{const c=e.renderChildren([a]).split(` -`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` -`))}),r.join(` -${n} -`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Al({find:q_,type:this.type})]}}),J_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Y_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Q_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,X_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Z_=Mo.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Mh("strong",{...kt(this.options.HTMLAttributes,t),children:Mh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ml({find:J_,type:this.type}),Ml({find:Q_,type:this.type})]},addPasteRules(){return[wo({find:Y_,type:this.type}),wo({find:X_,type:this.type})]}}),e7=/(^|[^`])`([^`]+)`(?!`)$/,t7=/(^|[^`])`([^`]+)`(?!`)/g,n7=Mo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",kt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ml({find:e7,type:this.type})]},addPasteRules(){return[wo({find:t7,type:this.type})]}}),lg=4,r7=/^```([a-z]+)?[\s\n]$/,s7=/^~~~([a-z]+)?[\s\n]$/,a7=Sn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:lg,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",kt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const a=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${a}`,e.renderChildren(t.content),"```"].join(` -`):r=`\`\`\`${a} - -\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:lg,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;if(i.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=a,y=r.doc.textBetween(h,f,` -`,` -`).split(` -`).map(N=>c+N).join(` -`);return u.replaceWith(h,f,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:lg,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=i,f=i.start(),m=i.end(),y=r.doc.textBetween(f,m,` -`,` -`).split(` -`);let N=0,w=0;const v=h-f;for(let D=0;D=v){N=D;break}w+=y[D].length+1}const C=((u=y[N].match(/^ */))==null?void 0:u[0])||"",E=Math.min(C.length,n);if(E===0)return!0;let T=f;for(let D=0;D{const{from:u,to:h}=a,g=r.doc.textBetween(u,h,` -`,` -`).split(` -`).map(y=>{var N;const w=((N=y.match(/^ */))==null?void 0:N[0])||"",v=Math.min(w.length,n);return y.slice(v)}).join(` -`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` - -`);return!i||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:a,empty:i}=n;if(!i||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const c=a.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(rt.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[ix({find:r7,type:this.type,getAttributes:t=>({language:t[1]})}),ix({find:s7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Kt({key:new tn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` -`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(Qe.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),i7=Sn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` - -`):""}),o7=Sn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",kt(this.options.HTMLAttributes,t)]},renderText(){return` -`},renderMarkdown:()=>` -`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),l7=Sn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,kt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,a="#".repeat(r);return t.content?`${a} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ix({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),c7=Sn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",kt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!L6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return M2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Qe.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Ge.create(o.doc,u.pos)):o.setSelection(Qe.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(Qe.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[K2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),d7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,u7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,h7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,f7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,p7=Mo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",kt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ml({find:d7,type:this.type}),Ml({find:h7,type:this.type})]},addPasteRules(){return[wo({find:u7,type:this.type}),wo({find:f7,type:this.type})]}});const m7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",g7="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",cx="numeric",dx="ascii",ux="alpha",Wc="asciinumeric",Oc="alphanumeric",hx="domain",tC="emoji",x7="scheme",y7="slashscheme",cg="whitespace";function b7(t,e){return t in e||(e[t]=[]),e[t]}function oo(t,e,n){e[cx]&&(e[Wc]=!0,e[Oc]=!0),e[dx]&&(e[Wc]=!0,e[ux]=!0),e[Wc]&&(e[Oc]=!0),e[ux]&&(e[Oc]=!0),e[Oc]&&(e[hx]=!0),e[tC]&&(e[hx]=!0);for(const r in e){const a=b7(r,n);a.indexOf(t)<0&&a.push(t)}}function v7(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Mr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Mr.groups={};Mr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,a),un=(t,e,n,r,a)=>t.tr(e,n,r,a),EN=(t,e,n,r,a)=>t.ts(e,n,r,a),Se=(t,e,n,r,a)=>t.tt(e,n,r,a),ga="WORD",fx="UWORD",nC="ASCIINUMERICAL",rC="ALPHANUMERICAL",cd="LOCALHOST",px="TLD",mx="UTLD",nh="SCHEME",dl="SLASH_SCHEME",D0="NUM",gx="WS",L0="NL",Uc="OPENBRACE",Kc="CLOSEBRACE",Ah="OPENBRACKET",Ih="CLOSEBRACKET",Rh="OPENPAREN",Ph="CLOSEPAREN",Oh="OPENANGLEBRACKET",Dh="CLOSEANGLEBRACKET",Lh="FULLWIDTHLEFTPAREN",_h="FULLWIDTHRIGHTPAREN",zh="LEFTCORNERBRACKET",Fh="RIGHTCORNERBRACKET",$h="LEFTWHITECORNERBRACKET",Bh="RIGHTWHITECORNERBRACKET",Vh="FULLWIDTHLESSTHAN",Hh="FULLWIDTHGREATERTHAN",Wh="AMPERSAND",Uh="APOSTROPHE",Kh="ASTERISK",ni="AT",qh="BACKSLASH",Gh="BACKTICK",Jh="CARET",ai="COLON",_0="COMMA",Yh="DOLLAR",Fs="DOT",Qh="EQUALS",z0="EXCLAMATION",rs="HYPHEN",qc="PERCENT",Xh="PIPE",Zh="PLUS",ef="POUND",Gc="QUERY",F0="QUOTE",sC="FULLWIDTHMIDDLEDOT",$0="SEMI",$s="SLASH",Jc="TILDE",tf="UNDERSCORE",aC="EMOJI",nf="SYM";var iC=Object.freeze({__proto__:null,ALPHANUMERICAL:rC,AMPERSAND:Wh,APOSTROPHE:Uh,ASCIINUMERICAL:nC,ASTERISK:Kh,AT:ni,BACKSLASH:qh,BACKTICK:Gh,CARET:Jh,CLOSEANGLEBRACKET:Dh,CLOSEBRACE:Kc,CLOSEBRACKET:Ih,CLOSEPAREN:Ph,COLON:ai,COMMA:_0,DOLLAR:Yh,DOT:Fs,EMOJI:aC,EQUALS:Qh,EXCLAMATION:z0,FULLWIDTHGREATERTHAN:Hh,FULLWIDTHLEFTPAREN:Lh,FULLWIDTHLESSTHAN:Vh,FULLWIDTHMIDDLEDOT:sC,FULLWIDTHRIGHTPAREN:_h,HYPHEN:rs,LEFTCORNERBRACKET:zh,LEFTWHITECORNERBRACKET:$h,LOCALHOST:cd,NL:L0,NUM:D0,OPENANGLEBRACKET:Oh,OPENBRACE:Uc,OPENBRACKET:Ah,OPENPAREN:Rh,PERCENT:qc,PIPE:Xh,PLUS:Zh,POUND:ef,QUERY:Gc,QUOTE:F0,RIGHTCORNERBRACKET:Fh,RIGHTWHITECORNERBRACKET:Bh,SCHEME:nh,SEMI:$0,SLASH:$s,SLASH_SCHEME:dl,SYM:nf,TILDE:Jc,TLD:px,UNDERSCORE:tf,UTLD:mx,UWORD:fx,WORD:ga,WS:gx});const pa=/[a-z]/,Mc=new RegExp("\\p{L}","u"),dg=new RegExp("\\p{Emoji}","u"),ma=/\d/,ug=/\s/,TN="\r",hg=` -`,N7="️",w7="‍",fg="";let Vu=null,Hu=null;function j7(t=[]){const e={};Mr.groups=e;const n=new Mr;Vu==null&&(Vu=MN(m7)),Hu==null&&(Hu=MN(g7)),Se(n,"'",Uh),Se(n,"{",Uc),Se(n,"}",Kc),Se(n,"[",Ah),Se(n,"]",Ih),Se(n,"(",Rh),Se(n,")",Ph),Se(n,"<",Oh),Se(n,">",Dh),Se(n,"(",Lh),Se(n,")",_h),Se(n,"「",zh),Se(n,"」",Fh),Se(n,"『",$h),Se(n,"』",Bh),Se(n,"<",Vh),Se(n,">",Hh),Se(n,"&",Wh),Se(n,"*",Kh),Se(n,"@",ni),Se(n,"`",Gh),Se(n,"^",Jh),Se(n,":",ai),Se(n,",",_0),Se(n,"$",Yh),Se(n,".",Fs),Se(n,"=",Qh),Se(n,"!",z0),Se(n,"-",rs),Se(n,"%",qc),Se(n,"|",Xh),Se(n,"+",Zh),Se(n,"#",ef),Se(n,"?",Gc),Se(n,'"',F0),Se(n,"/",$s),Se(n,";",$0),Se(n,"~",Jc),Se(n,"_",tf),Se(n,"\\",qh),Se(n,"・",sC);const r=un(n,ma,D0,{[cx]:!0});un(r,ma,r);const a=un(r,pa,nC,{[Wc]:!0}),i=un(r,Mc,rC,{[Oc]:!0}),o=un(n,pa,ga,{[dx]:!0});un(o,ma,a),un(o,pa,o),un(a,ma,a),un(a,pa,a);const c=un(n,Mc,fx,{[ux]:!0});un(c,pa),un(c,ma,i),un(c,Mc,c),un(i,ma,i),un(i,pa),un(i,Mc,i);const u=Se(n,hg,L0,{[cg]:!0}),h=Se(n,TN,gx,{[cg]:!0}),f=un(n,ug,gx,{[cg]:!0});Se(n,fg,f),Se(h,hg,u),Se(h,fg,f),un(h,ug,f),Se(f,TN),Se(f,hg),un(f,ug,f),Se(f,fg,f);const m=un(n,dg,aC,{[tC]:!0});Se(m,"#"),un(m,dg,m),Se(m,N7,m);const g=Se(m,w7);Se(g,"#"),un(g,dg,m);const y=[[pa,o],[ma,a]],N=[[pa,null],[Mc,c],[ma,i]];for(let w=0;ww[0]>v[0]?1:-1);for(let w=0;w=0?C[hx]=!0:pa.test(v)?ma.test(v)?C[Wc]=!0:C[dx]=!0:C[cx]=!0,EN(n,v,v,C)}return EN(n,"localhost",cd,{ascii:!0}),n.jd=new Mr(nf),{start:n,tokens:Object.assign({groups:e},iC)}}function oC(t,e){const n=k7(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function k7(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Qa(t,e,n,r,a){let i;const o=e.length;for(let c=0;c=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const dd={defaultProtocol:"http",events:null,format:AN,formatHref:AN,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function B0(t,e=null){let n=Object.assign({},dd);t&&(n=Object.assign(n,t instanceof B0?t.o:t));const r=n.ignoreTags,a=[];for(let i=0;in?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=dd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),a=t.get("tagName",n,e),i=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:a,attributes:o,content:i,eventListeners:m}}};function Lf(t,e){class n extends lC{constructor(a,i){super(a,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const IN=Lf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),RN=Lf("text"),S7=Lf("nl"),Wu=Lf("url",{isLink:!0,toHref(t=dd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==cd&&t[1].t===ai}}),ns=t=>new Mr(t);function C7({groups:t}){const e=t.domain.concat([Wh,Kh,ni,qh,Gh,Jh,Yh,Qh,rs,D0,qc,Xh,Zh,ef,$s,nf,Jc,tf]),n=[Uh,ai,_0,Fs,z0,qc,Gc,F0,$0,Oh,Dh,Uc,Kc,Ih,Ah,Rh,Ph,Lh,_h,zh,Fh,$h,Bh,Vh,Hh],r=[Wh,Uh,Kh,qh,Gh,Jh,Yh,Qh,rs,Uc,Kc,qc,Xh,Zh,ef,Gc,$s,nf,Jc,tf],a=ns(),i=Se(a,Jc);ct(i,r,i),ct(i,t.domain,i);const o=ns(),c=ns(),u=ns();ct(a,t.domain,o),ct(a,t.scheme,c),ct(a,t.slashscheme,u),ct(o,r,i),ct(o,t.domain,o);const h=Se(o,ni);Se(i,ni,h),Se(c,ni,h),Se(u,ni,h);const f=Se(i,Fs);ct(f,r,i),ct(f,t.domain,i);const m=ns();ct(h,t.domain,m),ct(m,t.domain,m);const g=Se(m,Fs);ct(g,t.domain,m);const y=ns(IN);ct(g,t.tld,y),ct(g,t.utld,y),Se(h,cd,y);const N=Se(m,rs);Se(N,rs,N),ct(N,t.domain,m),ct(y,t.domain,m),Se(y,Fs,g),Se(y,rs,N);const w=Se(y,ai);ct(w,t.numeric,IN);const v=Se(o,rs),k=Se(o,Fs);Se(v,rs,v),ct(v,t.domain,o),ct(k,r,i),ct(k,t.domain,o);const C=ns(Wu);ct(k,t.tld,C),ct(k,t.utld,C),ct(C,t.domain,o),ct(C,r,i),Se(C,Fs,k),Se(C,rs,v),Se(C,ni,h);const E=Se(C,ai),T=ns(Wu);ct(E,t.numeric,T);const R=ns(Wu),D=ns();ct(R,e,R),ct(R,n,D),ct(D,e,R),ct(D,n,D),Se(C,$s,R),Se(T,$s,R);const _=Se(c,ai),P=Se(u,ai),L=Se(P,$s),F=Se(L,$s);ct(c,t.domain,o),Se(c,Fs,k),Se(c,rs,v),ct(u,t.domain,o),Se(u,Fs,k),Se(u,rs,v),ct(_,t.domain,R),Se(_,$s,R),Se(_,Gc,R),ct(F,t.domain,R),ct(F,e,R),Se(F,$s,R);const X=[[Uc,Kc],[Ah,Ih],[Rh,Ph],[Oh,Dh],[Lh,_h],[zh,Fh],[$h,Bh],[Vh,Hh]];for(let te=0;te=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(pg(RN,e,o)),o=[]),a-=g,f-=g;const y=m.t,N=n.slice(a-f,a);i.push(pg(y,e,N))}}return o.length>0&&i.push(pg(RN,e,o)),i}function pg(t,e,n){const r=n[0].s,a=n[n.length-1].e,i=e.slice(r,a);return new t(i,n)}const T7=typeof console<"u"&&console&&console.warn||(()=>{}),M7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Jt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function A7(){return Mr.groups={},Jt.scanner=null,Jt.parser=null,Jt.tokenQueue=[],Jt.pluginQueue=[],Jt.customSchemes=[],Jt.initialized=!1,Jt}function PN(t,e=!1){if(Jt.initialized&&T7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${M7}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. -1. Must only contain digits, lowercase ASCII letters or "-" -2. Cannot start or end with "-" -3. "-" cannot repeat`);Jt.customSchemes.push([t,e])}function I7(){Jt.scanner=j7(Jt.customSchemes);for(let t=0;t{const a=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),i=e.some(h=>h.getMeta("preventAutolink"));if(!a||i)return;const{tr:o}=r,c=v2(n.doc,[...e]);if(T2(c).forEach(({newRange:h})=>{const f=D8(r.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(h.from,h.to," "," ");if(!P7.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(R7).filter(Boolean);if(y.length<=0)return!1;const N=y[y.length-1],w=m.pos+g.lastIndexOf(N);if(!N)return!1;const v=V0(N).map(k=>k.toObject(t.defaultProtocol));if(!D7(v))return!1;v.filter(k=>k.isLink).map(k=>({...k,from:w+k.start+1,to:w+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{M0(k.from,k.to,r.doc).some(C=>C.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function _7(t){return new Kt({key:new tn("handleClickLink"),props:{handleClick:(e,n,r)=>{var a,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=E2(e.state,t.type.name),h=(a=o.href)!=null?a:u.href,f=(i=o.target)!=null?i:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function z7(t){return new Kt({key:new tn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:a}=t,{state:i}=e,{selection:o}=i,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=cC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||a!==void 0&&!a(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function eo(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const a=typeof r=="string"?r:r.scheme;a&&n.push(a)}),!t||t.replace(O7,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var F7=Mo.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){PN(t);return}PN(t.scheme,t.optionalSlashes)})},onDestroy(){A7()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!eo(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const a=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(a)||!/\./.test(a))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!eo(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!eo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",kt(this.options.HTMLAttributes,t),0]:["a",kt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,a,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(i=(a=t.attrs)==null?void 0:a.title)!=null?i:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!eo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!eo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[wo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=cC(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!eo(o,n),protocols:n,defaultProtocol:r}));a.length&&a.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(L7({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!eo(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(_7({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(z7({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),$7=Object.defineProperty,B7=(t,e)=>{for(var n in e)$7(t,n,{get:e[n],enumerable:!0})},V7="listItem",ON="textStyle",DN=/^\s*([-+*])\s$/,dC=Sn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",kt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(V7,this.editor.getAttributes(ON)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Al({find:DN,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Al({find:DN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ON),editor:this.editor})),[t]}}),uC=Sn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",kt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(a=>a.type==="paragraph"))n=e.parseChildren(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>P0(t,e,r=>{var a,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(a=r.meta)==null?void 0:a.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),H7={};B7(H7,{findListItemPos:()=>Nd,getNextListDepth:()=>W0,handleBackspace:()=>xx,handleDelete:()=>yx,hasListBefore:()=>hC,hasListItemAfter:()=>W7,hasListItemBefore:()=>fC,listItemHasSubList:()=>pC,nextListIsDeeper:()=>mC,nextListIsHigher:()=>gC});var Nd=(t,e)=>{const{$from:n}=e.selection,r=kn(t,e.schema);let a=null,i=n.depth,o=n.pos,c=null;for(;i>0&&c===null;)a=n.node(i),a.type===r?c=i:(i-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},W0=(t,e)=>{const n=Nd(t,e);if(!n)return!1;const[,r]=U8(e,t,n.$pos.pos+4);return r},hC=(t,e,n)=>{const{$anchor:r}=t.selection,a=Math.max(0,r.pos-2),i=t.doc.resolve(a).node();return!(!i||!n.includes(i.type.name))},fC=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-2);return!(a.index()===0||((n=a.nodeBefore)==null?void 0:n.type.name)!==t)},pC=(t,e,n)=>{if(!n)return!1;const r=kn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},xx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Ni(t.state,e)&&hC(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,y)=>{g.type.name===e&&h.push({node:g,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Ni(t.state,e)||!J8(t.state))return!1;const r=Nd(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=pC(e,t.state,i);return fC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},mC=(t,e)=>{const n=W0(t,e),r=Nd(t,e);return!r||!n?!1:n>r.depth},gC=(t,e)=>{const n=W0(t,e),r=Nd(t,e);return!r||!n?!1:n{if(!Ni(t.state,e)||!G8(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:mC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():gC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},W7=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-r.parentOffset-2);return!(a.index()===a.parent.childCount-1||((n=a.nodeAfter)==null?void 0:n.type.name)!==t)},xC=mn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&yx(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&yx(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&xx(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&xx(t,n,r)&&(e=!0)}),e}}}}),LN=/^(\s*)(\d+)\.\s+(.*)$/,U7=/^\s/;function K7(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(w=>w.indent)),N=yC(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:N,raw:g.map(w=>w.raw).join(` -`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function q7(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(a=>{if(a.type==="paragraph"||a.type==="list"||a.type==="blockquote"||a.type==="code")r.push(...e.parseChildren([a]));else if(a.type==="text"&&a.tokens){const i=e.parseChildren([a]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([a]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var G7="listItem",_N="textStyle",zN=/^(\d+)\.\s$/,bC=Sn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",kt(this.options.HTMLAttributes,n),0]:["ol",kt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?q7(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const a=t.split(` -`),[i,o]=K7(a);if(i.length===0)return;const c=yC(i,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:c,raw:a.slice(0,o).join(` -`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(G7,this.editor.getAttributes(_N)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Al({find:zN,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Al({find:zN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_N)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),J7=/^\s*(\[([( |x])?\])\s$/,Y7=Sn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",kt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const a=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return P0(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const N=n();if(typeof N!="number")return!1;const w=y.doc.nodeAt(N);return y.setNodeMarkup(N,void 0,{...w==null?void 0:w.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{a.setAttribute(m,g)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,g])=>{a.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=ld(m,g),N=new Set(Object.keys(y)),w=this.options.HTMLAttributes;return f.forEach(v=>{N.has(v)||(v in w?a.setAttribute(v,w[v]):a.removeAttribute(v))}),Object.entries(y).forEach(([v,k])=>{k==null?v in w?a.setAttribute(v,w[v]):a.removeAttribute(v):a.setAttribute(v,k)}),f=N,!0}}}},addInputRules(){return[Al({find:J7,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Q7=Sn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",kt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=ox(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},a=ox(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});mn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(dC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(uC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(xC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(bC.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Y7.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Q7.configure(this.options.taskList)),t}});var FN=" ",X7=" ",Z7=Sn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",kt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===FN||r[0].text===X7)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?FN:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ez=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nz=Mo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",kt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ml({find:ez,type:this.type})]},addPasteRules(){return[wo({find:tz,type:this.type})]}}),rz=Sn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),sz=Mo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",kt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const i=a[2].trim();return{type:"underline",raw:a[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function az(t={}){return new Kt({view(e){return new iz(e,t)}})}class iz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let N=y.getBoundingClientRect(),w=m?N.bottom:N.top;m&&g&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*c;r={left:N.left,right:N.right,top:w-v,bottom:w+v}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*y}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=hS(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class fn extends rt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return fn.valid(r)?new fn(r):rt.near(r)}content(){return Ie.empty}eq(e){return e instanceof fn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new fn(e.resolve(n.pos))}getBookmark(){return new U0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!oz(e)||!lz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&fn.valid(e))return e;let a=e.pos,i=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){i=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;a+=n;let u=e.doc.resolve(a);if(fn.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Ge.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(fn.valid(c))return c}return null}}}fn.prototype.visible=!1;fn.findFrom=fn.findGapCursorFrom;rt.jsonID("gapcursor",fn);class U0{constructor(e){this.pos=e}map(e){return new U0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return fn.valid(n)?new fn(n):rt.near(n)}}function vC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function oz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||vC(a.type))return!0;if(a.inlineContent)return!1}}return!0}function lz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||vC(a.type))return!0;if(a.inlineContent)return!1}}return!0}function cz(){return new Kt({props:{decorations:fz,createSelectionBetween(t,e,n){return e.pos==n.pos&&fn.valid(n)?new fn(n):null},handleClick:uz,handleKeyDown:dz,handleDOMEvents:{beforeinput:hz}}})}const dz=j0({ArrowLeft:Uu("horiz",-1),ArrowRight:Uu("horiz",1),ArrowUp:Uu("vert",-1),ArrowDown:Uu("vert",1)});function Uu(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof Qe){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=fn.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new fn(h))),!0):!1}}function uz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!fn.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&Ge.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new fn(r))),!0)}function hz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof fn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=xe.empty;for(let o=r.length-1;o>=0;o--)a=xe.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Ie(a,0,0));return i.setSelection(Qe.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function fz(t){if(!(t.selection instanceof fn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",zt.create(t.doc,[Mn.widget(t.selection.head,e,{key:"gapcursor"})])}var rf=200,Vn=function(){};Vn.prototype.append=function(e){return e.length?(e=Vn.from(e),!this.length&&e||e.length=n?Vn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Vn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Vn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Vn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var a=[];return this.forEach(function(i,o){return a.push(e(i,o))},n,r),a};Vn.from=function(e){return e instanceof Vn?e:e&&e.length?new NC(e):Vn.empty};var NC=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,i){return a==0&&i==this.length?this:new e(this.values.slice(a,i))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,i,o,c){for(var u=i;u=o;u--)if(a(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=rf)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=rf)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Vn);Vn.empty=new NC([]);var pz=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(a-c,0),Math.min(this.length,i)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,i,o){var c=this.left.length;if(a>c&&this.right.forEachInvertedInner(r,a-c,Math.max(i,c)-c,o+c)===!1||i=i?this.right.slice(r-i,a-i):this.left.slice(r,i).append(this.right.slice(0,a-i))},e.prototype.leafAppend=function(r){var a=this.right.leafAppend(r);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(r){var a=this.left.leafPrepend(r);if(a)return new e(a,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Vn);const mz=500;class js{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){a||(a=this.remapping(r,g+1),i=a.maps.length),i--,f.push(m);return}if(a){f.push(new Xa(m.map));let y=m.step.map(a.slice(i)),N;y&&o.maybeStep(y).doc&&(N=o.mapping.maps[o.mapping.maps.length-1],h.push(new Xa(N,void 0,void 0,h.length+f.length))),i--,N&&a.appendMap(N,i)}else o.maybeStep(m.step);if(m.selection)return c=a?m.selection.map(a.slice(i)):m.selection,u=new js(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,a){let i=[],o=this.eventCount,c=this.items,u=!a&&c.length?c.get(c.length-1):null;for(let f=0;fxz&&(c=gz(c,h),o-=h),new js(c.append(i),o)}remapping(e,n){let r=new nd;return this.items.forEach((a,i)=>{let o=a.mirrorOffset!=null&&i-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new js(this.items.append(e.map(n=>new Xa(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},a);let u=n;this.items.forEach(g=>{let y=i.getMirror(--u);if(y==null)return;o=Math.min(o,y);let N=i.maps[y];if(g.step){let w=e.steps[y].invert(e.docs[y]),v=g.selection&&g.selection.map(i.slice(u+1,y));v&&c++,r.push(new Xa(N,w,v))}else r.push(new Xa(N))},a);let h=[];for(let g=n;gmz&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,a=[],i=0;return this.items.forEach((o,c)=>{if(c>=e)a.push(o),o.selection&&i++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&i++;let m=new Xa(h.invert(),u,f),g,y=a.length-1;(g=a.length&&a[y].merge(m))?a[y]=g:a.push(m)}}else o.map&&r--},this.items.length,0),new js(Vn.from(a.reverse()),i)}}js.empty=new js(Vn.empty,0);function gz(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let Xa=class wC{constructor(e,n,r,a){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new wC(n.getMap().invert(),n,this.selection)}}};class ri{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const xz=20;function yz(t,e,n,r){let a=n.getMeta(po),i;if(a)return a.historyState;n.getMeta(Nz)&&(t=new ri(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(po))return o.getMeta(po).redo?new ri(t.done.addTransform(n,void 0,r,rh(e)),t.undone,$N(n.mapping.maps),t.prevTime,t.prevComposition):new ri(t.done,t.undone.addTransform(n,void 0,r,rh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!bz(n,t.prevRanges)),h=o?mg(t.prevRanges,n.mapping):$N(n.mapping.maps);return new ri(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,rh(e)),js.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new ri(t.done.rebased(n,i),t.undone.rebased(n,i),mg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ri(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),mg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function bz(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,a)=>{for(let i=0;i=e[i]&&(n=!0)}),n}function $N(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,a,i,o)=>e.push(i,o));return e}function mg(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=po.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=vz(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const kC=jC(!1,!0),SC=jC(!0,!0);mn.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Kt({key:new tn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const o=i-a,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=i-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var jz=mn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[az(this.options)]}});mn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Kt({key:new tn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return zt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(a>=h&&a<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(a>=h&&a<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";i.push(Mn.node(h,h+u.nodeSize,{class:this.options.className}))}),zt.create(t,i)}}})]}});var kz=mn.create({name:"gapCursor",addProseMirrorPlugins(){return[cz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=jt(We(t,"allowGapCursor",n)))!=null?e:null}}}),VN="placeholder";function Sz(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Cz=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:VN,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${Sz(this.options.dataAttribute)}`:`data-${VN}`;return[new Kt({key:new tn("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,i=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=a>=u&&a<=u+c.nodeSize,f=!c.isLeaf&&Pf(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=Mn.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});i.push(g)}return this.options.includeChildren}),zt.create(e,i)}}})]}});mn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Kt({key:new tn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||M2(n.selection)||t.view.dragging?null:zt.create(n.doc,[Mn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function HN({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var Ez=mn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new tn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new Kt({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!HN({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!HN({node:o,types:r})}}})]}}),Tz=mn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>kC(t,e),redo:()=>({state:t,dispatch:e})=>SC(t,e)}},addProseMirrorPlugins(){return[wz(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Mz=mn.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(Z_.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(G_.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(dC.configure(this.options.bulletList)),this.options.code!==!1&&a.push(n7.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(a7.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(i7.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(jz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(kz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(o7.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(l7.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(Tz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(c7.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(p7.configure(this.options.italic)),this.options.listItem!==!1&&a.push(uC.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(xC.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(F7.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(bC.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(Z7.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(nz.configure(this.options.strike)),this.options.text!==!1&&a.push(rz.configure(this.options.text)),this.options.underline!==!1&&a.push(sz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(Ez.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),Az=Mz,Iz=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Rz=Sn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",kt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,i,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",h=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:i,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new D6({element:u,editor:c,node:a,getPos:i,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const y=i();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,y)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[K2({find:Iz,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),Pz=Rz;function Oz(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=_6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=a?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),N=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!N)return null;const w=c.pos-N.length,v=Array.from(N.matchAll(y)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const k=v.input.slice(Math.max(0,v.index-1),v.index),C=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!C)return null;const E=w+v.index;let T=E+v[0].length;return u&&f.test(N.slice(T-1,T+1))&&(v[0]+=" ",T+=1),E=c.pos?{range:{from:E,to:T},query:v[0].slice(n.length),text:v[0]}:null}var Dz=new tn("suggestion");function Lz({pluginKey:t=Dz,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:y=()=>({}),allow:N=()=>!0,findSuggestionMatch:w=Oz,shouldShow:v}){let k;const C=y==null?void 0:y(),E=()=>{const _=e.state.selection.$anchor.pos,P=e.view.coordsAtPos(_),{top:L,right:F,bottom:X,left:te}=P;try{return new DOMRect(te,L,F-te,X-L)}catch{return null}},T=(_,P)=>P?()=>{const L=t.getState(e.state),F=L==null?void 0:L.decorationId,X=_.dom.querySelector(`[data-decoration-id="${F}"]`);return(X==null?void 0:X.getBoundingClientRect())||null}:E;function R(_,P){var L;try{const X=t.getState(_.state),te=X!=null&&X.decorationId?_.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`):null,ue={editor:e,range:(X==null?void 0:X.range)||{from:0,to:0},query:(X==null?void 0:X.query)||null,text:(X==null?void 0:X.text)||null,items:[],command:ae=>m({editor:e,range:(X==null?void 0:X.range)||{from:0,to:0},props:ae}),decorationNode:te,clientRect:T(_,te)};(L=C==null?void 0:C.onExit)==null||L.call(C,ue)}catch{}const F=_.state.tr.setMeta(P,{exit:!0});_.dispatch(F)}const D=new Kt({key:t,view(){return{update:async(_,P)=>{var L,F,X,te,ue,ae,I;const O=(L=this.key)==null?void 0:L.getState(P),G=(F=this.key)==null?void 0:F.getState(_.state),z=O.active&&G.active&&O.range.from!==G.range.from,re=!O.active&&G.active,K=O.active&&!G.active,$=!re&&!K&&O.query!==G.query,H=re||z&&$,oe=$||z,q=K||z&&$;if(!H&&!oe&&!q)return;const me=q&&!H?O:G,Z=_.dom.querySelector(`[data-decoration-id="${me.decorationId}"]`);k={editor:e,range:me.range,query:me.query,text:me.text,items:[],command:ce=>m({editor:e,range:me.range,props:ce}),decorationNode:Z,clientRect:T(_,Z)},H&&((X=C==null?void 0:C.onBeforeStart)==null||X.call(C,k)),oe&&((te=C==null?void 0:C.onBeforeUpdate)==null||te.call(C,k)),(oe||H)&&(k.items=await g({editor:e,query:me.query})),q&&((ue=C==null?void 0:C.onExit)==null||ue.call(C,k)),oe&&((ae=C==null?void 0:C.onUpdate)==null||ae.call(C,k)),H&&((I=C==null?void 0:C.onStart)==null||I.call(C,k))},destroy:()=>{var _;k&&((_=C==null?void 0:C.onExit)==null||_.call(C,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(_,P,L,F){const{isEditable:X}=e,{composing:te}=e.view,{selection:ue}=_,{empty:ae,from:I}=ue,O={...P},G=_.getMeta(t);if(G&&G.exit)return O.active=!1,O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null,O;if(O.composing=te,X&&(ae||e.view.composing)){(IP.range.to)&&!te&&!P.composing&&(O.active=!1);const z=w({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:ue.$from}),re=`id_${Math.floor(Math.random()*4294967295)}`;z&&N({editor:e,state:F,range:z.range,isActive:P.active})&&(!v||v({editor:e,range:z.range,query:z.query,text:z.text,transaction:_}))?(O.active=!0,O.decorationId=P.decorationId?P.decorationId:re,O.range=z.range,O.query=z.query,O.text=z.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(_,P){var L,F,X,te;const{active:ue,range:ae}=D.getState(_.state);if(!ue)return!1;if(P.key==="Escape"||P.key==="Esc"){const O=D.getState(_.state),G=(L=k==null?void 0:k.decorationNode)!=null?L:null,z=G??(O!=null&&O.decorationId?_.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`):null);if(((F=C==null?void 0:C.onKeyDown)==null?void 0:F.call(C,{view:_,event:P,range:O.range}))||!1)return!0;const K={editor:e,range:O.range,query:O.query,text:O.text,items:[],command:$=>m({editor:e,range:O.range,props:$}),decorationNode:z,clientRect:z?()=>z.getBoundingClientRect()||null:null};return(X=C==null?void 0:C.onExit)==null||X.call(C,K),R(_,t),!0}return((te=C==null?void 0:C.onKeyDown)==null?void 0:te.call(C,{view:_,event:P,range:ae}))||!1},decorations(_){const{active:P,range:L,decorationId:F,query:X}=D.getState(_);if(!P)return null;const te=!(X!=null&&X.length),ue=[u];return te&&ue.push(f),zt.create(_.doc,[Mn.inline(L.from,L.to,{nodeName:c,class:ue.join(" "),"data-decoration-id":F,"data-decoration-content":h})])}}});return D}function _z({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new tn;return{editor:t,char:r,pluginKey:a,command:({editor:i,range:o,props:c})=>{var u,h,f;const m=i.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=i.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:i,range:o})=>{const c=i.doc.resolve(o.from),u=i.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function CC(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>_z({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function WN(t,e){const n=CC(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var zz=Sn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,a;return["span",kt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(a=e.attrs.label)!=null?a:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=WN(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",kt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=kt({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",kt({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...q2({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r,c=i??o;e[a==="char"?"mentionSuggestionChar":a]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:WN(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:a,anchor:i}=r;if(!a)return!1;let o=new wa,c=0;return e.doc.nodesBetween(i-1,i,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return CC(this).map(Lz)}}),Fz=zz,$z=Cz;let bx,vx;if(typeof WeakMap<"u"){let t=new WeakMap;bx=e=>t.get(e),vx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;bx=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var pn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:k-E});break}const T=a+E*e;for(let R=0;Rr&&(i+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Hz(t,e,n){t.problems||(t.problems=[]);const r={};for(let a=0;a0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Uz(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Ms(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function _f(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=jo(e.$head)||Kz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Kz(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Nx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function qz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function K0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function EC(t,e,n){const r=t.node(-1),a=pn.get(r),i=t.start(-1),o=a.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function ko(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(a=>a>0)||(r.colwidth=null)),r}function TC(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let a=0;af!=n.pos-i);u.unshift(n.pos-i);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i+f+1;return new xS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(Nx(r)&&Nx(a)&&K0(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?xa.rowSelection(r,a):i&&this.isColSelection()?xa.colSelection(r,a):new xa(r,a)}return Qe.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=pn.get(e),r=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=a.top;u0||v>0){let k=N.attrs;if(w>0&&(k=ko(k,0,w)),v>0&&(k=ko(k,k.colspan-v,v)),y.lefta.bottom){const k={...N.attrs,rowspan:Math.min(y.bottom,a.bottom)-Math.max(y.top,a.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),a=pn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(i+a.map[o.left])),c.bottom0&&(n=u.resolve(i+a.map[c.left])),o.bottom0)return!1;const o=a+this.$anchorCell.nodeAfter.attrs.colspan,c=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof xa&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=pn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(i+a.map[o.top*a.width])),c.right0&&(n=u.resolve(i+a.map[c.top*a.width])),o.right{e.push(Mn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),zt.create(t.doc,e)}function Qz({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(a+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(a).type.spec.tableRole)}function Xz({$from:t,$to:e}){let n,r;for(let a=t.depth;a>0;a--){const i=t.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let a=e.depth;a>0;a--){const i=e.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function Zz(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof Ge&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=Ut.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=Ut.rowSelection(c,c)}else if(!n){const c=pn.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=Ut.create(a,u+1,h)}}else r instanceof Qe&&Qz(r)?i=Qe.create(a,r.from):r instanceof Qe&&Xz(r)&&(i=Qe.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const eF=new tn("fix-tables");function AC(t,e,n,r){const a=t.childCount,i=e.childCount;e:for(let o=0,c=0;o{a.type.spec.tableRole=="table"&&(n=tF(t,a,i,n))};return e?e.doc!=t.doc&&AC(e.doc,t.doc,0,r):t.doc.descendants(r),n}function tF(t,e,n,r){const a=pn.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let y="cell";f.firstChild&&(y=f.firstChild.type.spec.tableRole);const N=[];for(let v=0;v0?-1:0;Gz(e,r,a+i)&&(i=a==0||a==e.width?null:0);for(let o=0;o0&&a0&&e.map[c-1]==u||a0?-1:0;iF(e,r,a+c)&&(c=a==0||a==e.height?null:0);for(let h=0,f=e.width*a;h0&&a0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(a0&&n[i]==n[i-1]||r.right0&&n[a]==n[a-t]||r.bottom0){const f=u+1+h.content.size,m=UN(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new Ut(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function qN(t,e){const n=hr(t.schema);return hF(({node:r})=>n[r.type.spec.tableRole])(t,e)}function hF(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof Ut){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=Uz(r.$from),!a)return!1;i=(o=jo(r.$from))===null||o===void 0?void 0:o.pos}if(a==null||i==null||a.attrs.colspan==1&&a.attrs.rowspan==1)return!1;if(n){let c=a.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Js(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&i.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function pF(t){return function(e,n){if(!Ms(e))return!1;if(n){const r=hr(e.schema),a=Js(e),i=e.tr,o=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),c=o.map(u=>a.table.nodeAt(u));for(let u=0;u{const y=g+i.tableStart,N=o.doc.nodeAt(y);N&&o.setNodeMarkup(y,m,N.attrs)}),r(o)}return!0}}ud("row",{useDeprecatedLogic:!0});ud("column",{useDeprecatedLogic:!0});const mF=ud("cell",{useDeprecatedLogic:!0});function gF(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,a=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return a-1-o.nodeSize;a-=i.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Ku(t,e){const n=t.selection;if(!(n instanceof Ut))return!1;if(e){const r=t.tr,a=hr(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(a)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new Ie(a,0,0))}),r.docChanged&&e(r)}return!0}function yF(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const a=e.child(0),i=a.type.spec.tableRole,o=a.type.schema,c=[];if(i=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=i.child(o).attrs;for(let h=a;h=e.length&&e.push(xe.empty),n[a]r&&(g=g.type.createChecked(ko(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;ya&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(xe.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function NF(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=hr(c);let h,f;if(a>e.width)for(let m=0,g=0;me.height){const m=[];for(let N=0,w=(e.height-1)*e.width;N=e.width?!1:n.nodeAt(e.map[w+N]).type==u.header_cell;m.push(v?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,xe.from(m)),y=[];for(let N=e.height;N{if(!a)return!1;const i=n.selection;if(i instanceof Ut)return sh(n,r,rt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=OC(a,t,e);if(o==null)return!1;if(t=="horiz")return sh(n,r,rt.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=EC(c,t,e);let h;return u?h=rt.near(u,1):e<0?h=rt.near(n.doc.resolve(c.before(-1)),-1):h=rt.near(n.doc.resolve(c.after(-1)),1),sh(n,r,h)}}}function Gu(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof Ut)o=i;else{const u=OC(a,t,e);if(u==null)return!1;o=new Ut(n.doc.resolve(u))}const c=EC(o.$headCell,t,e);return c?sh(n,r,new Ut(o.$anchorCell,c)):!1}}function jF(t,e){const n=t.state.doc,r=jo(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ut(r))),!0):!1}function kF(t,e,n){if(!Ms(t.state))return!1;let r=yF(n);const a=t.state.selection;if(a instanceof Ut){r||(r={width:1,height:1,rows:[xe.from(wx(hr(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=pn.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=vF(r,c.right-c.left,c.bottom-c.top),XN(t.state,t.dispatch,o,c,r),!0}else if(r){const i=_f(t.state),o=i.start(-1);return XN(t.state,t.dispatch,o,pn.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function SF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=ZN(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof Ut)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=jo(t.state.selection.$anchor))!=null&&((n=xg(t,e))===null||n===void 0?void 0:n.pos)!=a.pos)i(a,e),e.preventDefault();else if(!r)return;function i(u,h){let f=xg(t,h);const m=ii.getState(t.state)==null;if(!f||!K0(u,f))if(m)f=u;else return;const g=new Ut(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(ii,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),ii.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ii,-1))}function c(u){const h=u,f=ii.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(ZN(t,h.target)!=r&&(m=xg(t,e),!m))return o();m&&i(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function OC(t,e,n){if(!(t.state.selection instanceof Qe))return null;const{$head:r}=t.state.selection;for(let a=r.depth-1;a>=0;a--){const i=r.node(a);if((n<0?r.index(a):r.indexAfter(a))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(a),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function ZN(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function xg(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:a}=n;return r>=0&&jo(t.state.doc.resolve(r))||jo(t.state.doc.resolve(a))}var CF=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),jx(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,jx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function jx(t,e,n,r,a,i){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new TF(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=$r.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{MF(o,c,t,a)},mouseleave:o=>{AF(o)},mousedown:(o,c)=>{IF(o,c,e,n)}},decorations:o=>{const c=$r.getState(o);if(c&&c.activeHandle>-1)return LF(o,c.activeHandle)},nodeViews:{}}});return i}var TF=class ah{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta($r);if(r&&r.setHandle!=null)return new ah(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ah(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return Nx(e.doc.resolve(a))||(a=-1),new ah(a,n.dragging)}return n}};function MF(t,e,n,r){if(!t.editable)return;const a=$r.getState(t.state);if(a&&!a.dragging){const i=PF(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=ew(t,e,"left",n):u-e.clientX<=n&&(o=ew(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=pn.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}DC(t,o)}}}function AF(t){if(!t.editable)return;const e=$r.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&DC(t,-1)}function IF(t,e,n,r){var a;if(!t.editable)return!1;const i=(a=t.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,o=$r.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=RF(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta($r,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const g=$r.getState(t.state);g!=null&&g.dragging&&(OF(t,g.activeHandle,tw(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta($r,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=$r.getState(t.state);if(g&&g.dragging){const y=tw(g.dragging,m,n);nw(t,g.activeHandle,y,r)}}return nw(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function RF(t,e,{colspan:n,colwidth:r}){const a=r&&r[r.length-1];if(a)return a;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),a=r?r.split(",").map(i=>parseInt(i,10)):null;if(!a){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const c=i[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return a}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",kt(this.options.HTMLAttributes,t),0]}}),_C=Sn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",kt(this.options.HTMLAttributes,t),0]}}),zC=Sn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",kt(this.options.HTMLAttributes,t),0]}});function kx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function rw(t,e,n,r,a,i){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,y=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function BF(t,e,n,r,a){const i=$F(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!VF(e))return!1;let n=0;const r=N2(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},HF="";function WF(t){return(t||"").replace(/\s+/g," ").trim()}function UF(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:HF;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(N=>{const w=[];N.content&&N.content.forEach(v=>{let k="";v.content&&Array.isArray(v.content)&&v.content.length>1?k=v.content.map(R=>e.renderChildren(R)).join(a):k=v.content?e.renderChildren(v.content):"";const C=WF(k),E=v.type==="tableHeader";w.push({text:C,isHeader:E})}),i.push(w)});const o=i.reduce((N,w)=>Math.max(N,w.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(N=>{var w;for(let v=0;vc[v]&&(c[v]=C),c[v]<3&&(c[v]=3)}});const u=(N,w)=>N+" ".repeat(Math.max(0,w-N.length)),h=i[0],f=h.some(N=>N.isHeader);let m=` -`;const g=new Array(o).fill(0).map((N,w)=>f&&h[w]&&h[w].text||"");return m+=`| ${g.map((N,w)=>u(N,c[w])).join(" | ")} | -`,m+=`| ${c.map(N=>"-".repeat(Math.max(3,N))).join(" | ")} | -`,(f?i.slice(1):i).forEach(N=>{m+=`| ${new Array(o).fill(0).map((w,v)=>u(N[v]&&N[v].text||"",c[v])).join(" | ")} | -`}),m}var KF=UF,FC=Sn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:zF,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:a}=FF(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",kt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(a=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const a=[];r.forEach(i=>{a.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},a))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>KF(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=BF(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Qe.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>nF(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>rF(t,e),deleteColumn:()=>({state:t,dispatch:e})=>aF(t,e),addRowBefore:()=>({state:t,dispatch:e})=>oF(t,e),addRowAfter:()=>({state:t,dispatch:e})=>lF(t,e),deleteRow:()=>({state:t,dispatch:e})=>dF(t,e),deleteTable:()=>({state:t,dispatch:e})=>xF(t,e),mergeCells:()=>({state:t,dispatch:e})=>KN(t,e),splitCell:()=>({state:t,dispatch:e})=>qN(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ud("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ud("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>mF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>KN(t,e)?!0:qN(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>fF(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>JN(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>JN(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&IC(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Ut.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ju,"Mod-Backspace":Ju,Delete:Ju,"Mod-Delete":Ju}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[EF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],_F({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:jt(We(t,"tableRole",e))}}});mn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(FC.configure(this.options.table)),this.options.tableCell!==!1&&t.push(LC.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(_C.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(zC.configure(this.options.tableRow)),t}});function qF(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 - -`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 - -`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 - -`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 - -`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 -`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` -`),e=e.replace(//gi,` -`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 - -`),e=e.replace(//gi,`--- - -`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` - -`),e.trim()}function aw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),e=e.replace(/^## (.+)$/gm,"

    $1

    "),e=e.replace(/^# (.+)$/gm,"

    $1

    "),e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/\*(.+?)\*/g,"$1"),e=e.replace(/~~(.+?)~~/g,"$1"),e=e.replace(/`([^`]+)`/g,"$1"),e=e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'$1'),e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'$1'),e=e.replace(/^> (.+)$/gm,"

    $1

    "),e=e.replace(/^---$/gm,"
    "),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` -`),r=[];for(const a of n){const i=a.trim();i&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(i)?r.push(i):r.push(`

    ${i}

    `))}return r.join("")}const GF=Sn.create({name:"linkTag",group:"inline",inline:!0,selectable:!0,atom:!0,addAttributes(){return{label:{default:""},url:{default:""},tagType:{default:"url",parseHTML:t=>t.getAttribute("data-tag-type")||"url"},tagId:{default:"",parseHTML:t=>t.getAttribute("data-tag-id")||""},pagePath:{default:"",parseHTML:t=>t.getAttribute("data-page-path")||""},appId:{default:"",parseHTML:t=>t.getAttribute("data-app-id")||""},mpKey:{default:"",parseHTML:t=>t.getAttribute("data-mp-key")||""}}},parseHTML(){return[{tag:'span[data-type="linkTag"]',getAttrs:t=>{var e;return{label:((e=t.textContent)==null?void 0:e.replace(/^#/,"").trim())||"",url:t.getAttribute("data-url")||"",tagType:t.getAttribute("data-tag-type")||"url",tagId:t.getAttribute("data-tag-id")||"",pagePath:t.getAttribute("data-page-path")||"",appId:t.getAttribute("data-app-id")||"",mpKey:t.getAttribute("data-mp-key")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",kt(e,{"data-type":"linkTag","data-url":t.attrs.url,"data-tag-type":t.attrs.tagType,"data-tag-id":t.attrs.tagId,"data-page-path":t.attrs.pagePath,"data-app-id":t.attrs.appId||"","data-mp-key":t.attrs.mpKey||t.attrs.appId||"",class:"link-tag-node"}),`#${t.attrs.label}`]}});function iw(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}const JF=t=>({items:({query:e})=>t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase())||n.id.includes(e)).slice(0,8),render:()=>{let e=null,n=0,r=[],a=null;const i=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    - @${iw(o.name)} - ${iw(o.label||o.id)} -
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");a&&r[c]&&a({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,a=o.command,n=0,i(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,a=o.command,n=0,i(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),i(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),i(),!0):o.event.key==="Enter"?(a&&r[n]&&a({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}});function YF(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let a=0;a{const u=b.useRef(null),h=b.useRef(null),[f,m]=b.useState(""),[g,y]=b.useState(!1),N=b.useRef(aw(t)),w=b.useCallback((T,R)=>{var L;const D=h.current;if(!D||!n)return!1;const _=YF(R);if(_.length>0)return R.preventDefault(),(async()=>{for(const F of _)try{const X=await n(F);X&&D.chain().focus().setImage({src:X}).run()}catch(X){console.error("粘贴图片上传失败",X)}})(),!0;const P=(L=R.clipboardData)==null?void 0:L.getData("text/html");if(P&&/data:image\/[^;"']+;base64,/i.test(P)){R.preventDefault();const{from:F,to:X}=D.state.selection;return(async()=>{try{const te=await ZF(P,n);D.chain().focus().insertContentAt({from:F,to:X},te).run()}catch(te){console.error("粘贴 HTML 内 base64 转换失败",te)}})(),!0}return!1},[n]),v=H_({extensions:[Az.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),Pz.configure({inline:!0,allowBase64:!0}),Fz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:JF(r)}),GF,$z.configure({placeholder:i}),FC.configure({resizable:!0}),zC,LC,_C],content:N.current,onUpdate:({editor:T})=>{e(T.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:w}});b.useEffect(()=>{h.current=v??null},[v]),b.useImperativeHandle(c,()=>({getHTML:()=>(v==null?void 0:v.getHTML())||"",getMarkdown:()=>qF((v==null?void 0:v.getHTML())||"")})),b.useEffect(()=>{if(v&&t!==v.getHTML()){const T=aw(t);T!==v.getHTML()&&v.commands.setContent(T)}},[t]);const k=b.useCallback(async T=>{var D;const R=(D=T.target.files)==null?void 0:D[0];if(!(!R||!v)){if(n){const _=await n(R);_&&v.chain().focus().setImage({src:_}).run()}else{const _=new FileReader;_.onload=()=>{typeof _.result=="string"&&v.chain().focus().setImage({src:_.result}).run()},_.readAsDataURL(R)}T.target.value=""}},[v,n]),C=b.useCallback(T=>{v&&v.chain().focus().insertContent({type:"linkTag",attrs:{label:T.label,url:T.url||"",tagType:T.type||"url",tagId:T.id||"",pagePath:T.pagePath||"",appId:T.appId||"",mpKey:T.type==="miniprogram"&&T.appId||""}}).run()},[v]),E=b.useCallback(()=>{!v||!f||(v.chain().focus().setLink({href:f}).run(),m(""),y(!1))},[v,f]);return v?s.jsxs("div",{className:`rich-editor-wrapper ${o||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"is-active":"",type:"button",children:s.jsx(BT,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"is-active":"",type:"button",children:s.jsx($M,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleStrike().run(),className:v.isActive("strike")?"is-active":"",type:"button",children:s.jsx(LA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"is-active":"",type:"button",children:s.jsx(lM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(AM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(RM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(OM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(JM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(qM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(NA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(iA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:k,className:"hidden"}),s.jsx("button",{onClick:()=>{var T;return(T=u.current)==null?void 0:T.click()},type:"button",children:s.jsx(Xw,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>y(!g),className:v.isActive("link")?"is-active":"",type:"button",children:s.jsx(Ig,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:s.jsx(zA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:s.jsx(UA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:s.jsx(jA,{className:"w-4 h-4"})})]}),a.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"toolbar-divider"}),s.jsx("div",{className:"toolbar-group",children:s.jsxs("select",{className:"link-tag-select",onChange:T=>{const R=a.find(D=>D.id===T.target.value);R&&C(R),T.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),a.map(T=>s.jsx("option",{value:T.id,children:T.label},T.id))]})})]})]}),g&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:f,onChange:T=>m(T.target.value),onKeyDown:T=>T.key==="Enter"&&E(),className:"link-input"}),s.jsx("button",{onClick:E,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{v.chain().focus().unsetLink().run(),y(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(Y2,{editor:v})]}):null});Sx.displayName="RichEditor";const e$=["top","right","bottom","left"],wi=Math.min,zr=Math.max,sf=Math.round,Yu=Math.floor,Ws=t=>({x:t,y:t}),t$={left:"right",right:"left",bottom:"top",top:"bottom"},n$={start:"end",end:"start"};function Cx(t,e,n){return zr(t,wi(e,n))}function Sa(t,e){return typeof t=="function"?t(e):t}function Ca(t){return t.split("-")[0]}function $l(t){return t.split("-")[1]}function q0(t){return t==="x"?"y":"x"}function G0(t){return t==="y"?"height":"width"}const r$=new Set(["top","bottom"]);function Hs(t){return r$.has(Ca(t))?"y":"x"}function J0(t){return q0(Hs(t))}function s$(t,e,n){n===void 0&&(n=!1);const r=$l(t),a=J0(t),i=G0(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=af(o)),[o,af(o)]}function a$(t){const e=af(t);return[Ex(t),e,Ex(e)]}function Ex(t){return t.replace(/start|end/g,e=>n$[e])}const ow=["left","right"],lw=["right","left"],i$=["top","bottom"],o$=["bottom","top"];function l$(t,e,n){switch(t){case"top":case"bottom":return n?e?lw:ow:e?ow:lw;case"left":case"right":return e?i$:o$;default:return[]}}function c$(t,e,n,r){const a=$l(t);let i=l$(Ca(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(Ex)))),i}function af(t){return t.replace(/left|right|bottom|top/g,e=>t$[e])}function d$(t){return{top:0,right:0,bottom:0,left:0,...t}}function $C(t){return typeof t!="number"?d$(t):{top:t,right:t,bottom:t,left:t}}function of(t){const{x:e,y:n,width:r,height:a}=t;return{width:r,height:a,top:n,left:e,right:e+r,bottom:n+a,x:e,y:n}}function cw(t,e,n){let{reference:r,floating:a}=t;const i=Hs(e),o=J0(e),c=G0(o),u=Ca(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=r[c]/2-a[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-a.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-a.width,y:m};break;default:y={x:r.x,y:r.y}}switch($l(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function u$(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:i,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Sa(e,t),N=$C(y),v=c[g?m==="floating"?"reference":"floating":m],k=of(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),C=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),T=await(i.isElement==null?void 0:i.isElement(E))?await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1}:{x:1,y:1},R=of(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:C,offsetParent:E,strategy:u}):C);return{top:(k.top-R.top+N.top)/T.y,bottom:(R.bottom-k.bottom+N.bottom)/T.y,left:(k.left-R.left+N.left)/T.x,right:(R.right-k.right+N.right)/T.x}}const h$=async(t,e,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,c=i.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:a}),{x:f,y:m}=cw(h,r,u),g=r,y={},N=0;for(let v=0;v({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Sa(t,e)||{};if(h==null)return{};const m=$C(f),g={x:n,y:r},y=J0(a),N=G0(y),w=await o.getDimensions(h),v=y==="y",k=v?"top":"left",C=v?"bottom":"right",E=v?"clientHeight":"clientWidth",T=i.reference[N]+i.reference[y]-g[y]-i.floating[N],R=g[y]-i.reference[y],D=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let _=D?D[E]:0;(!_||!await(o.isElement==null?void 0:o.isElement(D)))&&(_=c.floating[E]||i.floating[N]);const P=T/2-R/2,L=_/2-w[N]/2-1,F=wi(m[k],L),X=wi(m[C],L),te=F,ue=_-w[N]-X,ae=_/2-w[N]/2+P,I=Cx(te,ae,ue),O=!u.arrow&&$l(a)!=null&&ae!==I&&i.reference[N]/2-(aeae<=0)){var X,te;const ae=(((X=i.flip)==null?void 0:X.index)||0)+1,I=_[ae];if(I&&(!(m==="alignment"?C!==Hs(I):!1)||F.every(z=>Hs(z.placement)===C?z.overflows[0]>0:!0)))return{data:{index:ae,overflows:F},reset:{placement:I}};let O=(te=F.filter(G=>G.overflows[0]<=0).sort((G,z)=>G.overflows[1]-z.overflows[1])[0])==null?void 0:te.placement;if(!O)switch(y){case"bestFit":{var ue;const G=(ue=F.filter(z=>{if(D){const re=Hs(z.placement);return re===C||re==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(re=>re>0).reduce((re,K)=>re+K,0)]).sort((z,re)=>z[1]-re[1])[0])==null?void 0:ue[0];G&&(O=G);break}case"initialPlacement":O=c;break}if(a!==O)return{reset:{placement:O}}}return{}}}};function dw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function uw(t){return e$.some(e=>t[e]>=0)}const m$=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Sa(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=dw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:uw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=dw(o,n.floating);return{data:{escapedOffsets:c,escaped:uw(c)}}}default:return{}}}}},BC=new Set(["left","top"]);async function g$(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Ca(n),c=$l(n),u=Hs(n)==="y",h=BC.has(o)?-1:1,f=i&&u?-1:1,m=Sa(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:N}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof N=="number"&&(y=c==="end"?N*-1:N),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const x$=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:a,y:i,placement:o,middlewareData:c}=e,u=await g$(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:a+u.x,y:i+u.y,data:{...u,placement:o}}}}},y$=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a,platform:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:C,y:E}=k;return{x:C,y:E}}},...h}=Sa(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=Hs(Ca(a)),y=q0(g);let N=f[y],w=f[g];if(o){const k=y==="y"?"top":"left",C=y==="y"?"bottom":"right",E=N+m[k],T=N-m[C];N=Cx(E,N,T)}if(c){const k=g==="y"?"top":"left",C=g==="y"?"bottom":"right",E=w+m[k],T=w-m[C];w=Cx(E,w,T)}const v=u.fn({...e,[y]:N,[g]:w});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[y]:o,[g]:c}}}}}},b$=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:a,rects:i,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Sa(t,e),f={x:n,y:r},m=Hs(a),g=q0(m);let y=f[g],N=f[m];const w=Sa(c,e),v=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const E=g==="y"?"height":"width",T=i.reference[g]-i.floating[E]+v.mainAxis,R=i.reference[g]+i.reference[E]-v.mainAxis;yR&&(y=R)}if(h){var k,C;const E=g==="y"?"width":"height",T=BC.has(Ca(a)),R=i.reference[m]-i.floating[E]+(T&&((k=o.offset)==null?void 0:k[m])||0)+(T?0:v.crossAxis),D=i.reference[m]+i.reference[E]+(T?0:((C=o.offset)==null?void 0:C[m])||0)-(T?v.crossAxis:0);ND&&(N=D)}return{[g]:y,[m]:N}}}},v$=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:a,rects:i,platform:o,elements:c}=e,{apply:u=()=>{},...h}=Sa(t,e),f=await o.detectOverflow(e,h),m=Ca(a),g=$l(a),y=Hs(a)==="y",{width:N,height:w}=i.floating;let v,k;m==="top"||m==="bottom"?(v=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,v=g==="end"?"top":"bottom");const C=w-f.top-f.bottom,E=N-f.left-f.right,T=wi(w-f[v],C),R=wi(N-f[k],E),D=!e.middlewareData.shift;let _=T,P=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(_=C),D&&!g){const F=zr(f.left,0),X=zr(f.right,0),te=zr(f.top,0),ue=zr(f.bottom,0);y?P=N-2*(F!==0||X!==0?F+X:zr(f.left,f.right)):_=w-2*(te!==0||ue!==0?te+ue:zr(f.top,f.bottom))}await u({...e,availableWidth:P,availableHeight:_});const L=await o.getDimensions(c.floating);return N!==L.width||w!==L.height?{reset:{rects:!0}}:{}}}};function zf(){return typeof window<"u"}function Bl(t){return VC(t)?(t.nodeName||"").toLowerCase():"#document"}function Hr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ys(t){var e;return(e=(VC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function VC(t){return zf()?t instanceof Node||t instanceof Hr(t).Node:!1}function Cs(t){return zf()?t instanceof Element||t instanceof Hr(t).Element:!1}function Gs(t){return zf()?t instanceof HTMLElement||t instanceof Hr(t).HTMLElement:!1}function hw(t){return!zf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Hr(t).ShadowRoot}const N$=new Set(["inline","contents"]);function wd(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=Es(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!N$.has(a)}const w$=new Set(["table","td","th"]);function j$(t){return w$.has(Bl(t))}const k$=[":popover-open",":modal"];function Ff(t){return k$.some(e=>{try{return t.matches(e)}catch{return!1}})}const S$=["transform","translate","scale","rotate","perspective"],C$=["transform","translate","scale","rotate","perspective","filter"],E$=["paint","layout","strict","content"];function Y0(t){const e=Q0(),n=Cs(t)?Es(t):t;return S$.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||C$.some(r=>(n.willChange||"").includes(r))||E$.some(r=>(n.contain||"").includes(r))}function T$(t){let e=ji(t);for(;Gs(e)&&!Il(e);){if(Y0(e))return e;if(Ff(e))return null;e=ji(e)}return null}function Q0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const M$=new Set(["html","body","#document"]);function Il(t){return M$.has(Bl(t))}function Es(t){return Hr(t).getComputedStyle(t)}function $f(t){return Cs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ji(t){if(Bl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||hw(t)&&t.host||Ys(t);return hw(e)?e.host:e}function HC(t){const e=ji(t);return Il(e)?t.ownerDocument?t.ownerDocument.body:t.body:Gs(e)&&wd(e)?e:HC(e)}function hd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=HC(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Hr(a);if(i){const c=Tx(o);return e.concat(o,o.visualViewport||[],wd(a)?a:[],c&&n?hd(c):[])}return e.concat(a,hd(a,[],n))}function Tx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function WC(t){const e=Es(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Gs(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=sf(n)!==i||sf(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function X0(t){return Cs(t)?t:t.contextElement}function Nl(t){const e=X0(t);if(!Gs(e))return Ws(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=WC(e);let o=(i?sf(n.width):n.width)/r,c=(i?sf(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const A$=Ws(0);function UC(t){const e=Hr(t);return!Q0()||!e.visualViewport?A$:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function I$(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Hr(t)?!1:e}function So(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=X0(t);let o=Ws(1);e&&(r?Cs(r)&&(o=Nl(r)):o=Nl(t));const c=I$(i,n,r)?UC(i):Ws(0);let u=(a.left+c.x)/o.x,h=(a.top+c.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=Hr(i),y=r&&Cs(r)?Hr(r):r;let N=g,w=Tx(N);for(;w&&r&&y!==N;){const v=Nl(w),k=w.getBoundingClientRect(),C=Es(w),E=k.left+(w.clientLeft+parseFloat(C.paddingLeft))*v.x,T=k.top+(w.clientTop+parseFloat(C.paddingTop))*v.y;u*=v.x,h*=v.y,f*=v.x,m*=v.y,u+=E,h+=T,N=Hr(w),w=Tx(N)}}return of({width:f,height:m,x:u,y:h})}function Bf(t,e){const n=$f(t).scrollLeft;return e?e.left+n:So(Ys(t)).left+n}function KC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Bf(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function R$(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Ys(r),c=e?Ff(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Ws(1);const f=Ws(0),m=Gs(r);if((m||!m&&!i)&&((Bl(r)!=="body"||wd(o))&&(u=$f(r)),Gs(r))){const y=So(r);h=Nl(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!i?KC(o,u):Ws(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function P$(t){return Array.from(t.getClientRects())}function O$(t){const e=Ys(t),n=$f(t),r=t.ownerDocument.body,a=zr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=zr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Bf(t);const c=-n.scrollTop;return Es(r).direction==="rtl"&&(o+=zr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const fw=25;function D$(t,e){const n=Hr(t),r=Ys(t),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,c=0,u=0;if(a){i=a.width,o=a.height;const f=Q0();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=Bf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,N=Math.abs(r.clientWidth-m.clientWidth-y);N<=fw&&(i-=N)}else h<=fw&&(i+=h);return{width:i,height:o,x:c,y:u}}const L$=new Set(["absolute","fixed"]);function _$(t,e){const n=So(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Gs(t)?Nl(t):Ws(1),o=t.clientWidth*i.x,c=t.clientHeight*i.y,u=a*i.x,h=r*i.y;return{width:o,height:c,x:u,y:h}}function pw(t,e,n){let r;if(e==="viewport")r=D$(t,n);else if(e==="document")r=O$(Ys(t));else if(Cs(e))r=_$(e,n);else{const a=UC(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return of(r)}function qC(t,e){const n=ji(t);return n===e||!Cs(n)||Il(n)?!1:Es(n).position==="fixed"||qC(n,e)}function z$(t,e){const n=e.get(t);if(n)return n;let r=hd(t,[],!1).filter(c=>Cs(c)&&Bl(c)!=="body"),a=null;const i=Es(t).position==="fixed";let o=i?ji(t):t;for(;Cs(o)&&!Il(o);){const c=Es(o),u=Y0(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&L$.has(a.position)||wd(o)&&!u&&qC(t,o))?r=r.filter(f=>f!==o):a=c,o=ji(o)}return e.set(t,r),r}function F$(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Ff(e)?[]:z$(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=pw(e,f,a);return h.top=zr(m.top,h.top),h.right=wi(m.right,h.right),h.bottom=wi(m.bottom,h.bottom),h.left=zr(m.left,h.left),h},pw(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function $$(t){const{width:e,height:n}=WC(t);return{width:e,height:n}}function B$(t,e,n){const r=Gs(e),a=Ys(e),i=n==="fixed",o=So(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Ws(0);function h(){u.x=Bf(a)}if(r||!r&&!i)if((Bl(e)!=="body"||wd(a))&&(c=$f(e)),r){const y=So(e,!0,i,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else a&&h();i&&!r&&a&&h();const f=a&&!r&&!i?KC(a,c):Ws(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function yg(t){return Es(t).position==="static"}function mw(t,e){if(!Gs(t)||Es(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ys(t)===n&&(n=n.ownerDocument.body),n}function GC(t,e){const n=Hr(t);if(Ff(t))return n;if(!Gs(t)){let a=ji(t);for(;a&&!Il(a);){if(Cs(a)&&!yg(a))return a;a=ji(a)}return n}let r=mw(t,e);for(;r&&j$(r)&&yg(r);)r=mw(r,e);return r&&Il(r)&&yg(r)&&!Y0(r)?n:r||T$(t)||n}const V$=async function(t){const e=this.getOffsetParent||GC,n=this.getDimensions,r=await n(t.floating);return{reference:B$(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function H$(t){return Es(t).direction==="rtl"}const W$={convertOffsetParentRelativeRectToViewportRelativeRect:R$,getDocumentElement:Ys,getClippingRect:F$,getOffsetParent:GC,getElementRects:V$,getClientRects:P$,getDimensions:$$,getScale:Nl,isElement:Cs,isRTL:H$};function JC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function U$(t,e){let n=null,r;const a=Ys(t);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const N=Yu(m),w=Yu(a.clientWidth-(f+g)),v=Yu(a.clientHeight-(m+y)),k=Yu(f),E={rootMargin:-N+"px "+-w+"px "+-v+"px "+-k+"px",threshold:zr(0,wi(1,u))||1};let T=!0;function R(D){const _=D[0].intersectionRatio;if(_!==u){if(!T)return o();_?o(!1,_):r=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!JC(h,t.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(R,{...E,root:a.ownerDocument})}catch{n=new IntersectionObserver(R,E)}n.observe(t)}return o(!0),i}function K$(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=X0(t),f=a||i?[...h?hd(h):[],...hd(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?U$(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[C]=k;C&&C.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let N,w=u?So(t):null;u&&v();function v(){const k=So(t);w&&!JC(w,k)&&n(),w=k,N=requestAnimationFrame(v)}return n(),()=>{var k;f.forEach(C=>{a&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(N)}}const q$=x$,G$=y$,J$=p$,Y$=v$,Q$=m$,gw=f$,X$=b$,Z$=(t,e,n)=>{const r=new Map,a={platform:W$,...n},i={...a.platform,_c:r};return h$(t,e,{...a,platform:i})};var eB=typeof document<"u",tB=function(){},ih=eB?b.useLayoutEffect:tB;function lf(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!lf(t[r],e[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&t.$$typeof)&&!lf(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function YC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function xw(t,e){const n=YC(t);return Math.round(e*n)/n}function bg(t){const e=b.useRef(t);return ih(()=>{e.current=t}),e}function nB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);lf(g,r)||y(r);const[N,w]=b.useState(null),[v,k]=b.useState(null),C=b.useCallback(z=>{z!==D.current&&(D.current=z,w(z))},[]),E=b.useCallback(z=>{z!==_.current&&(_.current=z,k(z))},[]),T=i||N,R=o||v,D=b.useRef(null),_=b.useRef(null),P=b.useRef(f),L=u!=null,F=bg(u),X=bg(a),te=bg(h),ue=b.useCallback(()=>{if(!D.current||!_.current)return;const z={placement:e,strategy:n,middleware:g};X.current&&(z.platform=X.current),Z$(D.current,_.current,z).then(re=>{const K={...re,isPositioned:te.current!==!1};ae.current&&!lf(P.current,K)&&(P.current=K,pd.flushSync(()=>{m(K)}))})},[g,e,n,X,te]);ih(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const ae=b.useRef(!1);ih(()=>(ae.current=!0,()=>{ae.current=!1}),[]),ih(()=>{if(T&&(D.current=T),R&&(_.current=R),T&&R){if(F.current)return F.current(T,R,ue);ue()}},[T,R,ue,F,L]);const I=b.useMemo(()=>({reference:D,floating:_,setReference:C,setFloating:E}),[C,E]),O=b.useMemo(()=>({reference:T,floating:R}),[T,R]),G=b.useMemo(()=>{const z={position:n,left:0,top:0};if(!O.floating)return z;const re=xw(O.floating,f.x),K=xw(O.floating,f.y);return c?{...z,transform:"translate("+re+"px, "+K+"px)",...YC(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:re,top:K}},[n,c,O.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:ue,refs:I,elements:O,floatingStyles:G}),[f,ue,I,O,G])}const rB=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:a}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?gw({element:r.current,padding:a}).fn(n):{}:r?gw({element:r,padding:a}).fn(n):{}}}},sB=(t,e)=>({...q$(t),options:[t,e]}),aB=(t,e)=>({...G$(t),options:[t,e]}),iB=(t,e)=>({...X$(t),options:[t,e]}),oB=(t,e)=>({...J$(t),options:[t,e]}),lB=(t,e)=>({...Y$(t),options:[t,e]}),cB=(t,e)=>({...Q$(t),options:[t,e]}),dB=(t,e)=>({...rB(t),options:[t,e]});var uB="Arrow",QC=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(ut.svg,{...i,ref:e,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});QC.displayName=uB;var hB=QC,Z0="Popper",[XC,ZC]=Ei(Z0),[fB,e4]=XC(Z0),t4=t=>{const{__scopePopper:e,children:n}=t,[r,a]=b.useState(null);return s.jsx(fB,{scope:e,anchor:r,onAnchorChange:a,children:n})};t4.displayName=Z0;var n4="PopperAnchor",r4=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=e4(n4,n),o=b.useRef(null),c=St(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(ut.div,{...a,ref:c})});r4.displayName=n4;var ey="PopperContent",[pB,mB]=XC(ey),s4=b.forwardRef((t,e)=>{var ce,he,ve,Ae,Be,$e;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:N,...w}=t,v=e4(ey,n),[k,C]=b.useState(null),E=St(e,pt=>C(pt)),[T,R]=b.useState(null),D=e0(T),_=(D==null?void 0:D.width)??0,P=(D==null?void 0:D.height)??0,L=r+(i!=="center"?"-"+i:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},X=Array.isArray(h)?h:[h],te=X.length>0,ue={padding:F,boundary:X.filter(xB),altBoundary:te},{refs:ae,floatingStyles:I,placement:O,isPositioned:G,middlewareData:z}=nB({strategy:"fixed",placement:L,whileElementsMounted:(...pt)=>K$(...pt,{animationFrame:y==="always"}),elements:{reference:v.anchor},middleware:[sB({mainAxis:a+P,alignmentAxis:o}),u&&aB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?iB():void 0,...ue}),u&&oB({...ue}),lB({...ue,apply:({elements:pt,rects:Et,availableWidth:ln,availableHeight:yt})=>{const{width:nn,height:An}=Et.reference,Tt=pt.floating.style;Tt.setProperty("--radix-popper-available-width",`${ln}px`),Tt.setProperty("--radix-popper-available-height",`${yt}px`),Tt.setProperty("--radix-popper-anchor-width",`${nn}px`),Tt.setProperty("--radix-popper-anchor-height",`${An}px`)}}),T&&dB({element:T,padding:c}),yB({arrowWidth:_,arrowHeight:P}),g&&cB({strategy:"referenceHidden",...ue})]}),[re,K]=o4(O),$=bi(N);or(()=>{G&&($==null||$())},[G,$]);const H=(ce=z.arrow)==null?void 0:ce.x,oe=(he=z.arrow)==null?void 0:he.y,q=((ve=z.arrow)==null?void 0:ve.centerOffset)!==0,[me,Z]=b.useState();return or(()=>{k&&Z(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:G?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[(Ae=z.transformOrigin)==null?void 0:Ae.x,(Be=z.transformOrigin)==null?void 0:Be.y].join(" "),...(($e=z.hide)==null?void 0:$e.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(pB,{scope:n,placedSide:re,onArrowChange:R,arrowX:H,arrowY:oe,shouldHideArrow:q,children:s.jsx(ut.div,{"data-side":re,"data-align":K,...w,ref:E,style:{...w.style,animation:G?void 0:"none"}})})})});s4.displayName=ey;var a4="PopperArrow",gB={top:"bottom",right:"left",bottom:"top",left:"right"},i4=b.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=mB(a4,r),o=gB[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(hB,{...a,ref:n,style:{...a.style,display:"block"}})})});i4.displayName=a4;function xB(t){return t!==null}var yB=t=>({name:"transformOrigin",options:t,fn(e){var v,k,C;const{placement:n,rects:r,middlewareData:a}=e,o=((v=a.arrow)==null?void 0:v.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=o4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,y=(((C=a.arrow)==null?void 0:C.y)??0)+u/2;let N="",w="";return h==="bottom"?(N=o?m:`${g}px`,w=`${-u}px`):h==="top"?(N=o?m:`${g}px`,w=`${r.floating.height+u}px`):h==="right"?(N=`${-u}px`,w=o?m:`${y}px`):h==="left"&&(N=`${r.floating.width+u}px`,w=o?m:`${y}px`),{data:{x:N,y:w}}}});function o4(t){const[e,n="center"]=t.split("-");return[e,n]}var bB=t4,vB=r4,NB=s4,wB=i4,l4=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),jB="VisuallyHidden",kB=b.forwardRef((t,e)=>s.jsx(ut.span,{...t,ref:e,style:{...l4,...t.style}}));kB.displayName=jB;var SB=[" ","Enter","ArrowUp","ArrowDown"],CB=[" ","Enter"],Co="Select",[Vf,Hf,EB]=Qx(Co),[Vl]=Ei(Co,[EB,ZC]),Wf=ZC(),[TB,Ii]=Vl(Co),[MB,AB]=Vl(Co),c4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:N}=t,w=Wf(e),[v,k]=b.useState(null),[C,E]=b.useState(null),[T,R]=b.useState(!1),D=yf(h),[_,P]=go({prop:r,defaultProp:a??!1,onChange:i,caller:Co}),[L,F]=go({prop:o,defaultProp:c,onChange:u,caller:Co}),X=b.useRef(null),te=v?N||!!v.closest("form"):!0,[ue,ae]=b.useState(new Set),I=Array.from(ue).map(O=>O.props.value).join(";");return s.jsx(bB,{...w,children:s.jsxs(TB,{required:y,scope:e,trigger:v,onTriggerChange:k,valueNode:C,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:R,contentId:fi(),value:L,onValueChange:F,open:_,onOpenChange:P,dir:D,triggerPointerDownPosRef:X,disabled:g,children:[s.jsx(Vf.Provider,{scope:e,children:s.jsx(MB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(O=>{ae(G=>new Set(G).add(O))},[]),onNativeOptionRemove:b.useCallback(O=>{ae(G=>{const z=new Set(G);return z.delete(O),z})},[]),children:n})}),te?s.jsxs(I4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:L,onChange:O=>F(O.target.value),disabled:g,form:N,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(ue)]},I):null]})})};c4.displayName=Co;var d4="SelectTrigger",u4=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Wf(n),o=Ii(d4,n),c=o.disabled||r,u=St(e,o.onTriggerChange),h=Hf(n),f=b.useRef("touch"),[m,g,y]=P4(w=>{const v=h().filter(E=>!E.disabled),k=v.find(E=>E.value===o.value),C=O4(v,w,k);C!==void 0&&o.onValueChange(C.value)}),N=w=>{c||(o.onOpenChange(!0),y()),w&&(o.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return s.jsx(vB,{asChild:!0,...i,children:s.jsx(ut.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":R4(o.value)?"":void 0,...a,ref:u,onClick:ot(a.onClick,w=>{w.currentTarget.focus(),f.current!=="mouse"&&N(w)}),onPointerDown:ot(a.onPointerDown,w=>{f.current=w.pointerType;const v=w.target;v.hasPointerCapture(w.pointerId)&&v.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(N(w),w.preventDefault())}),onKeyDown:ot(a.onKeyDown,w=>{const v=m.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&g(w.key),!(v&&w.key===" ")&&SB.includes(w.key)&&(N(),w.preventDefault())})})})});u4.displayName=d4;var h4="SelectValue",f4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Ii(h4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=St(e,u.onValueNodeChange);return or(()=>{h(f)},[h,f]),s.jsx(ut.span,{...c,ref:m,style:{pointerEvents:"none"},children:R4(u.value)?s.jsx(s.Fragment,{children:o}):i})});f4.displayName=h4;var IB="SelectIcon",p4=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(ut.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});p4.displayName=IB;var RB="SelectPortal",m4=t=>s.jsx(Kx,{asChild:!0,...t});m4.displayName=RB;var Eo="SelectContent",g4=b.forwardRef((t,e)=>{const n=Ii(Eo,t.__scopeSelect),[r,a]=b.useState();if(or(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?pd.createPortal(s.jsx(x4,{scope:t.__scopeSelect,children:s.jsx(Vf.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(y4,{...t,ref:e})});g4.displayName=Eo;var ws=10,[x4,Ri]=Vl(Eo),PB="SelectContentImpl",OB=Zc("SelectContent.RemoveScroll"),y4=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:N,hideWhenDetached:w,avoidCollisions:v,...k}=t,C=Ii(Eo,n),[E,T]=b.useState(null),[R,D]=b.useState(null),_=St(e,ce=>T(ce)),[P,L]=b.useState(null),[F,X]=b.useState(null),te=Hf(n),[ue,ae]=b.useState(!1),I=b.useRef(!1);b.useEffect(()=>{if(E)return Pj(E)},[E]),kj();const O=b.useCallback(ce=>{const[he,...ve]=te().map($e=>$e.ref.current),[Ae]=ve.slice(-1),Be=document.activeElement;for(const $e of ce)if($e===Be||($e==null||$e.scrollIntoView({block:"nearest"}),$e===he&&R&&(R.scrollTop=0),$e===Ae&&R&&(R.scrollTop=R.scrollHeight),$e==null||$e.focus(),document.activeElement!==Be))return},[te,R]),G=b.useCallback(()=>O([P,E]),[O,P,E]);b.useEffect(()=>{ue&&G()},[ue,G]);const{onOpenChange:z,triggerPointerDownPosRef:re}=C;b.useEffect(()=>{if(E){let ce={x:0,y:0};const he=Ae=>{var Be,$e;ce={x:Math.abs(Math.round(Ae.pageX)-(((Be=re.current)==null?void 0:Be.x)??0)),y:Math.abs(Math.round(Ae.pageY)-((($e=re.current)==null?void 0:$e.y)??0))}},ve=Ae=>{ce.x<=10&&ce.y<=10?Ae.preventDefault():E.contains(Ae.target)||z(!1),document.removeEventListener("pointermove",he),re.current=null};return re.current!==null&&(document.addEventListener("pointermove",he),document.addEventListener("pointerup",ve,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",ve,{capture:!0})}}},[E,z,re]),b.useEffect(()=>{const ce=()=>z(!1);return window.addEventListener("blur",ce),window.addEventListener("resize",ce),()=>{window.removeEventListener("blur",ce),window.removeEventListener("resize",ce)}},[z]);const[K,$]=P4(ce=>{const he=te().filter(Be=>!Be.disabled),ve=he.find(Be=>Be.ref.current===document.activeElement),Ae=O4(he,ce,ve);Ae&&setTimeout(()=>Ae.ref.current.focus())}),H=b.useCallback((ce,he,ve)=>{const Ae=!I.current&&!ve;(C.value!==void 0&&C.value===he||Ae)&&(L(ce),Ae&&(I.current=!0))},[C.value]),oe=b.useCallback(()=>E==null?void 0:E.focus(),[E]),q=b.useCallback((ce,he,ve)=>{const Ae=!I.current&&!ve;(C.value!==void 0&&C.value===he||Ae)&&X(ce)},[C.value]),me=r==="popper"?Mx:b4,Z=me===Mx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:N,hideWhenDetached:w,avoidCollisions:v}:{};return s.jsx(x4,{scope:n,content:E,viewport:R,onViewportChange:D,itemRefCallback:H,selectedItem:P,onItemLeave:oe,itemTextRefCallback:q,focusSelectedItem:G,selectedItemText:F,position:r,isPositioned:ue,searchRef:K,children:s.jsx(qx,{as:OB,allowPinchZoom:!0,children:s.jsx(Ux,{asChild:!0,trapped:C.open,onMountAutoFocus:ce=>{ce.preventDefault()},onUnmountAutoFocus:ot(a,ce=>{var he;(he=C.trigger)==null||he.focus({preventScroll:!0}),ce.preventDefault()}),children:s.jsx(Wx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:ce=>ce.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:s.jsx(me,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ce=>ce.preventDefault(),...k,...Z,onPlaced:()=>ae(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:ot(k.onKeyDown,ce=>{const he=ce.ctrlKey||ce.altKey||ce.metaKey;if(ce.key==="Tab"&&ce.preventDefault(),!he&&ce.key.length===1&&$(ce.key),["ArrowUp","ArrowDown","Home","End"].includes(ce.key)){let Ae=te().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);if(["ArrowUp","End"].includes(ce.key)&&(Ae=Ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(ce.key)){const Be=ce.target,$e=Ae.indexOf(Be);Ae=Ae.slice($e+1)}setTimeout(()=>O(Ae)),ce.preventDefault()}})})})})})})});y4.displayName=PB;var DB="SelectItemAlignedPosition",b4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Ii(Eo,n),o=Ri(Eo,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=St(e,_=>f(_)),g=Hf(n),y=b.useRef(!1),N=b.useRef(!0),{viewport:w,selectedItem:v,selectedItemText:k,focusSelectedItem:C}=o,E=b.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&w&&v&&k){const _=i.trigger.getBoundingClientRect(),P=h.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),F=k.getBoundingClientRect();if(i.dir!=="rtl"){const Be=F.left-P.left,$e=L.left-Be,pt=_.left-$e,Et=_.width+pt,ln=Math.max(Et,P.width),yt=window.innerWidth-ws,nn=ph($e,[ws,Math.max(ws,yt-ln)]);c.style.minWidth=Et+"px",c.style.left=nn+"px"}else{const Be=P.right-F.right,$e=window.innerWidth-L.right-Be,pt=window.innerWidth-_.right-$e,Et=_.width+pt,ln=Math.max(Et,P.width),yt=window.innerWidth-ws,nn=ph($e,[ws,Math.max(ws,yt-ln)]);c.style.minWidth=Et+"px",c.style.right=nn+"px"}const X=g(),te=window.innerHeight-ws*2,ue=w.scrollHeight,ae=window.getComputedStyle(h),I=parseInt(ae.borderTopWidth,10),O=parseInt(ae.paddingTop,10),G=parseInt(ae.borderBottomWidth,10),z=parseInt(ae.paddingBottom,10),re=I+O+ue+z+G,K=Math.min(v.offsetHeight*5,re),$=window.getComputedStyle(w),H=parseInt($.paddingTop,10),oe=parseInt($.paddingBottom,10),q=_.top+_.height/2-ws,me=te-q,Z=v.offsetHeight/2,ce=v.offsetTop+Z,he=I+O+ce,ve=re-he;if(he<=q){const Be=X.length>0&&v===X[X.length-1].ref.current;c.style.bottom="0px";const $e=h.clientHeight-w.offsetTop-w.offsetHeight,pt=Math.max(me,Z+(Be?oe:0)+$e+G),Et=he+pt;c.style.height=Et+"px"}else{const Be=X.length>0&&v===X[0].ref.current;c.style.top="0px";const pt=Math.max(q,I+w.offsetTop+(Be?H:0)+Z)+ve;c.style.height=pt+"px",w.scrollTop=he-q+w.offsetTop}c.style.margin=`${ws}px 0`,c.style.minHeight=K+"px",c.style.maxHeight=te+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,i.trigger,i.valueNode,c,h,w,v,k,i.dir,r]);or(()=>E(),[E]);const[T,R]=b.useState();or(()=>{h&&R(window.getComputedStyle(h).zIndex)},[h]);const D=b.useCallback(_=>{_&&N.current===!0&&(E(),C==null||C(),N.current=!1)},[E,C]);return s.jsx(_B,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:D,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:s.jsx(ut.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});b4.displayName=DB;var LB="SelectPopperPosition",Mx=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ws,...i}=t,o=Wf(n);return s.jsx(NB,{...o,...i,ref:e,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Mx.displayName=LB;var[_B,ty]=Vl(Eo,{}),Ax="SelectViewport",v4=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Ri(Ax,n),o=ty(Ax,n),c=St(e,i.onViewportChange),u=b.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(Vf.Slot,{scope:n,children:s.jsx(ut.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:ot(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const N=window.innerHeight-ws*2,w=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),k=Math.max(w,v);if(k0?T:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});v4.displayName=Ax;var N4="SelectGroup",[zB,FB]=Vl(N4),$B=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=fi();return s.jsx(zB,{scope:n,id:a,children:s.jsx(ut.div,{role:"group","aria-labelledby":a,...r,ref:e})})});$B.displayName=N4;var w4="SelectLabel",BB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=FB(w4,n);return s.jsx(ut.div,{id:a.id,...r,ref:e})});BB.displayName=w4;var cf="SelectItem",[VB,j4]=Vl(cf),k4=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Ii(cf,n),u=Ri(cf,n),h=c.value===r,[f,m]=b.useState(i??""),[g,y]=b.useState(!1),N=St(e,C=>{var E;return(E=u.itemRefCallback)==null?void 0:E.call(u,C,r,a)}),w=fi(),v=b.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(VB,{scope:n,value:r,disabled:a,textId:w,isSelected:h,onItemTextChange:b.useCallback(C=>{m(E=>E||((C==null?void 0:C.textContent)??"").trim())},[]),children:s.jsx(Vf.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(ut.div,{role:"option","aria-labelledby":w,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:N,onFocus:ot(o.onFocus,()=>y(!0)),onBlur:ot(o.onBlur,()=>y(!1)),onClick:ot(o.onClick,()=>{v.current!=="mouse"&&k()}),onPointerUp:ot(o.onPointerUp,()=>{v.current==="mouse"&&k()}),onPointerDown:ot(o.onPointerDown,C=>{v.current=C.pointerType}),onPointerMove:ot(o.onPointerMove,C=>{var E;v.current=C.pointerType,a?(E=u.onItemLeave)==null||E.call(u):v.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ot(o.onPointerLeave,C=>{var E;C.currentTarget===document.activeElement&&((E=u.onItemLeave)==null||E.call(u))}),onKeyDown:ot(o.onKeyDown,C=>{var T;((T=u.searchRef)==null?void 0:T.current)!==""&&C.key===" "||(CB.includes(C.key)&&k(),C.key===" "&&C.preventDefault())})})})})});k4.displayName=cf;var Dc="SelectItemText",S4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Ii(Dc,n),c=Ri(Dc,n),u=j4(Dc,n),h=AB(Dc,n),[f,m]=b.useState(null),g=St(e,k=>m(k),u.onItemTextChange,k=>{var C;return(C=c.itemTextRefCallback)==null?void 0:C.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,N=b.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:v}=h;return or(()=>(w(N),()=>v(N)),[w,v,N]),s.jsxs(s.Fragment,{children:[s.jsx(ut.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?pd.createPortal(i.children,o.valueNode):null]})});S4.displayName=Dc;var C4="SelectItemIndicator",E4=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return j4(C4,n).isSelected?s.jsx(ut.span,{"aria-hidden":!0,...r,ref:e}):null});E4.displayName=C4;var Ix="SelectScrollUpButton",T4=b.forwardRef((t,e)=>{const n=Ri(Ix,t.__scopeSelect),r=ty(Ix,t.__scopeSelect),[a,i]=b.useState(!1),o=St(e,r.onScrollButtonChange);return or(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;i(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(A4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});T4.displayName=Ix;var Rx="SelectScrollDownButton",M4=b.forwardRef((t,e)=>{const n=Ri(Rx,t.__scopeSelect),r=ty(Rx,t.__scopeSelect),[a,i]=b.useState(!1),o=St(e,r.onScrollButtonChange);return or(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(A4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});M4.displayName=Rx;var A4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Ri("SelectScrollButton",n),o=b.useRef(null),c=Hf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),or(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),s.jsx(ut.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:ot(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ot(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ot(a.onPointerLeave,()=>{u()})})}),HB="SelectSeparator",WB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(ut.div,{"aria-hidden":!0,...r,ref:e})});WB.displayName=HB;var Px="SelectArrow",UB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Wf(n),i=Ii(Px,n),o=Ri(Px,n);return i.open&&o.position==="popper"?s.jsx(wB,{...a,...r,ref:e}):null});UB.displayName=Px;var KB="SelectBubbleInput",I4=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=b.useRef(null),i=St(r,a),o=Zx(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(ut.select,{...n,style:{...l4,...n.style},ref:i,defaultValue:e})});I4.displayName=KB;function R4(t){return t===""||t===void 0}function P4(t){const e=bi(t),n=b.useRef(""),r=b.useRef(0),a=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),i=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function O4(t,e,n){const a=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=qB(t,Math.max(i,0));a.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function qB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var GB=c4,D4=u4,JB=f4,YB=p4,QB=m4,L4=g4,XB=v4,_4=k4,ZB=S4,eV=E4,tV=T4,nV=M4;const ul=GB,hl=JB,no=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(D4,{ref:r,className:Ct("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,s.jsx(YB,{asChild:!0,children:s.jsx(Xc,{className:"h-4 w-4 opacity-50"})})]}));no.displayName=D4.displayName;const ro=b.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(QB,{children:s.jsxs(L4,{ref:a,className:Ct("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[s.jsx(tV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Uw,{className:"h-4 w-4"})}),s.jsx(XB,{className:"p-1",children:e}),s.jsx(nV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Xc,{className:"h-4 w-4"})})]})}));ro.displayName=L4.displayName;const _r=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(_4,{ref:r,className:Ct("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(eV,{children:s.jsx(hf,{className:"h-4 w-4"})})}),s.jsx(ZB,{children:e})]}));_r.displayName=_4.displayName;function rV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(null),[u,h]=b.useState({name:"",appId:"",path:"",sort:0}),[f,m]=b.useState(!1);async function g(){r(!0);try{const k=await Oe("/api/admin/linked-miniprograms");if(k!=null&&k.success&&Array.isArray(k.data)){const C=[...k.data].sort((E,T)=>(E.sort??0)-(T.sort??0));e(C)}}catch(k){console.error("Load linked miniprograms error:",k),ie.error("加载失败")}finally{r(!1)}}b.useEffect(()=>{g()},[]);function y(){c(null),h({name:"",appId:"",path:"",sort:t.length}),i(!0)}function N(k){c(k),h({name:k.name,appId:k.appId,path:k.path??"",sort:k.sort??0}),i(!0)}async function w(){const k=u.name.trim(),C=u.appId.trim();if(!k||!C){ie.error("请填写小程序名称和 AppID");return}m(!0);try{if(o){const E=await _t("/api/admin/linked-miniprograms",{key:o.key,name:k,appId:C,path:u.path.trim(),sort:u.sort});E!=null&&E.success?(ie.success("已更新"),i(!1),g()):ie.error((E==null?void 0:E.error)??"更新失败")}else{const E=await wt("/api/admin/linked-miniprograms",{name:k,appId:C,path:u.path.trim(),sort:u.sort});E!=null&&E.success?(ie.success("已添加"),i(!1),g()):ie.error((E==null?void 0:E.error)??"添加失败")}}catch{ie.error("操作失败")}finally{m(!1)}}async function v(k){if(confirm(`确定要删除「${k.name}」吗?`))try{const C=await Bs(`/api/admin/linked-miniprograms/${k.key}`);C!=null&&C.success?(ie.success("已删除"),g()):ie.error((C==null?void 0:C.error)??"删除失败")}catch{ie.error("删除失败")}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),"关联小程序管理"]}),s.jsx(Ft,{className:"text-gray-400",children:"添加后生成 32 位密钥,链接标签选择小程序时存密钥;小程序端点击 #标签 时用密钥查 appId 再跳转。需在 app.json 的 navigateToMiniProgramAppIdList 中配置目标 AppID。"})]}),s.jsxs(Ee,{children:[s.jsxs("div",{className:"flex justify-end gap-2 mb-4",children:[s.jsx(ee,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>g(),title:"刷新",children:s.jsx(Ke,{className:"w-4 h-4"})}),s.jsxs(ee,{onClick:y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"添加关联小程序"]})]}),n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(lr,{children:[s.jsx(cr,{children:s.jsxs(it,{className:"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:"AppID"}),s.jsx(je,{className:"text-gray-400",children:"路径"}),s.jsx(je,{className:"text-gray-400 w-24",children:"排序"}),s.jsx(je,{className:"text-gray-400 w-32",children:"操作"})]})}),s.jsxs(dr,{children:[t.map(k=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(ye,{className:"text-white",children:k.name}),s.jsx(ye,{className:"text-gray-300 font-mono text-xs",children:k.key}),s.jsx(ye,{className:"text-gray-300 font-mono text-sm",children:k.appId}),s.jsx(ye,{className:"text-gray-400 text-sm",children:k.path||"—"}),s.jsx(ye,{className:"text-gray-300",children:k.sort??0}),s.jsx(ye,{children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/20",onClick:()=>N(k),children:s.jsx(tj,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-red-400 hover:bg-red-500/20",onClick:()=>v(k),children:s.jsx(Jn,{className:"w-4 h-4"})})]})})]},k.key)),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无关联小程序,点击「添加关联小程序」开始配置"})})]})]})]})]}),s.jsx(Ot,{open:a,onOpenChange:i,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Dt,{className:"gap-1",children:[s.jsx(Lt,{className:"text-base",children:o?"编辑关联小程序":"添加关联小程序"}),s.jsx(xf,{className:"text-gray-400 text-xs",children:"填写目标小程序的名称和 AppID,路径可选(为空则打开首页)"})]}),s.jsxs("div",{className:"space-y-3 py-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-300 text-sm",children:"小程序名称"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"例如:Soul 创业派对",value:u.name,onChange:k=>h(C=>({...C,name:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-300 text-sm",children:"AppID"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono h-8 text-sm",placeholder:"例如:wxb8bbb2b10dec74aa",value:u.appId,onChange:k=>h(C=>({...C,appId:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-300 text-sm",children:"路径(可选)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"例如:pages/index/index",value:u.path,onChange:k=>h(C=>({...C,path:k.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-300 text-sm",children:"排序"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm w-20",value:u.sort,onChange:k=>h(C=>({...C,sort:parseInt(k.target.value,10)||0}))})]})]}),s.jsxs(on,{className:"gap-2 pt-1",children:[s.jsx(ee,{variant:"outline",onClick:()=>i(!1),className:"border-gray-600",children:"取消"}),s.jsx(ee,{onClick:w,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:f?"保存中...":"保存"})]})]})})]})}const sV=["一","二","三","四","五","六","七","八","九","十"];function vg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function aV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:a,onDeleteSection:i,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:N,pinnedSectionIds:w=[]}){const[v,k]=b.useState(null),[C,E]=b.useState(null),T=(F,X)=>(v==null?void 0:v.type)===F&&(v==null?void 0:v.id)===X,R=(F,X)=>(C==null?void 0:C.type)===F&&(C==null?void 0:C.id)===X,D=b.useCallback(()=>{const F=[];for(const X of t)for(const te of X.chapters)for(const ue of te.sections)F.push({id:ue.id,partId:X.id,partTitle:X.title,chapterId:te.id,chapterTitle:te.title});return F},[t]),_=b.useCallback(async(F,X,te,ue)=>{var z;F.preventDefault(),F.stopPropagation();const ae=F.dataTransfer.getData("text/plain"),I=vg(ae);if(!I||I.type===X&&I.id===te)return;const O=D(),G=new Map(O.map(re=>[re.id,re]));if(I.type==="part"&&X==="part"){const re=t.map(q=>q.id),K=re.indexOf(I.id),$=re.indexOf(te);if(K===-1||$===-1)return;const H=[...re];H.splice(K,1),H.splice(K<$?$-1:$,0,I.id);const oe=[];for(const q of H){const me=t.find(Z=>Z.id===q);if(me)for(const Z of me.chapters)for(const ce of Z.sections){const he=G.get(ce.id);he&&oe.push(he)}}await r(oe);return}if(I.type==="chapter"&&(X==="chapter"||X==="section"||X==="part")){const re=t.find(he=>he.chapters.some(ve=>ve.id===I.id)),K=re==null?void 0:re.chapters.find(he=>he.id===I.id);if(!re||!K)return;let $,H,oe=null;if(X==="section"){const he=G.get(te);if(!he)return;$=he.partId,H=he.partTitle,oe=te}else if(X==="chapter"){const he=t.find(Be=>Be.chapters.some($e=>$e.id===te)),ve=he==null?void 0:he.chapters.find(Be=>Be.id===te);if(!he||!ve)return;$=he.id,H=he.title;const Ae=O.filter(Be=>Be.chapterId===te).pop();oe=(Ae==null?void 0:Ae.id)??null}else{const he=t.find(Ae=>Ae.id===te);if(!he||!he.chapters[0])return;$=he.id,H=he.title;const ve=O.filter(Ae=>Ae.partId===he.id&&Ae.chapterId===he.chapters[0].id);oe=((z=ve[ve.length-1])==null?void 0:z.id)??null}const q=K.sections.map(he=>he.id),me=O.filter(he=>!q.includes(he.id));let Z=me.length;if(oe){const he=me.findIndex(ve=>ve.id===oe);he>=0&&(Z=he+1)}const ce=q.map(he=>({...G.get(he),partId:$,partTitle:H,chapterId:K.id,chapterTitle:K.title}));await r([...me.slice(0,Z),...ce,...me.slice(Z)]);return}if(I.type==="section"&&(X==="section"||X==="chapter"||X==="part")){if(!ue)return;const{partId:re,partTitle:K,chapterId:$,chapterTitle:H}=ue;let oe;if(X==="section")oe=O.findIndex(ve=>ve.id===te);else if(X==="chapter"){const ve=O.filter(Ae=>Ae.chapterId===te).pop();oe=ve?O.findIndex(Ae=>Ae.id===ve.id)+1:O.length}else{const ve=t.find($e=>$e.id===te);if(!(ve!=null&&ve.chapters[0]))return;const Ae=O.filter($e=>$e.partId===ve.id&&$e.chapterId===ve.chapters[0].id),Be=Ae[Ae.length-1];oe=Be?O.findIndex($e=>$e.id===Be.id)+1:0}const q=O.findIndex(ve=>ve.id===I.id);if(q===-1)return;const me=O.filter(ve=>ve.id!==I.id),Z=q({onDragEnter:ue=>{ue.preventDefault(),ue.stopPropagation(),ue.dataTransfer.dropEffect="move",E({type:F,id:X})},onDragOver:ue=>{ue.preventDefault(),ue.stopPropagation(),ue.dataTransfer.dropEffect="move",E({type:F,id:X})},onDragLeave:()=>E(null),onDrop:ue=>{E(null);const ae=vg(ue.dataTransfer.getData("text/plain"));if(ae&&!(F==="section"&&ae.type==="section"&&ae.id===X))if(F==="part")if(ae.type==="part")_(ue,"part",X);else{const I=t.find(G=>G.id===X);(I==null?void 0:I.chapters[0])&&te&&_(ue,"part",X,te)}else F==="chapter"&&te?(ae.type==="section"||ae.type==="chapter")&&_(ue,"chapter",X,te):F==="section"&&te&&_(ue,"section",X,te)}}),L=F=>sV[F]??String(F+1);return s.jsx("div",{className:"space-y-3",children:t.map((F,X)=>{var K,$,H,oe;const te=F.title==="序言"||F.title.includes("序言"),ue=F.title==="尾声"||F.title.includes("尾声"),ae=F.title==="附录"||F.title.includes("附录"),I=R("part",F.id),O=e.includes(F.id),G=F.chapters.length,z=F.chapters.reduce((q,me)=>q+me.sections.length,0);if(te&&F.chapters.length===1&&F.chapters[0].sections.length===1){const q=F.chapters[0].sections[0],me=R("section",q.id),Z={partId:F.id,partTitle:F.title,chapterId:F.chapters[0].id,chapterTitle:F.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:ce=>{ce.stopPropagation(),ce.dataTransfer.setData("text/plain","section:"+q.id),ce.dataTransfer.effectAllowed="move",k({type:"section",id:q.id})},onDragEnd:()=>{k(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${me?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",q.id,Z),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ua,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ce=>ce.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(q.id),onChange:()=>y(q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Br,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[F.chapters[0].title," | ",q.title]}),w.includes(q.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(ml,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ce=>ce.stopPropagation(),onClick:ce=>ce.stopPropagation(),children:[q.price===0||q.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",q.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",q.clickCount??0," · 付款 ",q.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(q.hotScore??0).toFixed(1)," · 第",q.hotRank&&q.hotRank>0?q.hotRank:"-","名"]}),N&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(q),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})})]})]})]},F.id)}if(F.title==="2026每日派对干货"||F.title.includes("2026每日派对干货")){const q=R("part",F.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${q?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...P("part",F.id,{partId:F.id,partTitle:F.title,chapterId:((K=F.chapters[0])==null?void 0:K.id)??"",chapterTitle:(($=F.chapters[0])==null?void 0:$.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:me=>{me.stopPropagation(),me.dataTransfer.setData("text/plain","part:"+F.id),me.dataTransfer.effectAllowed="move",k({type:"part",id:F.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",F.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(F.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ua,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:F.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",z," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:me=>me.stopPropagation(),onClick:me=>me.stopPropagation(),children:[o&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(hn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),f&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(F),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[G,"章"]}),O?s.jsx(Xc,{className:"w-5 h-5 text-gray-500"}):s.jsx(fl,{className:"w-5 h-5 text-gray-500"})]})]}),O&&F.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:F.chapters.map(me=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:me.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Z=>Z.stopPropagation(),children:[m&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>m(F,me),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),c&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>c(F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(hn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>u(F,me),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:me.sections.map(Z=>{const ce=R("section",Z.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+Z.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:Z.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${ce?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",Z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",Z.id,{partId:F.id,partTitle:F.title,chapterId:me.id,chapterTitle:me.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ua,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(Z.id),onChange:()=>y(Z.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Z.id," ",Z.title]}),w.includes(Z.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(ml,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Z.clickCount??0," · 付款 ",Z.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Z.hotScore??0).toFixed(1)," · 第",Z.hotRank&&Z.hotRank>0?Z.hotRank:"-","名"]}),N&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(Z),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(Z),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})})]})]},Z.id)})})]},me.id))})]},F.id)}if(ae)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:F.chapters.map((q,me)=>q.sections.length>0?q.sections.map(Z=>{const ce=R("section",Z.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+Z.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:Z.id})},onDragEnd:()=>{k(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${ce?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",Z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",Z.id,{partId:F.id,partTitle:F.title,chapterId:q.id,chapterTitle:q.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ua,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(Z.id),onChange:()=>y(Z.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",me+1," | ",q.title," | ",Z.title]}),w.includes(Z.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(ml,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Z.clickCount??0," · 付款 ",Z.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Z.hotScore??0).toFixed(1)," · 第",Z.hotRank&&Z.hotRank>0?Z.hotRank:"-","名"]}),N&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(Z),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>a(Z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>i(Z),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(fl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},Z.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",me+1," | ",q.title,"(空)"]}),s.jsx(fl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},q.id))})]},F.id);if(ue&&F.chapters.length===1&&F.chapters[0].sections.length===1){const q=F.chapters[0].sections[0],me=R("section",q.id),Z={partId:F.id,partTitle:F.title,chapterId:F.chapters[0].id,chapterTitle:F.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:ce=>{ce.stopPropagation(),ce.dataTransfer.setData("text/plain","section:"+q.id),ce.dataTransfer.effectAllowed="move",k({type:"section",id:q.id})},onDragEnd:()=>{k(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${me?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",q.id,Z),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ua,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ce=>ce.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(q.id),onChange:()=>y(q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Br,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[F.chapters[0].title," | ",q.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ce=>ce.stopPropagation(),onClick:ce=>ce.stopPropagation(),children:[q.price===0||q.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",q.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",q.clickCount??0," · 付款 ",q.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(q.hotScore??0).toFixed(1)," · 第",q.hotRank&&q.hotRank>0?q.hotRank:"-","名"]}),N&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(q),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})})]})]})]},F.id)}return ue?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:F.chapters.map(q=>q.sections.map(me=>{const Z=R("section",me.id);return s.jsxs("div",{draggable:!0,onDragStart:ce=>{ce.stopPropagation(),ce.dataTransfer.setData("text/plain","section:"+me.id),ce.dataTransfer.effectAllowed="move",k({type:"section",id:me.id})},onDragEnd:()=>{k(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",me.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",me.id,{partId:F.id,partTitle:F.title,chapterId:q.id,chapterTitle:q.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ua,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ce=>ce.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(me.id),onChange:()=>y(me.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[q.title," | ",me.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",me.clickCount??0," · 付款 ",me.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(me.hotScore??0).toFixed(1)," · 第",me.hotRank&&me.hotRank>0?me.hotRank:"-","名"]}),N&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(me),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(me),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(me),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})})]})]})]},me.id)}))})]},F.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${I?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...P("part",F.id,{partId:F.id,partTitle:F.title,chapterId:((H=F.chapters[0])==null?void 0:H.id)??"",chapterTitle:((oe=F.chapters[0])==null?void 0:oe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:q=>{q.stopPropagation(),q.dataTransfer.setData("text/plain","part:"+F.id),q.dataTransfer.effectAllowed="move",k({type:"part",id:F.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",F.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(F.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(ua,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:L(X)}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:F.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",z," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:q=>q.stopPropagation(),onClick:q=>q.stopPropagation(),children:[o&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(hn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),f&&s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(F),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[G,"章"]}),O?s.jsx(Xc,{className:"w-5 h-5 text-gray-500"}):s.jsx(fl,{className:"w-5 h-5 text-gray-500"})]})]}),O&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:F.chapters.map(q=>{const me=R("chapter",q.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","chapter:"+q.id),Z.dataTransfer.effectAllowed="move",k({type:"chapter",id:q.id})},onDragEnd:()=>{k(null),E(null)},onDragEnter:Z=>{Z.preventDefault(),Z.stopPropagation(),Z.dataTransfer.dropEffect="move",E({type:"chapter",id:q.id})},onDragOver:Z=>{Z.preventDefault(),Z.stopPropagation(),Z.dataTransfer.dropEffect="move",E({type:"chapter",id:q.id})},onDragLeave:()=>E(null),onDrop:Z=>{E(null);const ce=vg(Z.dataTransfer.getData("text/plain"));if(!ce)return;const he={partId:F.id,partTitle:F.title,chapterId:q.id,chapterTitle:q.title};(ce.type==="section"||ce.type==="chapter")&&_(Z,"chapter",q.id,he)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${me?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${T("chapter",q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(ua,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:q.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Z=>Z.stopPropagation(),children:[m&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>m(F,q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),c&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>c(F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(hn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>u(F,q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:q.sections.map(Z=>{const ce=R("section",Z.id);return s.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","section:"+Z.id),he.dataTransfer.effectAllowed="move",k({type:"section",id:Z.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${ce?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",Z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...P("section",Z.id,{partId:F.id,partTitle:F.title,chapterId:q.id,chapterTitle:q.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:he=>he.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(Z.id),onChange:()=>y(Z.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(ua,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${Z.price===0||Z.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Z.id," ",Z.title]}),w.includes(Z.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(ml,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:he=>he.stopPropagation(),onClick:he=>he.stopPropagation(),children:[Z.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),Z.price===0||Z.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",Z.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",Z.clickCount??0," · 付款 ",Z.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Z.hotScore??0).toFixed(1)," · 第",Z.hotRank&&Z.hotRank>0?Z.hotRank:"-","名"]}),N&&s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(Z),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(Wt,{className:"w-3.5 h-3.5"})}),s.jsx(ee,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(Z),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Jn,{className:"w-3.5 h-3.5"})})]})]})]},Z.id)})})]},q.id)})})]},F.id)})})}function iV(t){var a;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(a=t==null?void 0:t.keyword)!=null&&a.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString(),r=n?`/api/admin/ckb/devices?${n}`:"/api/admin/ckb/devices";return Oe(r)}function oV(t){return Oe(`/api/db/person?personId=${encodeURIComponent(t)}`)}const z4=11,yw={personId:"",name:"",label:"",sceneId:z4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"09:00",endTime:"18:00",deviceGroups:""};function lV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){const a=!!n,[i,o]=b.useState(yw),[c,u]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState([]),[y,N]=b.useState(!1),[w,v]=b.useState(""),[k,C]=b.useState({});b.useEffect(()=>{t&&(v(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",label:n.label??"",sceneId:z4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"09:00",endTime:n.endTime??"18:00",deviceGroups:n.deviceGroups??""}:{...yw}),C({}),m.length===0&&E(""))},[t,n]);const E=async R=>{N(!0);try{const D=await iV({page:1,limit:50,keyword:R});D!=null&&D.success&&Array.isArray(D.devices)?g(D.devices):D!=null&&D.error&&ie.error(D.error)}catch(D){ie.error(D instanceof Error?D.message:"加载设备列表失败")}finally{N(!1)}},T=async()=>{var P;const R={};(!i.name||!String(i.name).trim())&&(R.name="请填写名称");const D=i.addFriendInterval;if((typeof D!="number"||D<1)&&(R.addFriendInterval="添加间隔至少为 1 分钟"),(((P=i.deviceGroups)==null?void 0:P.split(",").map(L=>L.trim()).filter(Boolean))??[]).length===0&&(R.deviceGroups="请至少选择 1 台设备"),C(R),Object.keys(R).length>0){ie.error(R.name||R.addFriendInterval||R.deviceGroups||"请完善必填项");return}u(!0);try{await r(i),e(!1)}catch(L){ie.error(L instanceof Error?L.message:"保存失败")}finally{u(!1)}};return s.jsx(Ot,{open:t,onOpenChange:e,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Dt,{children:[s.jsx(Lt,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(xf,{className:"text-gray-400 text-sm",children:a?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Y,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(ne,{className:`bg-[#0a1628] text-white ${k.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:i.name,onChange:R=>{o(D=>({...D,name:R.target.value})),k.name&&C(D=>({...D,name:void 0}))}}),k.name&&s.jsx("p",{className:"text-xs text-red-400",children:k.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:i.personId,onChange:R=>o(D=>({...D,personId:R.target.value})),disabled:a})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:i.label,onChange:R=>o(D=>({...D,label:R.target.value}))})]})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-4",children:"存客宝 API 获客配置"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"存客宝密钥(计划 apiKey)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创建计划成功后自动回填,不可手动修改",value:i.ckbApiKey,readOnly:!0}),s.jsx("p",{className:"text-xs text-gray-500",children:"由存客宝计划详情接口返回的 apiKey,用于小程序 @人物 时推送到对应获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Y,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${k.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(ne,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:i.deviceGroups?`已选择 ${i.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(ee,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),k.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:k.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(ul,{value:i.remarkType,onValueChange:R=>o(D=>({...D,remarkType:R})),children:[s.jsx(no,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{placeholder:"选择备注类型"})}),s.jsxs(ro,{children:[s.jsx(_r,{value:"phone",children:"手机号"}),s.jsx(_r,{value:"nickname",children:"昵称"}),s.jsx(_r,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"备注格式"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 手机号+SOUL链接人与事-{名称},留空用默认",value:i.remarkFormat,onChange:R=>o(D=>({...D,remarkFormat:R.target.value}))})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:i.greeting,onChange:R=>o(D=>({...D,greeting:R.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(ne,{type:"number",min:1,className:`bg-[#0a1628] text-white ${k.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:i.addFriendInterval,onChange:R=>{o(D=>({...D,addFriendInterval:Number(R.target.value)||1})),k.addFriendInterval&&C(D=>({...D,addFriendInterval:void 0}))}}),k.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:k.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.startTime,onChange:R=>o(D=>({...D,startTime:R.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(ne,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.endTime,onChange:R=>o(D=>({...D,endTime:R.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(_l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:i.tips,onChange:R=>o(D=>({...D,tips:R.target.value}))})]})]})]})]})]}),s.jsxs(on,{className:"gap-3 pt-2",children:[s.jsx(ee,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(ee,{onClick:T,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:c?"保存中...":a?"保存":"添加"})]}),h&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:w,onChange:R=>v(R.target.value),onKeyDown:R=>{R.key==="Enter"&&E(w)}}),s.jsx(ee,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>E(w),disabled:y,children:"刷新"}),s.jsx(ee,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>f(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:y?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):m.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:m.map(R=>{const D=String(R.id??""),_=i.deviceGroups?i.deviceGroups.split(",").map(F=>F.trim()).filter(Boolean):[],P=_.includes(D),L=()=>{let F;P?F=_.filter(X=>X!==D):F=[..._,D],o(X=>({...X,deviceGroups:F.join(",")})),F.length>0&&C(X=>({...X,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:P,onChange:L}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:R.memo||R.wechatId||`设备 ${D}`}),R.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),R.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",D]}),R.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",R.wechatId]}),typeof R.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",R.totalFriend]})]})]})]},D)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",i.deviceGroups?i.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ee,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(ee,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}function cV(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,mid:c.mid,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const i=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return i.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function dV(){var Kl,ql,Po;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[N,w]=b.useState(""),[v,k]=b.useState([]),[C,E]=b.useState(!1),[T,R]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[D,_]=b.useState(null),[P,L]=b.useState(!1),[F,X]=b.useState(!1),[te,ue]=b.useState(null),[ae,I]=b.useState(!1),[O,G]=b.useState([]),[z,re]=b.useState(!1),[K,$]=b.useState(""),[H,oe]=b.useState(""),[q,me]=b.useState(!1),[Z,ce]=b.useState(""),[he,ve]=b.useState(!1),[Ae,Be]=b.useState(null),[$e,pt]=b.useState(!1),[Et,ln]=b.useState(!1),[yt,nn]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[An,Tt]=b.useState(!1),[Yt,rn]=b.useState(!1),[In,pr]=b.useState(1),[Rn,Hn]=b.useState([]),[W,He]=b.useState(!1),[qe,xt]=b.useState([]),[lt,nt]=b.useState(!1),[gt,It]=b.useState(20),[gn,mr]=b.useState(!1),[wr,As]=b.useState(!1),[Wr,Is]=b.useState([]),[fe,ge]=b.useState([]),[Rt,Pn]=b.useState(!1),[Qs,Xs]=b.useState(null),[Wn,Zs]=b.useState(null),[ht,xn]=b.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),[Ur,Ir]=b.useState(null),ds=b.useRef(null),On=cV(t),us=t.length,hs=10,Rs=Math.max(1,Math.ceil(Rn.length/hs)),Ma=Rn.slice((In-1)*hs,In*hs),er=async()=>{r(!0);try{const M=await Oe("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(M==null?void 0:M.sections)?M.sections:[])}catch(M){console.error(M),e([])}finally{r(!1)}},Kr=async()=>{He(!0);try{const M=await Oe("/api/db/book?action=ranking",{cache:"no-store"}),J=Array.isArray(M==null?void 0:M.sections)?M.sections:[];Hn(J);const pe=J.filter(be=>be.isPinned).map(be=>be.id);xt(pe)}catch(M){console.error(M),Hn([])}finally{He(!1)}};b.useEffect(()=>{er(),Kr()},[]);const ea=M=>{i(J=>J.includes(M)?J.filter(pe=>pe!==M):[...J,M])},Rr=b.useCallback(M=>{const J=t,pe=M.flatMap(be=>{const st=J.find(mt=>mt.id===be.id);return st?[{...st,partId:be.partId,partTitle:be.partTitle,chapterId:be.chapterId,chapterTitle:be.chapterTitle}]:[]});return e(pe),_t("/api/db/book",{action:"reorder",items:M}).then(be=>{be&&be.success===!1&&(e(J),ie.error("排序失败: "+(be&&typeof be=="object"&&"error"in be?be.error:"未知错误")))}).catch(be=>{e(J),console.error("排序失败:",be),ie.error("排序失败: "+(be instanceof Error?be.message:"网络或服务异常"))}),Promise.resolve()},[t]),Pi=async M=>{if(confirm(`确定要删除章节「${M.title}」吗?此操作不可恢复。`))try{const J=await Bs(`/api/db/book?id=${encodeURIComponent(M.id)}`);J&&J.success!==!1?(ie.success("已删除"),er(),Kr()):ie.error("删除失败: "+(J&&typeof J=="object"&&"error"in J?J.error:"未知错误"))}catch(J){console.error(J),ie.error("删除失败")}},Aa=b.useCallback(async()=>{Tt(!0);try{const M=await Oe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),J=M&&M.data;J&&typeof J.readWeight=="number"&&typeof J.recencyWeight=="number"&&typeof J.payWeight=="number"&&nn({readWeight:Math.max(0,Math.min(1,J.readWeight)),recencyWeight:Math.max(0,Math.min(1,J.recencyWeight)),payWeight:Math.max(0,Math.min(1,J.payWeight))})}catch{}finally{Tt(!1)}},[]);b.useEffect(()=>{Et&&Aa()},[Et,Aa]);const Io=async()=>{const{readWeight:M,recencyWeight:J,payWeight:pe}=yt,be=M+J+pe;if(Math.abs(be-1)>.001){ie.error("三个权重之和必须等于 1");return}rn(!0);try{const st=await wt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:M,recencyWeight:J,payWeight:pe},description:"文章排名算法权重"});st&&st.success!==!1?(ie.success("排名权重已保存"),ln(!1),er(),Kr()):ie.error("保存失败: "+(st&&typeof st=="object"&&"error"in st?st.error:""))}catch(st){console.error(st),ie.error("保存失败")}finally{rn(!1)}},Ia=b.useCallback(async()=>{nt(!0);try{const M=await Oe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),J=M&&M.data;Array.isArray(J)&&xt(J)}catch{}finally{nt(!1)}},[]),qr=b.useCallback(async()=>{try{const M=await Oe("/api/db/persons");M!=null&&M.success&&M.persons&&Is(M.persons.map(J=>{const pe=J.deviceGroups,be=Array.isArray(pe)?pe.join(","):pe??"";return{id:J.token??J.personId??"",personId:J.personId,name:J.name,label:J.label??"",ckbApiKey:J.ckbApiKey??"",ckbPlanId:J.ckbPlanId,remarkType:J.remarkType,remarkFormat:J.remarkFormat,addFriendInterval:J.addFriendInterval,startTime:J.startTime,endTime:J.endTime,deviceGroups:be}}))}catch{}},[]),Gr=b.useCallback(async()=>{try{const M=await Oe("/api/db/link-tags");M!=null&&M.success&&M.linkTags&&ge(M.linkTags.map(J=>({id:J.tagId,label:J.label,url:J.url,type:J.type||"url",appId:J.appId||"",pagePath:J.pagePath||""})))}catch{}},[]),[Ra,Hl]=b.useState([]),[ta,Pt]=b.useState(""),[Oi,fs]=b.useState(!1),Di=b.useRef(null),Ps=b.useCallback(async()=>{try{const M=await Oe("/api/admin/linked-miniprograms");M!=null&&M.success&&Array.isArray(M.data)&&Hl(M.data.map(J=>({...J,key:J.key})))}catch{}},[]),Li=Ra.filter(M=>!ta.trim()||M.name.toLowerCase().includes(ta.toLowerCase())||M.key&&M.key.toLowerCase().includes(ta.toLowerCase())||M.appId.toLowerCase().includes(ta.toLowerCase())),Pa=async M=>{const J=qe.includes(M)?qe.filter(pe=>pe!==M):[...qe,M];xt(J);try{await wt("/api/db/config",{key:"pinned_section_ids",value:J,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),Kr()}catch{xt(qe)}},V=b.useCallback(async()=>{mr(!0);try{const M=await Oe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),J=M&&M.data;typeof J=="number"&&J>0&&J<=100&&It(J)}catch{}finally{mr(!1)}},[]),Re=async()=>{if(gt<1||gt>100){ie.error("预览比例需在 1~100 之间");return}As(!0);try{const M=await wt("/api/db/config",{key:"unpaid_preview_percent",value:gt,description:"小程序未付费内容默认预览比例(%)"});M&&M.success!==!1?ie.success("预览比例已保存"):ie.error("保存失败: "+(M.error||""))}catch{ie.error("保存失败")}finally{As(!1)}};b.useEffect(()=>{Ia(),V(),qr(),Gr(),Ps()},[Ia,V,qr,Gr,Ps]);const et=async M=>{Be({section:M,orders:[]}),pt(!0);try{const J=await Oe(`/api/db/book?action=section-orders&id=${encodeURIComponent(M.id)}`),pe=J!=null&&J.success&&Array.isArray(J.orders)?J.orders:[];Be(be=>be?{...be,orders:pe}:null)}catch(J){console.error(J),Be(pe=>pe?{...pe,orders:[]}:null)}finally{pt(!1)}},tt=async M=>{m(!0);try{const J=M.mid!=null&&M.mid>0?`/api/db/book?action=read&mid=${M.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(M.id)}`,pe=await Oe(J);if(pe!=null&&pe.success&&pe.section){const be=pe.section,st=be.editionPremium===!0;c({id:M.id,originalId:M.id,title:pe.section.title??M.title,price:pe.section.price??M.price,content:pe.section.content??"",filePath:M.filePath,isFree:M.isFree||M.price===0,isNew:be.isNew??M.isNew,isPinned:qe.includes(M.id),hotScore:M.hotScore??0,editionStandard:st?!1:be.editionStandard??!0,editionPremium:st})}else c({id:M.id,originalId:M.id,title:M.title,price:M.price,content:"",filePath:M.filePath,isFree:M.isFree,isNew:M.isNew,isPinned:qe.includes(M.id),hotScore:M.hotScore??0,editionStandard:!0,editionPremium:!1}),pe&&!pe.success&&ie.error("无法读取文件内容: "+(pe.error||"未知错误"))}catch(J){console.error(J),c({id:M.id,title:M.title,price:M.price,content:"",filePath:M.filePath,isFree:M.isFree})}finally{m(!1)}},Dn=async()=>{var M;if(o){y(!0);try{let J=o.content||"";const pe=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(M=o.title)==null?void 0:M.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const cn of pe)J=J.replace(cn,"");J=J.replace(/^\s*\n+/,"").trim();const be=o.originalId||o.id,st=o.id!==be,mt=await _t("/api/db/book",{id:be,...st?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:J,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,editionStandard:o.editionPremium?!1:o.editionStandard??!0,editionPremium:o.editionPremium??!1,saveToFile:!0},{timeout:Vv}),Bt=st?o.id:be;o.isPinned!==qe.includes(Bt)&&await Pa(Bt),mt&&mt.success!==!1?(ie.success(`已保存:${o.title}`),c(null),er(),qr(),Gr()):ie.error("保存失败: "+(mt&&typeof mt=="object"&&"error"in mt?mt.error:"未知错误"))}catch(J){console.error(J);const pe=J instanceof Error&&J.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";ie.error(pe)}finally{y(!1)}}},gr=async()=>{if(!T.id||!T.title){ie.error("请填写章节ID和标题");return}y(!0);try{const M=On.find(be=>be.id===T.partId),J=M==null?void 0:M.chapters.find(be=>be.id===T.chapterId),pe=await _t("/api/db/book",{id:T.id,title:T.title,price:T.isFree?0:T.price,content:T.content||"",partId:T.partId,partTitle:(M==null?void 0:M.title)??"",chapterId:T.chapterId,chapterTitle:(J==null?void 0:J.title)??"",isFree:T.isFree,isNew:T.isNew,editionStandard:T.editionPremium?!1:T.editionStandard??!0,editionPremium:T.editionPremium??!1,hotScore:T.hotScore??0,saveToFile:!1},{timeout:Vv});if(pe&&pe.success!==!1){if(T.isPinned){const be=[...qe,T.id];xt(be);try{await wt("/api/db/config",{key:"pinned_section_ids",value:be,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}ie.success(`章节创建成功:${T.title}`),h(!1),R({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),er(),qr(),Gr()}else ie.error("创建失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(M){console.error(M),ie.error("创建失败")}finally{y(!1)}},Ro=M=>{R(J=>{var pe;return{...J,partId:M.id,chapterId:((pe=M.chapters[0])==null?void 0:pe.id)??"chapter-1"}}),h(!0)},Qt=M=>{_({id:M.id,title:M.title})},Un=async()=>{var M;if((M=D==null?void 0:D.title)!=null&&M.trim()){L(!0);try{const J=t.map(be=>({id:be.id,partId:be.partId||"part-1",partTitle:be.partId===D.id?D.title.trim():be.partTitle||"",chapterId:be.chapterId||"chapter-1",chapterTitle:be.chapterTitle||""})),pe=await _t("/api/db/book",{action:"reorder",items:J});if(pe&&pe.success!==!1){const be=D.title.trim();e(st=>st.map(mt=>mt.partId===D.id?{...mt,partTitle:be}:mt)),_(null),er()}else ie.error("更新篇名失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(J){console.error(J),ie.error("更新篇名失败")}finally{L(!1)}}},ps=M=>{const J=M.chapters.length+1,pe=`chapter-${M.id}-${J}-${Date.now()}`;R({id:`${J}.1`,title:"新章节",price:1,partId:M.id,chapterId:pe,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},Os=(M,J)=>{ue({part:M,chapter:J,title:J.title})},na=async()=>{var M;if((M=te==null?void 0:te.title)!=null&&M.trim()){I(!0);try{const J=t.map(be=>({id:be.id,partId:be.partId||te.part.id,partTitle:be.partId===te.part.id?te.part.title:be.partTitle||"",chapterId:be.chapterId||te.chapter.id,chapterTitle:be.partId===te.part.id&&be.chapterId===te.chapter.id?te.title.trim():be.chapterTitle||""})),pe=await _t("/api/db/book",{action:"reorder",items:J});if(pe&&pe.success!==!1){const be=te.title.trim(),st=te.part.id,mt=te.chapter.id;e(Bt=>Bt.map(cn=>cn.partId===st&&cn.chapterId===mt?{...cn,chapterTitle:be}:cn)),ue(null),er()}else ie.error("保存失败: "+(pe&&typeof pe=="object"&&"error"in pe?pe.error:"未知错误"))}catch(J){console.error(J),ie.error("保存失败")}finally{I(!1)}}},Wl=async(M,J)=>{const pe=J.sections.map(be=>be.id);if(pe.length===0){ie.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${M.chapters.indexOf(J)+1}章 | ${J.title}」吗?将删除共 ${pe.length} 节,此操作不可恢复。`))try{for(const be of pe)await Bs(`/api/db/book?id=${encodeURIComponent(be)}`);er()}catch(be){console.error(be),ie.error("删除失败")}},_i=async()=>{if(!Z.trim()){ie.error("请输入篇名");return}ve(!0);try{const M=`part-new-${Date.now()}`,J="chapter-1",pe=`part-placeholder-${Date.now()}`,be=await _t("/api/db/book",{id:pe,title:"占位节(可编辑)",price:0,content:"",partId:M,partTitle:Z.trim(),chapterId:J,chapterTitle:"第1章 | 待编辑",saveToFile:!1});be&&be.success!==!1?(ie.success(`篇「${Z}」创建成功`),X(!1),ce(""),er()):ie.error("创建失败: "+(be&&typeof be=="object"&&"error"in be?be.error:"未知错误"))}catch(M){console.error(M),ie.error("创建失败")}finally{ve(!1)}},Oa=async()=>{if(O.length===0){ie.error("请先勾选要移动的章节");return}const M=On.find(pe=>pe.id===K),J=M==null?void 0:M.chapters.find(pe=>pe.id===H);if(!M||!J||!K||!H){ie.error("请选择目标篇和章");return}me(!0);try{const pe=()=>{const Bt=new Set(O),cn=t.map(Ln=>({id:Ln.id,partId:Ln.partId||"",partTitle:Ln.partTitle||"",chapterId:Ln.chapterId||"",chapterTitle:Ln.chapterTitle||""})),$i=cn.filter(Ln=>Bt.has(Ln.id)).map(Ln=>({...Ln,partId:K,partTitle:M.title||K,chapterId:H,chapterTitle:J.title||H})),ms=cn.filter(Ln=>!Bt.has(Ln.id));let Jr=ms.length;for(let Ln=ms.length-1;Ln>=0;Ln-=1){const Gl=ms[Ln];if(Gl.partId===K&&Gl.chapterId===H){Jr=Ln+1;break}}return[...ms.slice(0,Jr),...$i,...ms.slice(Jr)]},be=async()=>{const Bt=pe(),cn=await _t("/api/db/book",{action:"reorder",items:Bt});return cn&&cn.success!==!1?(ie.success(`已移动 ${O.length} 节到「${M.title}」-「${J.title}」`),re(!1),G([]),await er(),!0):!1},st={action:"move-sections",sectionIds:O,targetPartId:K,targetChapterId:H,targetPartTitle:M.title||K,targetChapterTitle:J.title||H},mt=await _t("/api/db/book",st);if(mt&&mt.success!==!1)ie.success(`已移动 ${mt.count??O.length} 节到「${M.title}」-「${J.title}」`),re(!1),G([]),await er();else{const Bt=mt&&typeof mt=="object"&&"error"in mt?mt.error||"":"未知错误";if((Bt.includes("缺少 id")||Bt.includes("无效的 action"))&&await be())return;ie.error("移动失败: "+Bt)}}catch(pe){console.error(pe),ie.error("移动失败: "+(pe instanceof Error?pe.message:"网络或服务异常"))}finally{me(!1)}},Ul=M=>{G(J=>J.includes(M)?J.filter(pe=>pe!==M):[...J,M])},zi=async M=>{const J=t.filter(pe=>pe.partId===M.id).map(pe=>pe.id);if(J.length===0){ie.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${M.title}」整篇吗?将删除共 ${J.length} 节内容,此操作不可恢复。`))try{for(const pe of J)await Bs(`/api/db/book?id=${encodeURIComponent(pe)}`);er()}catch(pe){console.error(pe),ie.error("删除失败")}},jd=async()=>{var M;if(N.trim()){E(!0);try{const J=await Oe(`/api/search?q=${encodeURIComponent(N)}`);J!=null&&J.success&&((M=J.data)!=null&&M.results)?k(J.data.results):(k([]),J&&!J.success&&ie.error("搜索失败: "+J.error))}catch(J){console.error(J),k([]),ie.error("搜索失败")}finally{E(!1)}}},Fi=On.find(M=>M.id===T.partId),vt=(Fi==null?void 0:Fi.chapters)??[];return 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.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",On.length," 篇 · ",us," 节内容"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ee,{onClick:()=>ln(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Su,{className:"w-4 h-4 mr-2"}),"排名算法"]}),s.jsxs(ee,{onClick:()=>{const M=typeof window<"u"?`${window.location.origin}/api-doc`:"";M&&window.open(M,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ss,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),s.jsx(Ot,{open:u,onOpenChange:h,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Dt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(hn,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"章节ID *"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:T.id,onChange:M=>R({...T,id:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:T.isFree?0:T.price,onChange:M=>R({...T,price:Number(M.target.value),isFree:Number(M.target.value)===0}),disabled:T.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isFree,onChange:M=>R({...T,isFree:M.target.checked,price:M.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isNew,onChange:M=>R({...T,isNew:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:T.isPinned,onChange:M=>R({...T,isPinned:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium!==!0,onChange:()=>R({...T,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium===!0,onChange:()=>R({...T,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"热度分"}),s.jsx(ne,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:T.hotScore??0,onChange:M=>R({...T,hotScore:Math.max(0,parseFloat(M.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:T.title,onChange:M=>R({...T,title:M.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"所属篇"}),s.jsxs(ul,{value:T.partId,onValueChange:M=>{var pe;const J=On.find(be=>be.id===M);R({...T,partId:M,chapterId:((pe=J==null?void 0:J.chapters[0])==null?void 0:pe.id)??"chapter-1"})},children:[s.jsx(no,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{})}),s.jsxs(ro,{className:"bg-[#0f2137] border-gray-700",children:[On.map(M=>s.jsx(_r,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id)),On.length===0&&s.jsx(_r,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"所属章"}),s.jsxs(ul,{value:T.chapterId,onValueChange:M=>R({...T,chapterId:M}),children:[s.jsx(no,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{})}),s.jsxs(ro,{className:"bg-[#0f2137] border-gray-700",children:[vt.map(M=>s.jsx(_r,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id)),vt.length===0&&s.jsx(_r,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(Sx,{content:T.content||"",onChange:M=>R({...T,content:M}),onImageUpload:async M=>{var st;const J=new FormData;J.append("file",M),J.append("folder","book-images");const be=await(await fetch(mo("/api/upload"),{method:"POST",body:J,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((st=be==null?void 0:be.data)==null?void 0:st.url)||(be==null?void 0:be.url)||""},persons:Wr,linkTags:fe,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(on,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(ee,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:gr,disabled:g||!T.id||!T.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Ot,{open:!!D,onOpenChange:M=>!M&&_(null),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(Wt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),D&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"篇名"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:D.title,onChange:M=>_({...D,title:M.target.value}),placeholder:"输入篇名"})]})}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",onClick:()=>_(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:Un,disabled:P||!((Kl=D==null?void 0:D.title)!=null&&Kl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Ot,{open:!!te,onOpenChange:M=>!M&&ue(null),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(Wt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),te&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:te.title,onChange:M=>ue({...te,title:M.target.value}),placeholder:"输入章节名称"})]})}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",onClick:()=>ue(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:na,disabled:ae||!((ql=te==null?void 0:te.title)!=null&&ql.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ae?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Ot,{open:z,onOpenChange:M=>{var J;if(re(M),M&&On.length>0){const pe=On[0];$(pe.id),oe(((J=pe.chapters[0])==null?void 0:J.id)??"")}},children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsx(Lt,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:O.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"目标篇"}),s.jsxs(ul,{value:K,onValueChange:M=>{var pe;$(M);const J=On.find(be=>be.id===M);oe(((pe=J==null?void 0:J.chapters[0])==null?void 0:pe.id)??"")},children:[s.jsx(no,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{placeholder:"选择篇"})}),s.jsx(ro,{className:"bg-[#0f2137] border-gray-700",children:On.map(M=>s.jsx(_r,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"目标章"}),s.jsxs(ul,{value:H,onValueChange:oe,children:[s.jsx(no,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(hl,{placeholder:"选择章"})}),s.jsx(ro,{className:"bg-[#0f2137] border-gray-700",children:(((Po=On.find(M=>M.id===K))==null?void 0:Po.chapters)??[]).map(M=>s.jsx(_r,{value:M.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:M.title},M.id))})]})]})]}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",onClick:()=>re(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:Oa,disabled:q||O.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:q?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Ot,{open:!!Ae,onOpenChange:M=>!M&&Be(null),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white",children:["付款记录 — ",(Ae==null?void 0:Ae.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:$e?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Ae&&Ae.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Ae?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"py-2 pr-2",children:"订单号"}),s.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),s.jsx("th",{className:"py-2 pr-2",children:"金额"}),s.jsx("th",{className:"py-2 pr-2",children:"状态"}),s.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),s.jsx("tbody",{children:Ae.orders.map(M=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${M.orderSn}`,onClick:()=>window.open(`/orders?search=${M.orderSn??M.id??""}`,"_blank"),children:M.orderSn?M.orderSn.length>16?M.orderSn.slice(0,8)+"..."+M.orderSn.slice(-6):M.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${M.userId??M.openId??""}`,onClick:()=>window.open(`/users?search=${M.userId??M.openId??""}`,"_blank"),children:(()=>{const J=M.userId??M.openId??"-";return J.length>12?J.slice(0,6)+"..."+J.slice(-4):J})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",M.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:M.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:M.payTime??M.createdAt??"-"})]},M.id??M.orderSn??""))})]}):null})]})}),s.jsx(Ot,{open:Et,onOpenChange:ln,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(Su,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),An?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"阅读权重"}),s.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:yt.readWeight,onChange:M=>nn(J=>({...J,readWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"新度权重"}),s.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:yt.recencyWeight,onChange:M=>nn(J=>({...J,recencyWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"付款权重"}),s.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:yt.payWeight,onChange:M=>nn(J=>({...J,payWeight:Math.max(0,Math.min(1,parseFloat(M.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(yt.readWeight+yt.recencyWeight+yt.payWeight).toFixed(1)]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),s.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),s.jsx(ee,{onClick:Io,disabled:Yt||Math.abs(yt.readWeight+yt.recencyWeight+yt.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Yt?"保存中...":"保存权重"})]})]})]})}),s.jsx(Ot,{open:F,onOpenChange:X,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(hn,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:Z,onChange:M=>ce(M.target.value),placeholder:"输入篇名"})]})}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",onClick:()=>{X(!1),ce("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ee,{onClick:_i,disabled:he||!Z.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:he?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Ot,{open:!!o,onOpenChange:()=>c(null),children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Dt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[s.jsx(Wt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"章节ID"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:M=>c({...o,id:M.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:M=>c({...o,price:Number(M.target.value),isFree:Number(M.target.value)===0}),disabled:o.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:M=>c({...o,isFree:M.target.checked,price:M.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:M=>c({...o,isNew:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:M=>c({...o,isPinned:M.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium!==!0,onChange:()=>c({...o,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium===!0,onChange:()=>c({...o,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"热度分"}),s.jsx(ne,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:M=>c({...o,hotScore:Math.max(0,parseFloat(M.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"章节标题"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:M=>c({...o,title:M.target.value})})]}),o.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"文件路径"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(Sx,{ref:ds,content:o.content||"",onChange:M=>c({...o,content:M}),onImageUpload:async M=>{var st;const J=new FormData;J.append("file",M),J.append("folder","book-images");const be=await(await fetch(mo("/api/upload"),{method:"POST",body:J,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((st=be==null?void 0:be.data)==null?void 0:st.url)||(be==null?void 0:be.url)||""},persons:Wr,linkTags:fe,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(on,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&s.jsxs(ee,{variant:"outline",onClick:()=>et({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[s.jsx(Br,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(ee,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(ee,{onClick:Dn,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(xd,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Ll,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(Zt,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Br,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(Zt,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Pg,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(Zt,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Na,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(Zt,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Ss,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(Zt,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx($v,{className:"w-4 h-4 mr-2"}),"链接标签"]}),s.jsxs(Zt,{value:"linkedmp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(yi,{className:"w-4 h-4 mr-2"}),"关联小程序"]})]}),s.jsxs(en,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx(Br,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),s.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),s.jsxs("div",{className:"text-center shrink-0",children:[s.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:us}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(ee,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(ee,{onClick:()=>X(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(ee,{variant:"outline",onClick:()=>re(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",O.length," 节)"]})]}),n?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(aV,{parts:On,expandedParts:a,onTogglePart:ea,onReorder:Rr,onReadSection:tt,onDeleteSection:Pi,onAddSectionInPart:Ro,onAddChapterInPart:ps,onDeleteChapter:Wl,onEditPart:Qt,onDeletePart:zi,onEditChapter:Os,selectedSectionIds:O,onToggleSectionSelect:Ul,onShowSectionOrders:et,pinnedSectionIds:qe})]}),s.jsx(en,{value:"search",className:"space-y-4",children:s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Je,{children:s.jsx(Ye,{className:"text-white",children:"内容搜索"})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:N,onChange:M=>w(M.target.value),onKeyDown:M=>M.key==="Enter"&&jd()}),s.jsx(ee,{onClick:jd,disabled:C||!N.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Ke,{className:"w-4 h-4 animate-spin"}):s.jsx(Na,{className:"w-4 h-4"})})]}),v.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",v.length," 个结果"]}),v.map(M=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>tt({id:M.id,mid:M.mid,title:M.title,price:M.price??1,filePath:""}),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:M.id}),s.jsx("span",{className:"text-white",children:M.title}),qe.includes(M.id)&&s.jsx(ml,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Ue,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:M.matchType==="title"?"标题匹配":"内容匹配"})]}),M.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:M.snippet}),(M.partTitle||M.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[M.partTitle," · ",M.chapterTitle]})]},M.id))]})]})]})}),s.jsxs(en,{value:"ranking",className:"space-y-4",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs(Ye,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Su,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(Ee,{children:s.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Y,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(ne,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:gt,onChange:M=>It(Math.max(1,Math.min(100,Number(M.target.value)||20))),disabled:gn}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(ee,{size:"sm",onClick:Re,disabled:wr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:wr?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",gt,"% 内容"]})]})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(Ye,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Pg,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",Rn.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Kr(),disabled:W,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Ke,{className:`w-4 h-4 ${W?"animate-spin":""}`})}),s.jsx(ee,{variant:"ghost",size:"sm",disabled:In<=1||W,onClick:()=>pr(M=>Math.max(1,M-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(JT,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[In," / ",Rs]}),s.jsx(ee,{variant:"ghost",size:"sm",disabled:In>=Rs||W,onClick:()=>pr(M=>Math.min(Rs,M+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(fl,{className:"w-4 h-4"})})]})]})}),s.jsx(Ee,{children:s.jsxs("div",{className:"space-y-0",children:[s.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"排名"}),s.jsx("span",{children:"置顶"}),s.jsx("span",{children:"标题"}),s.jsx("span",{className:"text-right",children:"点击量"}),s.jsx("span",{className:"text-right",children:"付款数"}),s.jsx("span",{className:"text-right",children:"热度"}),s.jsx("span",{className:"text-right",children:"编辑"})]}),Ma.map((M,J)=>{const pe=(In-1)*hs+J+1,be=M.isPinned??qe.includes(M.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${be?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${pe<=3?"text-amber-400":"text-gray-500"}`,children:pe<=3?["🥇","🥈","🥉"][pe-1]:`#${pe}`}),s.jsx(ee,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${be?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Pa(M.id),disabled:lt,title:be?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:be?s.jsx(ml,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(xA,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:M.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[M.partTitle," · ",M.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:M.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:M.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(M.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(ee,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>tt({id:M.id,mid:M.mid,title:M.title,price:M.price,filePath:""}),title:"编辑文章",children:s.jsx(Wt,{className:"w-3 h-3"})})})]},M.id)}),Ma.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(en,{value:"link-person",className:"space-y-4",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{className:"pb-3",children:[s.jsxs(Ye,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"添加时自动生成 32 位 token,文章 @ 时存 token;小程序点击 @ 时用 token 兑换真实密钥后加好友"})]}),s.jsxs(Ee,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"添加人物时同步创建存客宝场景获客计划,配置与存客宝 API 获客一致"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ee,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>qr(),title:"刷新",children:s.jsx(Ke,{className:"w-4 h-4"})}),s.jsxs(ee,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Xs(null),Pn(!0)},children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Wr.length>0?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("th",{className:"text-left py-1.5 px-3 w-[280px] font-normal",children:"token"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-24 font-normal",children:"@的人"}),s.jsx("th",{className:"text-left py-1.5 px-3 font-normal",children:"获客计划活动名"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-20 font-normal",children:"planId"}),s.jsx("th",{className:"text-left py-1.5 px-3 font-normal",children:"apiKey"}),s.jsx("th",{className:"text-left py-1.5 px-2 w-24 font-normal",children:"操作"})]})}),s.jsx("tbody",{children:Wr.map(M=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"32位token",children:M.id}),s.jsx("td",{className:"py-2 px-3 text-amber-400 truncate max-w-[96px]",title:"@的人",children:M.name}),s.jsxs("td",{className:"py-2 px-3 text-white truncate max-w-[200px]",title:"获客计划活动名",children:["SOUL链接人与事-",M.name]}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"存客宝计划ID",children:M.ckbPlanId??"-"}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[M.ckbApiKey?s.jsx(ee,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-gray-500 hover:text-[#38bdac] shrink-0",title:"复制 apiKey",onClick:async()=>{await navigator.clipboard.writeText(M.ckbApiKey??""),ie.success("已复制到剪贴板")},children:s.jsx(Fx,{className:"w-3.5 h-3.5"})}):null,s.jsx("span",{title:M.ckbApiKey??"",children:M.ckbApiKey??"-"})]})}),s.jsx("td",{className:"py-2 px-2",children:s.jsxs("div",{className:"flex items-center gap-0",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const J=await oV(M.personId||"");if(J!=null&&J.success&&J.person){const pe=J.person;Xs({id:pe.token??pe.personId,personId:pe.personId,name:pe.name,label:pe.label??"",ckbApiKey:pe.ckbApiKey??"",remarkType:pe.remarkType,remarkFormat:pe.remarkFormat,addFriendInterval:pe.addFriendInterval,startTime:pe.startTime,endTime:pe.endTime,deviceGroups:pe.deviceGroups})}else Xs(M),J!=null&&J.error&&ie.error(J.error)}catch(J){console.error(J),Xs(M),ie.error(J instanceof Error?J.message:"加载人物详情失败")}Pn(!0)},children:s.jsx(tj,{className:"w-3 h-3"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-amber-400 h-6 px-2",title:"编辑计划(跳转存客宝)",onClick:()=>{const J=M.ckbPlanId;J?window.open(`https://h5.ckb.quwanzhi.com/#/scenarios/edit/${J}`,"_blank"):ie.info("该人物尚未同步存客宝计划,请先保存后等待同步完成")},children:s.jsx(Us,{className:"w-3 h-3"})}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:"删除(同时删除存客宝对应获客计划)",onClick:()=>Zs(M),children:s.jsx(ir,{className:"w-3 h-3"})})]})})]},M.id))})]}):s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{className:"pb-3",children:[s.jsxs(Ye,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Su,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(Ee,{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往"," ",s.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]}),s.jsx(en,{value:"link-tag",className:"space-y-4",children:s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{className:"pb-3",children:[s.jsxs(Ye,{className:"text-white text-base flex items-center gap-2",children:[s.jsx($v,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(Ee,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap justify-between",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"标签ID"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:ht.tagId,onChange:M=>xn({...ht,tagId:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"显示文字"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:ht.label,onChange:M=>xn({...ht,label:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"类型"}),s.jsxs(ul,{value:ht.type,onValueChange:M=>xn({...ht,type:M}),children:[s.jsx(no,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:s.jsx(hl,{})}),s.jsxs(ro,{children:[s.jsx(_r,{value:"url",children:"网页链接"}),s.jsx(_r,{value:"miniprogram",children:"小程序"}),s.jsx(_r,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:ht.type==="url"?"URL地址":ht.type==="ckb"?"存客宝计划URL":"小程序(选密钥)"}),ht.type==="miniprogram"&&Ra.length>0?s.jsxs("div",{ref:Di,className:"relative w-44",children:[s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:"搜索名称或密钥",value:Oi?ta:ht.appId,onChange:M=>{const J=M.target.value;Pt(J),fs(!0),Ra.some(pe=>pe.key===J)||xn({...ht,appId:J})},onFocus:()=>{Pt(ht.appId),fs(!0)},onBlur:()=>setTimeout(()=>fs(!1),150)}),Oi&&s.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 max-h-48 overflow-y-auto rounded-md border border-gray-700 bg-[#0a1628] shadow-lg z-50",children:Li.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):Li.map(M=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:J=>{J.preventDefault(),xn({...ht,appId:M.key,pagePath:M.path||""}),Pt(""),fs(!1)},children:[s.jsx("span",{children:M.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:M.key})]},M.key))})]}):s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:ht.type==="url"?"https://...":ht.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联小程序的32位密钥",value:ht.type==="url"||ht.type==="ckb"?ht.url:ht.appId,onChange:M=>{ht.type==="url"||ht.type==="ckb"?xn({...ht,url:M.target.value}):xn({...ht,appId:M.target.value})}})]}),ht.type==="miniprogram"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-400 text-xs",children:"页面路径"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:ht.pagePath,onChange:M=>xn({...ht,pagePath:M.target.value})})]}),s.jsxs(ee,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!ht.tagId||!ht.label){ie.error("标签ID和显示文字必填");return}const M={...ht};M.type==="miniprogram"&&(M.url=""),await wt("/api/db/link-tags",M),xn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Ir(null),Gr()},children:[s.jsx(hn,{className:"w-3 h-3 mr-1"}),Ur?"保存":"添加"]})]}),s.jsx(ee,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>Gr(),title:"刷新",children:s.jsx(Ke,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[fe.map(M=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[s.jsxs("button",{type:"button",className:"text-amber-400 font-bold text-base hover:underline",onClick:()=>{xn({tagId:M.id,label:M.label,url:M.url,type:M.type,appId:M.appId??"",pagePath:M.pagePath??""}),Ir(M.id)},children:["#",M.label]}),s.jsx(Ue,{variant:"secondary",className:`text-[10px] ${M.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:M.type==="url"?"网页":M.type==="ckb"?"存客宝":"小程序"}),M.type==="miniprogram"?s.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[M.appId," ",M.pagePath?`· ${M.pagePath}`:""]}):M.url?s.jsxs("a",{href:M.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[M.url," ",s.jsx(Us,{className:"w-3 h-3 shrink-0"})]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-6 px-2",onClick:()=>{xn({tagId:M.id,label:M.label,url:M.url,type:M.type,appId:M.appId??"",pagePath:M.pagePath??""}),Ir(M.id)},children:"编辑"}),s.jsx(ee,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Bs(`/api/db/link-tags?tagId=${M.id}`),Ur===M.id&&(Ir(null),xn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""})),Gr()},children:s.jsx(ir,{className:"w-3 h-3"})})]})]},M.id)),fe.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]})}),s.jsx(en,{value:"linkedmp",className:"space-y-4",children:s.jsx(rV,{})})]}),s.jsx(lV,{open:Rt,onOpenChange:Pn,editingPerson:Qs,onSubmit:async M=>{var be;const J={personId:M.personId||M.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:M.name,label:M.label,ckbApiKey:M.ckbApiKey||void 0,greeting:M.greeting||void 0,tips:M.tips||void 0,remarkType:M.remarkType||void 0,remarkFormat:M.remarkFormat||void 0,addFriendInterval:M.addFriendInterval,startTime:M.startTime||void 0,endTime:M.endTime||void 0,deviceGroups:(be=M.deviceGroups)!=null&&be.trim()?M.deviceGroups.split(",").map(st=>parseInt(st.trim(),10)).filter(st=>!Number.isNaN(st)):void 0},pe=await wt("/api/db/persons",J);if(pe&&pe.success===!1){const st=pe;st.ckbResponse&&console.log("存客宝返回",st.ckbResponse);const mt=st.error||"操作失败";throw new Error(mt)}if(qr(),ie.success(Qs?"已保存":"已添加"),pe!=null&&pe.ckbCreateResult&&Object.keys(pe.ckbCreateResult).length>0){const st=pe.ckbCreateResult;console.log("存客宝创建结果",st);const mt=st.planId??st.id,Bt=mt!=null?[`planId: ${mt}`]:[];st.apiKey!=null&&Bt.push("apiKey: ***"),ie.info(Bt.length?`存客宝创建结果:${Bt.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Ot,{open:!!Wn,onOpenChange:M=>{M||Zs(null)},children:s.jsxs(Mt,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Dt,{className:"gap-1",children:[s.jsx(Lt,{className:"text-white text-base",children:"确认删除"}),s.jsx(xf,{className:"text-gray-400 text-sm leading-relaxed break-words",children:Wn&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除「SOUL链接人与事-",Wn.name,"」?将同时删除存客宝对应获客计划。"]}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",Wn.name," 将无法正常跳转。"]})]})})]}),s.jsxs(on,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(ee,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>Zs(null),children:"取消"}),s.jsx(ee,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{Wn&&(await Bs(`/api/db/persons?personId=${Wn.personId}`),Zs(null),qr(),ie.success("已删除"))},children:"确定删除"})]})]})})]})}const ba={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function bw(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):ba.stats}function vw(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):ba.highlights}function uV(){const[t,e]=b.useState(ba),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Oe("/api/admin/author-settings").then(k=>{const C=k==null?void 0:k.data;C&&typeof C=="object"&&e({name:String(C.name??ba.name),avatar:String(C.avatar??ba.avatar),avatarImg:String(C.avatarImg??""),title:String(C.title??ba.title),bio:String(C.bio??ba.bio),stats:bw(C.stats).length?bw(C.stats):ba.stats,highlights:vw(C.highlights).length?vw(C.highlights):ba.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{i(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(T=>T.label||T.value),highlights:t.highlights.filter(Boolean)},C=await wt("/api/admin/author-settings",k);if(!C||C.success===!1){ie.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:""));return}i(!1);const E=document.createElement("div");E.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",E.textContent="作者设置已保存",document.body.appendChild(E),setTimeout(()=>E.remove(),2e3)}catch(k){console.error(k),ie.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var E;const C=(E=k.target.files)==null?void 0:E[0];if(C){c(!0);try{const T=new FormData;T.append("file",C),T.append("folder","avatars");const R=ff(),D={};R&&(D.Authorization=`Bearer ${R}`);const P=await(await fetch(mo("/api/upload"),{method:"POST",body:T,credentials:"include",headers:D})).json();P!=null&&P.success&&(P!=null&&P.url)?e(L=>({...L,avatarImg:P.url})):ie.error("上传失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(T){console.error(T),ie.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(C=>({...C,stats:C.stats.filter((E,T)=>T!==k)})),y=(k,C,E)=>e(T=>({...T,stats:T.stats.map((R,D)=>D===k?{...R,[C]:E}:R)})),N=()=>e(k=>({...k,highlights:[...k.highlights,""]})),w=k=>e(C=>({...C,highlights:C.highlights.filter((E,T)=>T!==k)})),v=(k,C)=>e(E=>({...E,highlights:E.highlights.map((T,R)=>R===k?C:T)}));return n?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(lo,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(ee,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"flex items-center gap-2 text-white",children:[s.jsx(lo,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Ft,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(Ee,{className:"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(Y,{className:"text-gray-300",children:"姓名"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(C=>({...C,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(C=>({...C,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Xw,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(C=>({...C,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(ee,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[s.jsx(dh,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:t.avatarImg.startsWith("http")?t.avatarImg:mo(t.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"头衔"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(C=>({...C,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"个人简介"}),s.jsx(_l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(C=>({...C,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsx(Ye,{className:"text-white",children:"统计数据"}),s.jsx(Ft,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(Ee,{className:"space-y-3",children:[t.stats.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:E=>y(C,"label",E.target.value),placeholder:"标签"}),s.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:E=>y(C,"value",E.target.value),placeholder:"数值"}),s.jsx(ee,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(C),children:s.jsx(ir,{className:"w-4 h-4"})})]},C)),s.jsxs(ee,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsx(Ye,{className:"text-white",children:"亮点标签"}),s.jsx(Ft,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(Ee,{className:"space-y-3",children:[t.highlights.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:E=>v(C,E.target.value),placeholder:"5年私域运营经验"}),s.jsx(ee,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>w(C),children:s.jsx(ir,{className:"w-4 h-4"})})]},C)),s.jsxs(ee,{variant:"outline",size:"sm",onClick:N,className:"border-gray-600 text-gray-400",children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function hV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=n0(h,300),[g,y]=b.useState(!0),[N,w]=b.useState(null),[v,k]=b.useState(!1),[C,E]=b.useState(null),[T,R]=b.useState(""),[D,_]=b.useState(""),[P,L]=b.useState(""),[F,X]=b.useState("admin"),[te,ue]=b.useState("active"),[ae,I]=b.useState(!1);async function O(){var H;y(!0),w(null);try{const oe=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&oe.set("search",m.trim());const q=await Oe(`/api/admin/users?${oe}`);q!=null&&q.success?(e(q.records||[]),r(q.total??0),u(q.totalPages??0)):w(q.error||"加载失败")}catch(oe){const q=oe;w(q.status===403?"无权限访问":((H=q==null?void 0:q.data)==null?void 0:H.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{O()},[a,o,m]);const G=()=>{E(null),R(""),_(""),L(""),X("admin"),ue("active"),k(!0)},z=H=>{E(H),R(H.username),_(""),L(H.name||""),X(H.role==="super_admin"?"super_admin":"admin"),ue(H.status==="disabled"?"disabled":"active"),k(!0)},re=async()=>{var H;if(!T.trim()){w("用户名不能为空");return}if(!C&&!D){w("新建时密码必填,至少 6 位");return}if(D&&D.length<6){w("密码至少 6 位");return}w(null),I(!0);try{if(C){const oe=await _t("/api/admin/users",{id:C.id,password:D||void 0,name:P.trim(),role:F,status:te});oe!=null&&oe.success?(k(!1),O()):w((oe==null?void 0:oe.error)||"保存失败")}else{const oe=await wt("/api/admin/users",{username:T.trim(),password:D,name:P.trim(),role:F});oe!=null&&oe.success?(k(!1),O()):w((oe==null?void 0:oe.error)||"保存失败")}}catch(oe){const q=oe;w(((H=q==null?void 0:q.data)==null?void 0:H.error)||"保存失败")}finally{I(!1)}},K=async H=>{var oe;if(confirm("确定删除该管理员?"))try{const q=await Bs(`/api/admin/users?id=${H}`);q!=null&&q.success?O():w((q==null?void 0:q.error)||"删除失败")}catch(q){const me=q;w(((oe=me==null?void 0:me.data)==null?void 0:oe.error)||"删除失败")}},$=H=>{if(!H)return"-";try{const oe=new Date(H);return isNaN(oe.getTime())?H:oe.toLocaleString("zh-CN")}catch{return H}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx($x,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{placeholder:"搜索用户名/昵称",value:h,onChange:H=>f(H.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(ee,{variant:"outline",size:"sm",onClick:O,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(Ke,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(ee,{onClick:G,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),N&&s.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[s.jsx("span",{children:N}),s.jsx("button",{type:"button",onClick:()=>w(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(lr,{children:[s.jsx(cr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),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-right text-gray-400",children:"操作"})]})}),s.jsxs(dr,{children:[t.map(H=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(ye,{className:"text-gray-300",children:H.id}),s.jsx(ye,{className:"text-white font-medium",children:H.username}),s.jsx(ye,{className:"text-gray-400",children:H.name||"-"}),s.jsx(ye,{children:s.jsx(Ue,{variant:"outline",className:H.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:H.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(ye,{children:s.jsx(Ue,{variant:"outline",className:H.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:H.status==="active"?"正常":"已禁用"})}),s.jsx(ye,{className:"text-gray-500 text-sm",children:$(H.createdAt)}),s.jsxs(ye,{className:"text-right",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>z(H),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(Wt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>K(H.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Jn,{className:"w-4 h-4"})})]})]},H.id)),t.length===0&&!g&&s.jsx(it,{children:s.jsx(ye,{colSpan:7,className:"text-center py-12 text-gray-500",children:N==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(is,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Ot,{open:v,onOpenChange:k,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Dt,{children:s.jsx(Lt,{className:"text-white",children:C?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"用户名"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:T,onChange:H=>R(H.target.value),disabled:!!C}),C&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:C?"新密码(留空不改)":"密码"}),s.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:C?"留空表示不修改":"至少 6 位",value:D,onChange:H=>_(H.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"昵称"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:P,onChange:H=>L(H.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:F,onChange:H=>X(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),C&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:te,onChange:H=>ue(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(on,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:re,disabled:ae,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),ae?"保存中...":"保存"]})]})]})})]})}function wn({method:t,url:e,desc:n,headers:r,body:a,response:i}){const o=t==="GET"?"text-emerald-400":t==="POST"?"text-amber-400":t==="PUT"?"text-blue-400":t==="DELETE"?"text-rose-400":"text-gray-400";return s.jsxs("div",{className:"rounded-lg bg-[#0a1628]/60 border border-gray-700/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:`font-mono font-semibold ${o}`,children:t}),s.jsx("code",{className:"text-sm text-[#38bdac] break-all",children:e})]}),n&&s.jsx("p",{className:"text-gray-400 text-sm",children:n}),r&&r.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Headers"}),s.jsx("pre",{className:"text-xs text-gray-300 font-mono overflow-x-auto p-2 rounded bg-black/30",children:r.join(` -`)})]}),a&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Request Body (JSON)"}),s.jsx("pre",{className:"text-xs text-green-400/90 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:a})]}),i&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Response Example"}),s.jsx("pre",{className:"text-xs text-amber-200/80 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:i})]})]})}function F4(){const t=["Authorization: Bearer {token}","Content-Type: application/json"];return s.jsxs("div",{className:"p-8 w-full bg-[#0a1628] text-white",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"内容管理相关接口 · RESTful · 基础路径 /api · 管理端需 Bearer Token"})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Zw,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(Ee,{className:"space-y-4",children:s.jsx(wn,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ - "username": "admin", - "password": "your_password" -}`,response:`{ - "success": true, - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", - "expires_at": "2026-03-16T12:00:00Z" -}`})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Br,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsx(wn,{method:"GET",url:"/api/db/book?action=chapters",desc:"获取章节树",headers:t,response:`{ - "success": true, - "data": [ - { "id": "part-1", "title": "第一篇", "children": [...] }, - { "id": "section-1", "title": "第1节", "price": 1.0, "isFree": false } - ] -}`}),s.jsx(wn,{method:"GET",url:"/api/db/book?action=section&id={id}",desc:"获取单篇内容",headers:t,response:`{ - "success": true, - "data": { - "id": "section-1", - "title": "标题", - "content": "正文...", - "price": 1.0, - "isFree": false, - "partId": "part-1", - "chapterId": "ch-1" - } -}`}),s.jsx(wn,{method:"POST",url:"/api/db/book",desc:"新建章节 (action=create-section)",headers:t,body:`{ - "action": "create-section", - "title": "新章节标题", - "content": "正文内容", - "price": 0, - "isFree": true, - "partId": "part-1", - "chapterId": "ch-1", - "partTitle": "第一篇", - "chapterTitle": "第1章" -}`,response:`{ - "success": true, - "data": { "id": "section-new-id", "title": "新章节标题", ... } -}`}),s.jsx(wn,{method:"POST",url:"/api/db/book",desc:"更新章节内容 (action=update-section)",headers:t,body:`{ - "action": "update-section", - "id": "section-1", - "title": "更新后的标题", - "content": "更新后的正文", - "price": 1.0, - "isFree": false -}`,response:`{ - "success": true, - "data": { "id": "section-1", "title": "更新后的标题", ... } -}`}),s.jsx(wn,{method:"POST",url:"/api/db/book",desc:"删除章节 (action=delete-section)",headers:t,body:`{ - "action": "delete-section", - "id": "section-1" -}`,response:`{ - "success": true, - "message": "已删除" -}`}),s.jsx(wn,{method:"POST",url:"/api/admin/content/upload",desc:"上传图片(管理端)",headers:t,body:"FormData: file (binary)",response:`{ - "success": true, - "url": "/uploads/images/xxx.jpg", - "data": { "url", "fileName", "size", "type" } -}`})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(lo,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsx(wn,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ - "success": true, - "data": [ - { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } - ] -}`}),s.jsx(wn,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ - "success": true, - "data": { - "personId": "p1", - "label": "张三", - "aliases": ["老张"], - "description": "..." - } -}`}),s.jsx(wn,{method:"POST",url:"/api/db/persons",desc:"新增/更新人物(含 aliases 字段)",headers:t,body:`{ - "personId": "p1", - "label": "张三", - "aliases": ["老张", "张三丰"], - "description": "可选描述" -}`,response:`{ - "success": true, - "data": { "personId": "p1", "label": "张三", ... } -}`}),s.jsx(wn,{method:"DELETE",url:"/api/db/persons?personId={id}",desc:"删除人物",headers:t,response:`{ - "success": true, - "message": "已删除" -}`})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(_c,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsx(wn,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ - "success": true, - "data": [ - { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } - ] -}`}),s.jsx(wn,{method:"POST",url:"/api/db/link-tags",desc:"新增/更新标签(含 aliases, type: url/miniprogram/ckb)",headers:t,body:`{ - "tagId": "t1", - "label": "官网", - "aliases": ["官方网站"], - "type": "url", - "url": "https://example.com" -} - -// type 可选: url | miniprogram | ckb`,response:`{ - "success": true, - "data": { "tagId": "t1", "label": "官网", "type": "url", ... } -}`}),s.jsx(wn,{method:"DELETE",url:"/api/db/link-tags?tagId={id}",desc:"删除标签",headers:t,response:`{ - "success": true, - "message": "已删除" -}`})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Na,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(Ee,{className:"space-y-4",children:s.jsx(wn,{method:"GET",url:"/api/search?q={keyword}",desc:"搜索(标题优先 3 条 + 内容匹配)",headers:t,response:`{ - "success": true, - "data": { - "titleMatches": [{ "id": "s1", "title": "...", "snippet": "..." }], - "contentMatches": [{ "id": "s2", "title": "...", "snippet": "..." }] - } -}`})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Pg,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(Ee,{className:"space-y-4",children:s.jsx(wn,{method:"GET",url:"/api/db/book?action=ranking",desc:"排行榜数据",headers:t,response:`{ - "success": true, - "data": [ - { "id": "s1", "title": "...", "clickCount": 100, "payCount": 50, "hotScore": 120, "hotRank": 1 } - ] -}`})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{className:"pb-3",children:s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsx(wn,{method:"GET",url:"/api/miniprogram/book/all-chapters",desc:"全部章节(小程序用)",headers:["Content-Type: application/json"],response:`{ - "success": true, - "data": [ { "id": "s1", "title": "...", "price": 1.0, "isFree": false }, ... ] -}`}),s.jsx(wn,{method:"GET",url:"/api/miniprogram/balance?userId={id}",desc:"查余额",headers:["Content-Type: application/json"],response:`{ - "success": true, - "data": { "balance": 100.50, "userId": "xxx" } -}`}),s.jsx(wn,{method:"POST",url:"/api/miniprogram/balance/gift",desc:"代付",headers:["Content-Type: application/json"],body:`{ - "userId": "xxx", - "amount": 10.00, - "remark": "可选备注" -}`,response:`{ - "success": true, - "data": { "balance": 110.50 } -}`}),s.jsx(wn,{method:"POST",url:"/api/miniprogram/balance/gift/redeem",desc:"领取代付",headers:["Content-Type: application/json"],body:`{ - "code": "GIFT_XXXX" -}`,response:`{ - "success": true, - "data": { "amount": 10.00, "balance": 120.50 } -}`})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-6",children:"管理端仅使用 /api/admin/*、/api/db/*;小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const fV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},pV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},mV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...pV},ckbLeadApiKey:""},gV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0},xV=["system","author","admin","api-docs"];function yV(){const[t,e]=Hw(),n=t.get("tab")??"system",r=xV.includes(n)?n:"system",[a,i]=b.useState(mV),[o,c]=b.useState(gV),[u,h]=b.useState(fV),[f,m]=b.useState({}),[g,y]=b.useState(!1),[N,w]=b.useState(!0),[v,k]=b.useState(!1),[C,E]=b.useState(""),[T,R]=b.useState(""),[D,_]=b.useState(!1),[P,L]=b.useState(!1),F=(I,O,G=!1)=>{E(I),R(O),_(G),k(!0)};b.useEffect(()=>{(async()=>{try{const O=await Oe("/api/admin/settings");if(!O||O.success===!1)return;if(O.featureConfig&&Object.keys(O.featureConfig).length&&c(G=>({...G,...O.featureConfig})),O.mpConfig&&typeof O.mpConfig=="object"&&h(G=>({...G,...O.mpConfig})),O.ossConfig&&typeof O.ossConfig=="object"&&m(G=>({...G,...O.ossConfig})),O.siteSettings&&typeof O.siteSettings=="object"){const G=O.siteSettings;i(z=>({...z,...typeof G.sectionPrice=="number"&&{sectionPrice:G.sectionPrice},...typeof G.baseBookPrice=="number"&&{baseBookPrice:G.baseBookPrice},...typeof G.distributorShare=="number"&&{distributorShare:G.distributorShare},...G.authorInfo&&typeof G.authorInfo=="object"&&{authorInfo:{...z.authorInfo,...G.authorInfo}},...typeof G.ckbLeadApiKey=="string"&&{ckbLeadApiKey:G.ckbLeadApiKey}}))}}catch(O){console.error("Load settings error:",O)}finally{w(!1)}})()},[]);const X=async(I,O)=>{L(!0);try{const G=await wt("/api/admin/settings",{featureConfig:I});if(!G||G.success===!1){O(),F("保存失败",(G==null?void 0:G.error)??"未知错误",!0);return}F("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(G){console.error("Save feature config error:",G),O(),F("保存失败",G instanceof Error?G.message:String(G),!0)}finally{L(!1)}},te=(I,O)=>{const G=o,z={...G,[I]:O};c(z),X(z,()=>c(G))},ue=async()=>{y(!0);try{const I=await wt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:a.sectionPrice,baseBookPrice:a.baseBookPrice,distributorShare:a.distributorShare,authorInfo:a.authorInfo,ckbLeadApiKey:a.ckbLeadApiKey||void 0},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10},ossConfig:Object.keys(f).length?{endpoint:f.endpoint??"",bucket:f.bucket??"",region:f.region??"",accessKeyId:f.accessKeyId??"",accessKeySecret:f.accessKeySecret??""}:void 0});if(!I||I.success===!1){F("保存失败",(I==null?void 0:I.error)??"未知错误",!0);return}F("已保存","设置已保存成功。")}catch(I){console.error("Save settings error:",I),F("保存失败",I instanceof Error?I.message:String(I),!0)}finally{y(!1)}},ae=I=>{e(I==="system"?{}:{tab:I})};return N?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-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&s.jsxs(ee,{onClick:ue,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存设置"]})]}),s.jsxs(xd,{value:r,onValueChange:ae,className:"w-full",children:[s.jsxs(Ll,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(Zt,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(wl,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(Zt,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Em,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(Zt,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx($x,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(Zt,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Jw,{className:"w-4 h-4 mr-2"}),"API 文档"]})]}),s.jsx(en,{value:"system",className:"mt-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Em,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Ft,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Em,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(ne,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.name??"",onChange:I=>i(O=>({...O,authorInfo:{...O.authorInfo,name:I.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(lh,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(ne,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:a.authorInfo.startDate??"",onChange:I=>i(O=>({...O,authorInfo:{...O.authorInfo,startDate:I.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(lh,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(ne,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:a.authorInfo.liveTime??"",onChange:I=>i(O=>({...O,authorInfo:{...O.authorInfo,liveTime:I.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ej,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(ne,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:a.authorInfo.platform??"",onChange:I=>i(O=>({...O,authorInfo:{...O.authorInfo,platform:I.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Br,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(ne,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.description??"",onChange:I=>i(O=>({...O,authorInfo:{...O.authorInfo,description:I.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(_l,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:a.authorInfo.bio??"",onChange:I=>i(O=>({...O,authorInfo:{...O.authorInfo,bio:I.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ss,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(ne,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:a.ckbLeadApiKey??"",onChange:I=>i(O=>({...O,ckbLeadApiKey:I.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(a.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:a.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:a.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",a.authorInfo.liveTime," · ",a.authorInfo.platform]})]})]})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(ch,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(Ee,{className:"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(Y,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.sectionPrice,onChange:I=>i(O=>({...O,sectionPrice:Number.parseFloat(I.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.baseBookPrice,onChange:I=>i(O=>({...O,baseBookPrice:Number.parseFloat(I.target.value)||9.9}))})]})]})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Ft,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsx(Ee,{className:"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(Y,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:I=>h(O=>({...O,appId:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:I=>h(O=>({...O,withdrawSubscribeTmplId:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:I=>h(O=>({...O,mchId:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:I=>h(O=>({...O,minWithdraw:Number.parseFloat(I.target.value)||10}))})]})]})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(wl,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Ft,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Zn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Y,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(At,{id:"match-enabled",checked:o.matchEnabled,disabled:P,onCheckedChange:I=>te("matchEnabled",I)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Qw,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Y,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),s.jsx(At,{id:"referral-enabled",checked:o.referralEnabled,disabled:P,onCheckedChange:I=>te("referralEnabled",I)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Br,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Y,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页、目录页搜索栏的显示"})]}),s.jsx(At,{id:"search-enabled",checked:o.searchEnabled,disabled:P,onCheckedChange:I=>te("searchEnabled",I)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(iM,{className:"w-5 h-5 text-[#38bdac]"}),"OSS 配置(阿里云对象存储)"]}),s.jsx(Ft,{className:"text-gray-400",children:"endpoint、bucket、accessKey 等,用于图片/文件上传"})]}),s.jsx(Ee,{className:"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(Y,{className:"text-gray-300",children:"Endpoint"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:f.endpoint??"",onChange:I=>m(O=>({...O,endpoint:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"Bucket"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"bucket 名称",value:f.bucket??"",onChange:I=>m(O=>({...O,bucket:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"Region"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:f.region??"",onChange:I=>m(O=>({...O,region:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey ID",value:f.accessKeyId??"",onChange:I=>m(O=>({...O,accessKeyId:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey Secret",value:f.accessKeySecret??"",onChange:I=>m(O=>({...O,accessKeySecret:I.target.value}))})]})]})})]})]})}),s.jsx(en,{value:"author",className:"mt-0",children:s.jsx(uV,{})}),s.jsx(en,{value:"admin",className:"mt-0",children:s.jsx(hV,{})}),s.jsx(en,{value:"api-docs",className:"mt-0",children:s.jsx(F4,{})})]}),s.jsx(Ot,{open:v,onOpenChange:k,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Dt,{children:[s.jsx(Lt,{className:D?"text-red-400":"text-[#38bdac]",children:C}),s.jsx(xf,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:T})]}),s.jsx(on,{className:"mt-4",children:s.jsx(ee,{onClick:()=>k(!1),className:D?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Nw={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function bV(){const[t,e]=b.useState(!1),[n,r]=b.useState(Nw),[a,i]=b.useState(""),o=async()=>{e(!0);try{const k=await Oe("/api/config");k!=null&&k.paymentMethods&&r({...Nw,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await wt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),ie.success("配置已保存!")}catch(k){console.error("保存失败:",k),ie.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,C)=>{navigator.clipboard.writeText(k),i(C),setTimeout(()=>i(""),2e3)},h=(k,C)=>{r(E=>({...E,wechat:{...E.wechat,[k]:C}}))},f=(k,C)=>{r(E=>({...E,alipay:{...E.alipay,[k]:C}}))},m=(k,C)=>{r(E=>({...E,usdt:{...E.usdt,[k]:C}}))},g=(k,C)=>{r(E=>({...E,paypal:{...E.paypal,[k]:C}}))},y=n.wechat,N=n.alipay,w=n.usdt,v=n.paypal;return 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.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ee,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(ee,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(qw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),s.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[s.jsx("li",{children:"打开微信,进入目标微信群"}),s.jsx("li",{children:'点击右上角"..." → "群二维码"'}),s.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),s.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),s.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),s.jsxs(xd,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Ll,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(Zt,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(yi,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(Zt,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(Fv,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(Zt,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(_v,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(Zt,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Ag,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(en,{value:"wechat",className:"space-y-4",children:s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ye,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(At,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(Ee,{className:"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(Y,{className:"text-gray-300",children:"网站AppID"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"商户号"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Us,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),s.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[s.jsx(Y,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(ne,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(en,{value:"alipay",className:"space-y-4",children:s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ye,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(Fv,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Ft,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(At,{checked:!!N.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(Ee,{className:"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(Y,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(ee,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(N.partnerId??""),"pid"),children:a==="pid"?s.jsx(hf,{className:"w-4 h-4 text-green-500"}):s.jsx(Fx,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Us,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(N.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(en,{value:"usdt",className:"space-y-4",children:s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ye,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(_v,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(At,{checked:!!w.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(w.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"收款地址"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(w.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(en,{value:"paypal",className:"space-y-4",children:s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ye,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Ag,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(At,{checked:!!v.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(v.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(v.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const vV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},NV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},wV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function jV(){const[t,e]=b.useState({siteConfig:{...vV},menuConfig:{...NV},pageConfig:{...wV}}),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{Oe("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{i(!0);try{await wt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await wt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await wt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),ie.success("配置已保存")}catch(f){console.error(f),ie.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{i(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return 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.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(ee,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Ag,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(Ee,{className:"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(Y,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(ne,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(ne,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(ne,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(ne,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(ne,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(cA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(Ee,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(Y,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ne,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),s.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(nA,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Ft,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(Ee,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(At,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Jw,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(Ee,{className:"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(Y,{className:"text-gray-300",children:"首页标题"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"首页副标题"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"目录页标题"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"我的页标题"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function kV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[a,i]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,N,w,v;try{const k=await Oe("/api/config"),C=(N=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:N.urls;Array.isArray(C)&&e(C.join(` -`));const E=(v=(w=k==null?void 0:k.paymentMethods)==null?void 0:w.wechat)==null?void 0:v.groupQrCode;E&&r(E),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,N)=>{navigator.clipboard.writeText(y),i(N),setTimeout(()=>i(""),2e3)},f=async()=>{try{const y=t.split(` -`).map(w=>w.trim()).filter(Boolean),N=[...o.liveQRCodes||[]];N[0]?N[0].urls=y:N.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await wt("/api/db/config",{key:"live_qr_codes",value:N,description:"群活码配置"}),ie.success("群活码配置已保存!"),await u()}catch(y){console.error(y),ie.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await wt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),ie.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(N){console.error(N),ie.error("保存失败: "+(N instanceof Error?N.message:String(N)))}},g=()=>{n?window.open(n,"_blank"):ie.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(qw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Bv,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Ft,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ig,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:y=>r(y.target.value)}),s.jsx(ee,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(hf,{className:"w-4 h-4 text-green-500"}):s.jsx(Fx,{className:"w-4 h-4 text-gray-400"})})]}),s.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[s.jsx(Us,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ee,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(dh,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(ee,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(Us,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Bv,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Y,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ig,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(_l,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` -`).filter(Boolean).length," 个"]})]}),s.jsxs(ee,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dh,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),s.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[s.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),s.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),s.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const ww={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},SV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function CV(){const[t,e]=b.useState(ww),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const E=await Oe("/api/db/config/full?key=match_config"),T=(E==null?void 0:E.data)??(E==null?void 0:E.config);T&&e({...ww,...T})}catch(E){console.error("加载匹配配置失败:",E)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{i(!0);try{const E=await wt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});E&&E.success!==!1?ie.success("配置保存成功!"):ie.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:"未知错误"))}catch(E){console.error("保存配置失败:",E),ie.error("保存失败")}finally{i(!1)}},N=E=>{h(E),m({id:E.id,label:E.label,matchLabel:E.matchLabel,icon:E.icon,matchFromDB:E.matchFromDB,showJoinAfterMatch:E.showJoinAfterMatch,price:E.price,enabled:E.enabled}),c(!0)},w=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},v=()=>{if(!f.id||!f.label){ie.error("请填写类型ID和名称");return}const E=[...t.matchTypes];if(u){const T=E.findIndex(R=>R.id===u.id);T!==-1&&(E[T]={...f})}else{if(E.some(T=>T.id===f.id)){ie.error("类型ID已存在");return}E.push({...f})}e({...t,matchTypes:E}),c(!1)},k=E=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(T=>T.id!==E)})},C=E=>{e({...t,matchTypes:t.matchTypes.map(T=>T.id===E?{...T,enabled:!T.enabled}:T)})};return s.jsxs("div",{className:"p-8 w-full space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",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-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ee,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(ee,{onClick:y,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(li,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:E=>e({...t,freeMatchLimit:parseInt(E.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ne,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:E=>e({...t,matchPrice:parseFloat(E.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ne,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:E=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(E.target.value,10)||10}})}),s.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:t.settings.enableFreeMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enableFreeMatches:E}})}),s.jsx(Y,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:t.settings.enablePaidMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enablePaidMatches:E}})}),s.jsx(Y,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Je,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Zn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(ee,{onClick:w,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(hn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(Ee,{children:s.jsxs(lr,{children:[s.jsx(cr,{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:"类型ID"}),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-right text-gray-400",children:"操作"})]})}),s.jsx(dr,{children:t.matchTypes.map(E=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ye,{children:s.jsx("span",{className:"text-2xl",children:E.icon})}),s.jsx(ye,{className:"font-mono text-gray-300",children:E.id}),s.jsx(ye,{className:"text-white font-medium",children:E.label}),s.jsx(ye,{className:"text-gray-300",children:E.matchLabel}),s.jsx(ye,{children:s.jsxs(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",E.price]})}),s.jsx(ye,{children:E.matchFromDB?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(ye,{children:s.jsx(At,{checked:E.enabled,onCheckedChange:()=>C(E.id)})}),s.jsx(ye,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(E),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Wt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>k(E.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Jn,{className:"w-4 h-4"})})]})})]},E.id))})]})})]}),s.jsx(Ot,{open:o,onOpenChange:c,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[u?s.jsx(Wt,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(hn,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:E=>m({...f,id:E.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:SV.map(E=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===E?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:E}),children:E},E))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"显示名称"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:E=>m({...f,label:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:E=>m({...f,matchLabel:E.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ne,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:E=>m({...f,price:parseFloat(E.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:f.matchFromDB,onCheckedChange:E=>m({...f,matchFromDB:E})}),s.jsx(Y,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:f.showJoinAfterMatch,onCheckedChange:E=>m({...f,showJoinAfterMatch:E})}),s.jsx(Y,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:f.enabled,onCheckedChange:E=>m({...f,enabled:E})}),s.jsx(Y,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(ee,{onClick:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const jw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function EV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function N(){m(!0),y(null);try{const v=new URLSearchParams({page:String(a),pageSize:String(o)});u&&v.set("matchType",u);const k=await Oe(`/api/db/match-records?${v}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(v){console.error("加载匹配记录失败",v),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{N()},[a,u]);const w=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&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:g}),s.jsx("button",{type:"button",onClick:()=>y(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:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:v=>{h(v.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(jw).map(([v,k])=>s.jsx("option",{value:v,children:k},v))]}),s.jsxs("button",{type:"button",onClick:N,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ke,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ee,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(lr,{children:[s.jsx(cr,{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.jsxs(dr,{children:[t.map(v=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ye,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.userAvatar?s.jsx("img",{src:v.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:v.userAvatar?"hidden":"",children:(v.userNickname||v.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.userNickname||v.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.userId.slice(0,16),"..."]})]})]})}),s.jsx(ye,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.matchedUserAvatar?s.jsx("img",{src:v.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:v.matchedUserAvatar?"hidden":"",children:(v.matchedNickname||v.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.matchedNickname||v.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(ye,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:jw[v.matchType]||v.matchType})}),s.jsxs(ye,{className:"text-gray-400 text-sm",children:[v.phone&&s.jsxs("div",{children:["📱 ",v.phone]}),v.wechatId&&s.jsxs("div",{children:["💬 ",v.wechatId]}),!v.phone&&!v.wechatId&&"-"]}),s.jsx(ye,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleString():"-"})]},v.id)),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(is,{page:a,totalPages:w,total:n,pageSize:o,onPageChange:i,onPageSizeChange:v=>{c(v),i(1)}})]})})})]})}function TV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0);async function a(){r(!0);try{const i=await Oe("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),ie.error("加载 VIP 成员失败")}finally{r(!1)}}return b.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("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(xl,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(lr,{children:[s.jsx(cr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(je,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(dr,{children:[t.map((i,o)=>{var c;return s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(ye,{className:"text-gray-300",children:o+1}),s.jsx(ye,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:i.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:((c=i.name)==null?void 0:c[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:i.name})})]})}),s.jsx(ye,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(ye,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function $4(t){const[e,n]=b.useState([]),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,N]=b.useState(!1),w=b.useRef(null),v=async P=>{var F;const L=(F=P.target.files)==null?void 0:F[0];if(L){N(!0);try{const X=new FormData;X.append("file",L),X.append("folder","mentors");const te=ff(),ue={};te&&(ue.Authorization=`Bearer ${te}`);const I=await(await fetch(mo("/api/upload"),{method:"POST",body:X,credentials:"include",headers:ue})).json();I!=null&&I.success&&(I!=null&&I.url)?f(O=>({...O,avatar:I.url})):ie.error("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(X){console.error(X),ie.error("上传失败")}finally{N(!1),w.current&&(w.current.value="")}}};async function k(){a(!0);try{const P=await Oe("/api/db/mentors");P!=null&&P.success&&P.data&&n(P.data)}catch(P){console.error("Load mentors error:",P)}finally{a(!1)}}b.useEffect(()=>{k()},[]);const C=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(P=>P.sort))+1:0,enabled:!0})},E=()=>{u(null),C(),o(!0)},T=P=>{u(P),f({name:P.name,avatar:P.avatar||"",intro:P.intro||"",tags:P.tags||"",priceSingle:P.priceSingle!=null?String(P.priceSingle):"",priceHalfYear:P.priceHalfYear!=null?String(P.priceHalfYear):"",priceYear:P.priceYear!=null?String(P.priceYear):"",quote:P.quote||"",whyFind:P.whyFind||"",offering:P.offering||"",judgmentStyle:P.judgmentStyle||"",sort:P.sort,enabled:P.enabled??!0}),o(!0)},R=async()=>{if(!h.name.trim()){ie.error("导师姓名不能为空");return}g(!0);try{const P=F=>F===""?void 0:parseFloat(F),L={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:P(h.priceSingle),priceHalfYear:P(h.priceHalfYear),priceYear:P(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const F=await _t("/api/db/mentors",{id:c.id,...L});F!=null&&F.success?(o(!1),k()):ie.error("更新失败: "+(F==null?void 0:F.error))}else{const F=await wt("/api/db/mentors",L);F!=null&&F.success?(o(!1),k()):ie.error("新增失败: "+(F==null?void 0:F.error))}}catch(P){console.error("Save error:",P),ie.error("保存失败")}finally{g(!1)}},D=async P=>{if(confirm("确定删除该导师?"))try{const L=await Bs(`/api/db/mentors?id=${P}`);L!=null&&L.success?k():ie.error("删除失败: "+(L==null?void 0:L.error))}catch(L){console.error("Delete error:",L),ie.error("删除失败")}},_=P=>P!=null?`¥${P}`:"-";return 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(Zn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(ee,{onClick:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(hn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{className:"p-0",children:r?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(lr,{children:[s.jsx(cr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),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-right text-gray-400",children:"操作"})]})}),s.jsxs(dr,{children:[e.map(P=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(ye,{className:"text-gray-300",children:P.id}),s.jsx(ye,{className:"text-white",children:P.name}),s.jsx(ye,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),s.jsx(ye,{className:"text-gray-400",children:_(P.priceSingle)}),s.jsx(ye,{className:"text-gray-400",children:_(P.priceHalfYear)}),s.jsx(ye,{className:"text-gray-400",children:_(P.priceYear)}),s.jsx(ye,{className:"text-gray-400",children:P.sort}),s.jsxs(ye,{className:"text-right",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>T(P),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(Wt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>D(P.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Jn,{className:"w-4 h-4"})})]})]},P.id)),e.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Ot,{open:i,onOpenChange:o,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Dt,{children:s.jsx(Lt,{className:"text-white",children:c?"编辑导师":"新增导师"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"姓名 *"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:P=>f(L=>({...L,name:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"排序"}),s.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:P=>f(L=>({...L,sort:parseInt(P.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ne,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:P=>f(L=>({...L,avatar:P.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:w,type:"file",accept:"image/*",className:"hidden",onChange:v}),s.jsxs(ee,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var P;return(P=w.current)==null?void 0:P.click()},children:[s.jsx(dh,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:h.avatar.startsWith("http")?h.avatar:mo(h.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"简介"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:P=>f(L=>({...L,intro:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:P=>f(L=>({...L,tags:P.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(Y,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:P=>f(L=>({...L,priceSingle:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:P=>f(L=>({...L,priceHalfYear:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:P=>f(L=>({...L,priceYear:P.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"引言"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:P=>f(L=>({...L,quote:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:P=>f(L=>({...L,whyFind:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:P=>f(L=>({...L,offering:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:P=>f(L=>({...L,judgmentStyle:P.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:P=>f(L=>({...L,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(Y,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(on,{children:[s.jsxs(ee,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ee,{onClick:R,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function MV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const h=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",f=await Oe(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[a]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return 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(lh,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:h=>i(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>s.jsx("option",{value:h,children:f},h))]}),s.jsxs(ee,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(lr,{children:[s.jsx(cr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"用户ID"}),s.jsx(je,{className:"text-gray-400",children:"导师ID"}),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(dr,{children:[t.map(h=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(ye,{className:"text-gray-300",children:h.id}),s.jsx(ye,{className:"text-gray-400",children:h.userId}),s.jsx(ye,{className:"text-gray-400",children:h.mentorId}),s.jsx(ye,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(ye,{className:"text-white",children:["¥",h.amount]}),s.jsx(ye,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(ye,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Lc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},kw={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:Lc},AV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function IV(){const t=Ci(),[e,n]=b.useState(kw),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,N]=b.useState(null),[w,v]=b.useState(!1),k=async()=>{v(!0);try{const L=await Oe("/api/db/match-pool-counts");L!=null&&L.success&&L.data&&N(L.data)}catch(L){console.error("加载池子人数失败:",L)}finally{v(!1)}},C=async()=>{a(!0);try{const L=await Oe("/api/db/config/full?key=match_config"),F=(L==null?void 0:L.data)??(L==null?void 0:L.config);if(F){let X=F.poolSettings??Lc;X.poolSource&&!Array.isArray(X.poolSource)&&(X={...X,poolSource:[X.poolSource]}),n({...kw,...F,poolSettings:X})}}catch(L){console.error("加载匹配配置失败:",L)}finally{a(!1)}};b.useEffect(()=>{C(),k()},[]);const E=async()=>{o(!0);try{const L=await wt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});ie.error((L==null?void 0:L.success)!==!1?"配置保存成功!":"保存失败: "+((L==null?void 0:L.error)||"未知错误"))}catch(L){console.error(L),ie.error("保存失败")}finally{o(!1)}},T=L=>{f(L),g({...L}),u(!0)},R=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},D=()=>{if(!m.id||!m.label){ie.error("请填写类型ID和名称");return}const L=[...e.matchTypes];if(h){const F=L.findIndex(X=>X.id===h.id);F!==-1&&(L[F]={...m})}else{if(L.some(F=>F.id===m.id)){ie.error("类型ID已存在");return}L.push({...m})}n({...e,matchTypes:L}),u(!1)},_=L=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(F=>F.id!==L)})},P=L=>{n({...e,matchTypes:e.matchTypes.map(F=>F.id===L?{...F,enabled:!F.enabled}:F)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(ee,{variant:"outline",onClick:C,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(ee,{onClick:E,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Yw,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Ft,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(Y,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(L=>{const F=e.poolSettings??Lc,te=(Array.isArray(F.poolSource)?F.poolSource:[F.poolSource]).includes(L.value),ue=y==null?void 0:y[L.countKey],ae=()=>{const I=Array.isArray(F.poolSource)?[...F.poolSource]:[F.poolSource],O=te?I.filter(G=>G!==L.value):[...I,L.value];O.length===0&&O.push(L.value),n({...e,poolSettings:{...F,poolSource:O}})};return s.jsxs("button",{type:"button",onClick:ae,className:`p-4 rounded-lg border text-left transition-all ${te?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${te?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:te&&"✓"}),s.jsx("span",{className:"text-xl",children:L.icon}),s.jsx("span",{className:`text-sm font-medium ${te?"text-[#38bdac]":"text-gray-300"}`,children:L.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[w?"...":ue??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:L.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:I=>{I.stopPropagation(),t(`/users?pool=${L.value}`)},onKeyDown:I=>{I.key==="Enter"&&(I.stopPropagation(),t(`/users?pool=${L.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},L.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(Y,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(L=>{const X=(e.poolSettings??Lc)[L.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(At,{checked:X,onCheckedChange:te=>n({...e,poolSettings:{...e.poolSettings??Lc,[L.key]:te}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:L.icon}),s.jsx(Y,{className:"text-gray-300 text-sm",children:L.label})]})]},L.key)})})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Je,{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(li,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ee,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:L=>n({...e,freeMatchLimit:parseInt(L.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ne,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:L=>n({...e,matchPrice:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ne,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:L=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(L.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:e.settings.enableFreeMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enableFreeMatches:L}})}),s.jsx(Y,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:e.settings.enablePaidMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enablePaidMatches:L}})}),s.jsx(Y,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(Je,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[s.jsx(Zn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Ft,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(ee,{onClick:R,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(hn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(Ee,{children:s.jsxs(lr,{children:[s.jsx(cr,{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:"类型ID"}),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-right text-gray-400",children:"操作"})]})}),s.jsx(dr,{children:e.matchTypes.map(L=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ye,{children:s.jsx("span",{className:"text-2xl",children:L.icon})}),s.jsx(ye,{className:"font-mono text-gray-300",children:L.id}),s.jsx(ye,{className:"text-white font-medium",children:L.label}),s.jsx(ye,{className:"text-gray-300",children:L.matchLabel}),s.jsx(ye,{children:s.jsxs(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",L.price]})}),s.jsx(ye,{children:L.matchFromDB?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(ye,{children:s.jsx(At,{checked:L.enabled,onCheckedChange:()=>P(L.id)})}),s.jsx(ye,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>T(L),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(Wt,{className:"w-4 h-4"})}),s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>_(L.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Jn,{className:"w-4 h-4"})})]})})]},L.id))})]})})]}),s.jsx(Ot,{open:c,onOpenChange:u,children:s.jsxs(Mt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Dt,{children:s.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[h?s.jsx(Wt,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(hn,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:L=>g({...m,id:L.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:AV.map(L=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===L?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:L}),children:L},L))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"显示名称"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:L=>g({...m,label:L.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:L=>g({...m,matchLabel:L.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Y,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ne,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:L=>g({...m,price:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:m.matchFromDB,onCheckedChange:L=>g({...m,matchFromDB:L})}),s.jsx(Y,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:m.showJoinAfterMatch,onCheckedChange:L=>g({...m,showJoinAfterMatch:L})}),s.jsx(Y,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(At,{checked:m.enabled,onCheckedChange:L=>g({...m,enabled:L})}),s.jsx(Y,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(on,{children:[s.jsx(ee,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(ee,{onClick:D,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Sw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function RV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[N,w]=b.useState(null);async function v(){m(!0),y(null);try{const E=new URLSearchParams({page:String(a),pageSize:String(o)});u&&E.set("matchType",u);const T=await Oe(`/api/db/match-records?${E}`);T!=null&&T.success?(e(T.records||[]),r(T.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[a,u]);const k=Math.ceil(n/o)||1,C=({userId:E,nickname:T,avatar:R})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>w(E),children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[R?s.jsx("img",{src:R,alt:"",className:"w-full h-full object-cover",onError:D=>{D.currentTarget.style.display="none"}}):null,s.jsx("span",{className:R?"hidden":"",children:(T||E||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:T||E}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[E==null?void 0:E.slice(0,16),(E==null?void 0:E.length)>16?"...":""]})]})]});return s.jsxs("div",{children:[g&&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:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:E=>{h(E.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Sw).map(([E,T])=>s.jsx("option",{value:E,children:T},E))]}),s.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ke,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ee,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(lr,{children:[s.jsx(cr,{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.jsxs(dr,{children:[t.map(E=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ye,{children:s.jsx(C,{userId:E.userId,nickname:E.userNickname,avatar:E.userAvatar})}),s.jsx(ye,{children:E.matchedUserId?s.jsx(C,{userId:E.matchedUserId,nickname:E.matchedNickname,avatar:E.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(ye,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Sw[E.matchType]||E.matchType})}),s.jsxs(ye,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"-"})]}),s.jsx(ye,{className:"text-gray-400",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"})]},E.id)),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(is,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:E=>{c(E),i(1)}})]})})}),s.jsx(t0,{open:!!N,onClose:()=>w(null),userId:N,onUserUpdated:v})]})}function PV(){const[t,e]=b.useState("records");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),s.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&s.jsx(RV,{}),t==="pool"&&s.jsx(IV,{})]})}const Cw={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function OV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function N(){h(!0);try{const C=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),E=await Oe(`/api/db/match-records?${C}`);E!=null&&E.success&&(e(E.records||[]),r(E.total??0))}catch(C){console.error(C)}finally{h(!1)}}b.useEffect(()=>{N()},[a,f]);const w=async C=>{if(!C.phone&&!C.wechatId){ie.info("该记录无联系方式,无法推送到存客宝");return}y(C.id);try{const E=await wt("/api/ckb/join",{type:C.matchType||"investor",phone:C.phone||"",wechat:C.wechatId||"",userId:C.userId,name:C.userNickname||""});ie.error((E==null?void 0:E.message)||(E!=null&&E.success?"推送成功":"推送失败"))}catch(E){ie.error("推送失败: "+(E instanceof Error?E.message:"网络错误"))}finally{y(null)}},v=Math.ceil(n/o)||1,k=C=>!!(C.phone||C.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:C=>{m(C.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Cw).map(([C,E])=>s.jsx("option",{value:C,children:E},C))}),s.jsxs(ee,{onClick:N,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ee,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(lr,{children:[s.jsx(cr,{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 text-right",children:"操作"})]})}),s.jsxs(dr,{children:[t.map(C=>{var E,T;return s.jsxs(it,{className:`border-gray-700/50 ${k(C)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(ye,{className:"text-white",children:C.userNickname||((E=C.userId)==null?void 0:E.slice(0,12))}),s.jsx(ye,{className:"text-white",children:C.matchedNickname||((T=C.matchedUserId)==null?void 0:T.slice(0,12))}),s.jsx(ye,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Cw[C.matchType]||C.matchType})}),s.jsxs(ye,{className:"text-sm",children:[C.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(ye,{className:"text-gray-400 text-sm",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"}),s.jsx(ye,{className:"text-right",children:k(C)?s.jsxs(ee,{size:"sm",onClick:()=>w(C),disabled:g===C.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(TA,{className:"w-3 h-3 mr-1"}),g===C.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},C.id)}),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(is,{page:a,totalPages:v,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})})]})}const Ew={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},DV={single:"单次",half_year:"半年",year:"年度"};function LV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const c=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",u=await Oe(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[a]),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:c=>i(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(Ew).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(ee,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ee,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(lr,{children:[s.jsx(cr,{children:s.jsxs(it,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"ID"}),s.jsx(je,{className:"text-gray-400",children:"用户ID"}),s.jsx(je,{className:"text-gray-400",children:"导师ID"}),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(dr,{children:[t.map(c=>s.jsxs(it,{className:"border-gray-700/50",children:[s.jsx(ye,{className:"text-gray-300",children:c.id}),s.jsx(ye,{className:"text-gray-400",children:c.userId}),s.jsx(ye,{className:"text-gray-400",children:c.mentorId}),s.jsx(ye,{className:"text-gray-400",children:DV[c.consultationType]||c.consultationType}),s.jsxs(ye,{className:"text-white",children:["¥",c.amount]}),s.jsx(ye,{className:"text-gray-400",children:Ew[c.status]||c.status}),s.jsx(ye,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function _V(){const[t,e]=b.useState("booking");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),s.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&s.jsx(LV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx($4,{embedded:!0})})]})}function zV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),y=await Oe(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ke,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ee,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ke,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(lr,{children:[s.jsx(cr,{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(dr,{children:[t.map(g=>s.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ye,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(ye,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(ye,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(ye,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(it,{children:s.jsx(ye,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(is,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const Tw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},Mw={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function FV({onSwitchTab:t,onOpenCKB:e}={}){const n=Ci(),[r,a]=b.useState(null),[i,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var m,g;u(!0);try{const[y,N]=await Promise.allSettled([Oe("/api/db/match-records?stats=true"),Oe("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let w=y.value.data;if(w.totalMatches>0&&(!w.uniqueUsers||w.uniqueUsers===0))try{const v=await Oe("/api/db/match-records?page=1&pageSize=200");if(v!=null&&v.success&&v.records){const k=new Set(v.records.map(C=>C.userId).filter(Boolean));w={...w,uniqueUsers:k.size}}}catch{}a(w)}N.status==="fulfilled"&&((g=N.value)!=null&&g.success)&&N.value.data&&o(N.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(Zn,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[s.jsx(Ce,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[s.jsx(Us,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),s.jsx(Ce,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-yellow-500/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),s.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(li,{className:"w-3 h-3"})," 今日实时"]})]})}),s.jsx(Ce,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),s.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(Us,{className:"w-3 h-3"})," 查看用户管理"]})]})}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),s.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:f(r==null?void 0:r.paidMatchCount)})]})})]})]}),(r==null?void 0:r.byType)&&r.byType.length>0&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:r.byType.map(m=>{const g=r.totalMatches>0?m.count/r.totalMatches*100:0;return s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("span",{className:"text-2xl",children:Mw[m.matchType]||"📊"}),s.jsx("span",{className:"text-gray-300 font-medium",children:Tw[m.matchType]||m.matchType})]}),s.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),s.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(Ss,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[s.jsx(Ce,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(i==null?void 0:i.ckbTotal)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Ce,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(i==null?void 0:i.withContact)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Ce,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:s.jsxs(Ee,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),s.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(i==null?void 0:i.byType)&&i.byType.length>0&&s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:i.byType.map(m=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[s.jsx("span",{className:"text-xl",children:Mw[m.matchType]||"📋"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-xs",children:Tw[m.matchType]||m.matchType}),s.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const $V=["partner","investor","mentor","team"],Ng=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],Aw=`# 场景获客接口摘要 -- 地址:POST /v1/api/scenarios -- 必填:apiKey、sign、timestamp -- 主标识:phone 或 wechatId 至少一项 -- 可选:name、source、remark、tags、siteTags、portrait -- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function BV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,a]=b.useState("13800000000"),[i,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(Aw),[m,g]=b.useState(!1),[y,N]=b.useState(!1),[w,v]=b.useState([]),[k,C]=b.useState([]),[E,T]=b.useState({}),[R,D]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),_=b.useMemo(()=>{const I={};return Ng.forEach(O=>{I[O.key]=E[O.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),I},[E]),P=I=>{const O=r.trim(),G=i.trim();return I<=3?{type:$V[I],phone:O||void 0,wechat:G||void 0,userId:"admin_test",name:"后台测试"}:I===4?{matchType:"partner",phone:O||void 0,wechat:G||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:I===5?{phone:O||void 0,wechatId:G||void 0,userId:"admin_test",name:"后台测试"}:{}};async function L(){N(!0);try{const[I,O,G]=await Promise.all([Oe("/api/db/config/full?key=ckb_config"),Oe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Oe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),z=I==null?void 0:I.data;z!=null&&z.routes&&T(z.routes),z!=null&&z.docNotes&&u(z.docNotes),z!=null&&z.docContent&&f(z.docContent),O!=null&&O.success&&v(O.records||[]),G!=null&&G.success&&C(G.records||[])}finally{N(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{L()},[]);async function F(){g(!0);try{const I=await wt("/api/db/config",{key:"ckb_config",value:{routes:_,docNotes:c,docContent:h},description:"存客宝接口配置"});ie.error((I==null?void 0:I.success)!==!1?"存客宝配置已保存":`保存失败: ${(I==null?void 0:I.error)||"未知错误"}`)}catch(I){ie.error(`保存失败: ${I instanceof Error?I.message:"网络错误"}`)}finally{g(!1)}}const X=(I,O)=>{T(G=>({...G,[I]:{..._[I],...O}}))},te=async I=>{const O=R[I];if(O.method==="POST"&&!r.trim()&&!i.trim()){ie.error("请填写测试手机号");return}const G=[...R];G[I]={...O,status:"testing",message:void 0,responseTime:void 0},D(G);const z=performance.now();try{const re=O.method==="GET"?await Oe(O.endpoint):await wt(O.endpoint,P(I)),K=Math.round(performance.now()-z),$=(re==null?void 0:re.message)||"",H=(re==null?void 0:re.success)===!0||$.includes("已存在")||$.includes("已加入")||$.includes("已提交"),oe=[...R];oe[I]={...O,status:H?"success":"error",message:$||(H?"正常":"异常"),responseTime:K},D(oe),await L()}catch(re){const K=Math.round(performance.now()-z),$=[...R];$[I]={...O,status:"error",message:re instanceof Error?re.message:"失败",responseTime:K},D($)}},ue=async()=>{if(!r.trim()&&!i.trim()){ie.error("请填写测试手机号");return}for(let I=0;Is.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:I.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:O})}):I.map(G=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:G.userNickname||G.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:G.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:G.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:G.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:G.createdAt?new Date(G.createdAt).toLocaleString():"—"})]},G.id))})]})});return s.jsx(Ce,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(Ee,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(Us,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ee,{onClick:()=>L(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ke,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(ee,{onClick:F,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([I,O])=>s.jsx("button",{type:"button",onClick:()=>n(I),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===I?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:O},I))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:w.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:Ng.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&ae(w,"暂无已提交线索"),e==="contact"&&ae(k,"暂无有联系方式线索"),e==="config"&&s.jsx("div",{className:"space-y-4",children:Ng.map(I=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white font-medium",children:I.label}),s.jsx(Ue,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:I.key})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].apiUrl,onChange:O=>X(I.key,{apiUrl:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].apiKey,onChange:O=>X(I.key,{apiKey:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].source,onChange:O=>X(I.key,{source:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].tags,onChange:O=>X(I.key,{tags:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].siteTags,onChange:O=>X(I.key,{siteTags:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].notes,onChange:O=>X(I.key,{notes:O.target.value})})]})]})]},I.key))}),e==="test"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx(yi,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:I=>a(I.target.value)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Y,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:I=>o(I.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(ee,{onClick:ue,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(li,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:R.map((I,O)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[I.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),I.status==="testing"&&s.jsx(Ke,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),I.status==="success"&&s.jsx(Eg,{className:"w-3 h-3 text-green-400 shrink-0"}),I.status==="error"&&s.jsx(Gw,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:I.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[I.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[I.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>te(O),disabled:I.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${I.endpoint}-${O}`))})]}),e==="doc"&&s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),s.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[s.jsx(Us,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||Aw})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),s.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:I=>u(I.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const VV=[{id:"stats",label:"数据统计",icon:UT},{id:"partner",label:"找伙伴",icon:Zn},{id:"resource",label:"资源对接",icon:EM},{id:"mentor",label:"导师预约",icon:kM},{id:"team",label:"团队招募",icon:Og}];function HV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[a,i]=b.useState("overview");return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Zn,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),s.jsxs(ee,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[s.jsx(Ss,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&s.jsx(BV,{initialTab:a}),s.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:VV.map(o=>{const c=t===o.id;return s.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[s.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&s.jsx(FV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(PV,{}),t==="resource"&&s.jsx(OV,{}),t==="mentor"&&s.jsx(_V,{}),t==="team"&&s.jsx(zV,{})]})}function WV(){return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[s.jsx(Ss,{className:"w-8 h-8 text-[#38bdac]"}),s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),s.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{children:s.jsx(Ye,{className:"text-white",children:"1. 接口总览"})}),s.jsxs(Ee,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),s.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[s.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),s.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),s.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),s.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),s.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),s.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),s.jsx("li",{children:"/api/config — 配置系统"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),s.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),s.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{children:s.jsx(Ye,{className:"text-white",children:"2. 书籍内容"})}),s.jsxs(Ee,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),s.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),s.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{children:s.jsx(Ye,{className:"text-white",children:"3. 支付"})}),s.jsxs(Ee,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),s.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),s.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{children:s.jsx(Ye,{className:"text-white",children:"4. 分销与用户"})}),s.jsxs(Ee,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),s.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),s.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),s.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(Je,{children:s.jsx(Ye,{className:"text-white",children:"5. 管理后台"})}),s.jsxs(Ee,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),s.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),s.jsx("p",{children:"GET /api/admin/orders — 订单列表"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function UV(){const t=Si();return s.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:s.jsx(Kw,{className:"w-10 h-10"})}),s.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),s.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),s.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),s.jsx(ee,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(Cg,{to:"/",children:[s.jsx(LM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function KV(){return s.jsxs(NT,{children:[s.jsx(Ht,{path:"/login",element:s.jsx(nI,{})}),s.jsxs(Ht,{path:"/",element:s.jsx(a5,{}),children:[s.jsx(Ht,{index:!0,element:s.jsx(Sm,{to:"/dashboard",replace:!0})}),s.jsx(Ht,{path:"dashboard",element:s.jsx(hP,{})}),s.jsx(Ht,{path:"orders",element:s.jsx(fP,{})}),s.jsx(Ht,{path:"users",element:s.jsx(pP,{})}),s.jsx(Ht,{path:"distribution",element:s.jsx(LP,{})}),s.jsx(Ht,{path:"withdrawals",element:s.jsx(_P,{})}),s.jsx(Ht,{path:"content",element:s.jsx(dV,{})}),s.jsx(Ht,{path:"referral-settings",element:s.jsx(_k,{})}),s.jsx(Ht,{path:"author-settings",element:s.jsx(Sm,{to:"/settings?tab=author",replace:!0})}),s.jsx(Ht,{path:"vip-roles",element:s.jsx(TV,{})}),s.jsx(Ht,{path:"mentors",element:s.jsx($4,{})}),s.jsx(Ht,{path:"mentor-consultations",element:s.jsx(MV,{})}),s.jsx(Ht,{path:"admin-users",element:s.jsx(Sm,{to:"/settings?tab=admin",replace:!0})}),s.jsx(Ht,{path:"settings",element:s.jsx(yV,{})}),s.jsx(Ht,{path:"payment",element:s.jsx(bV,{})}),s.jsx(Ht,{path:"site",element:s.jsx(jV,{})}),s.jsx(Ht,{path:"qrcodes",element:s.jsx(kV,{})}),s.jsx(Ht,{path:"find-partner",element:s.jsx(HV,{})}),s.jsx(Ht,{path:"match",element:s.jsx(CV,{})}),s.jsx(Ht,{path:"match-records",element:s.jsx(EV,{})}),s.jsx(Ht,{path:"api-doc",element:s.jsx(WV,{})}),s.jsx(Ht,{path:"api-docs",element:s.jsx(F4,{})})]}),s.jsx(Ht,{path:"*",element:s.jsx(UV,{})})]})}CE.createRoot(document.getElementById("root")).render(s.jsx(b.StrictMode,{children:s.jsx(MT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(KV,{})})})); diff --git a/soul-admin/dist/assets/index-dmhT0dvT.css b/soul-admin/dist/assets/index-dmhT0dvT.css new file mode 100644 index 00000000..f06943e0 --- /dev/null +++ b/soul-admin/dist/assets/index-dmhT0dvT.css @@ -0,0 +1 @@ +.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:450px;max-height:720px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}.mention-trigger-btn{color:#38bdac!important}.mention-trigger-btn:hover{background:#38bdac33!important}.upload-progress-bar{display:flex;align-items:center;gap:8px;padding:4px 10px;background:#0f1d32;border-bottom:1px solid #374151}.upload-progress-track{flex:1;height:4px;background:#1f2937;border-radius:2px;overflow:hidden}.upload-progress-fill{height:100%;background:linear-gradient(90deg,#38bdac,#4ae3ce);border-radius:2px;transition:width .3s ease}.upload-progress-text{font-size:11px;color:#38bdac;white-space:nowrap}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-rose-400:oklch(71.2% .194 13.428);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-\[75vh\]{height:75vh}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[200px\]{max-height:200px}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[450px\]{max-height:450px}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-\[2rem\]{min-height:2rem}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[72px\]{min-height:72px}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-\[200px\]{width:200px}.w-\[280px\]{width:280px}.w-fit{width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[96px\]{max-width:96px}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.rotate-90{rotate:90deg}.rotate-270{rotate:270deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.grid-cols-\[60px_1fr_100px_100px_80px_120px\]{grid-template-columns:60px 1fr 100px 100px 80px 120px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-gray-700\/60{border-color:#36415399}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/60{border-color:color-mix(in oklab,var(--color-gray-700)60%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-inherit{border-color:inherit}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-red-600\/50{border-color:#e4001480}@supports (color:color-mix(in lab,red,red)){.border-red-600\/50{border-color:color-mix(in oklab,var(--color-red-600)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0a1628\]\/60{background-color:#0a162899}.bg-\[\#0b1828\]{background-color:#0b1828}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#050c18\]{background-color:#050c18}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/10{background-color:#6a72821a}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/10{background-color:color-mix(in oklab,var(--color-gray-500)10%,transparent)}}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/20{background-color:#4a556533}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/20{background-color:color-mix(in oklab,var(--color-gray-600)20%,transparent)}}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-400\/10{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.bg-green-400\/10{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-900\/80{background-color:#82181acc}@supports (color:color-mix(in lab,red,red)){.bg-red-900\/80{background-color:color-mix(in oklab,var(--color-red-900)80%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/80{color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400)80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/50{color:#90c5ff80}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/50{color:color-mix(in oklab,var(--color-blue-300)50%,transparent)}}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-400{color:var(--color-emerald-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/90{color:#05df72e6}@supports (color:color-mix(in lab,red,red)){.text-green-400\/90{color:color-mix(in oklab,var(--color-green-400)90%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/50{color:#ffb96d80}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/50{color:color-mix(in oklab,var(--color-orange-300)50%,transparent)}}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-100{color:var(--color-red-100)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-rose-400{color:var(--color-rose-400)}.text-sky-300{color:var(--color-sky-300)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-\[\#38bdac\]{accent-color:#38bdac}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-\[\#38bdac\]\/70:hover{border-color:#38bdacb3}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#0a1628\]\/80:hover{background-color:#0a1628cc}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-400\/10:hover{background-color:#ff8b1a1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-400\/10:hover{background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-red-800\/50:hover{background-color:#9f071280}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-800\/50:hover{background-color:color-mix(in oklab,var(--color-red-800)50%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#5fe0cd\]:hover{color:#5fe0cd}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-200:hover{color:var(--color-amber-200)}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-green-400:hover{color:var(--color-green-400)}.hover\:text-orange-300:hover{color:var(--color-orange-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-sky-200:hover{color:var(--color-sky-200)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-red-500:focus-visible{--tw-ring-color:var(--color-red-500)}.focus-visible\:ring-offset-0:focus-visible{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:calc(var(--spacing)*2)}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 632913eb..9df490c6 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,8 +4,8 @@ 管理后台 - Soul创业派对 - - + +
    diff --git a/soul-admin/src/pages/distribution/DistributionPage.tsx b/soul-admin/src/pages/distribution/DistributionPage.tsx index 2f57db55..81e23db0 100644 --- a/soul-admin/src/pages/distribution/DistributionPage.tsx +++ b/soul-admin/src/pages/distribution/DistributionPage.tsx @@ -21,7 +21,7 @@ import { ReferralSettingsPage } from '@/pages/referral-settings/ReferralSettings import { Pagination } from '@/components/ui/Pagination' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' -import { Card, CardContent } from '@/components/ui/card' +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { Dialog, diff --git a/soul-api/internal/handler/balance.go b/soul-api/internal/handler/balance.go index 3b63dad3..5f442182 100644 --- a/soul-api/internal/handler/balance.go +++ b/soul-api/internal/handler/balance.go @@ -61,8 +61,8 @@ func BalanceTransactionsGet(c *gin.Context) { out := make([]gin.H, 0, len(list)) for _, t := range list { orderID := "" - if t.OrderID != nil { - orderID = *t.OrderID + if t.RelatedOrder != nil { + orderID = *t.RelatedOrder } out = append(out, gin.H{ "id": t.ID, "type": t.Type, "amount": t.Amount, @@ -127,16 +127,14 @@ func BalanceRechargeConfirmPost(c *gin.Context) { } // 幂等:检查是否已处理 var cnt int64 - tx.Model(&model.BalanceTransaction{}).Where("order_id = ? AND type = ?", req.OrderSn, "recharge").Count(&cnt) + tx.Model(&model.BalanceTransaction{}).Where("related_order = ? AND type = ?", req.OrderSn, "recharge").Count(&cnt) if cnt > 0 { - return nil // 已处理,直接成功 + return nil } - // 增加余额 tx.Exec("INSERT INTO user_balances (user_id, balance, updated_at) VALUES (?, 0, NOW()) ON DUPLICATE KEY UPDATE balance = balance + ?, updated_at = NOW()", order.UserID, order.Amount) - txID := fmt.Sprintf("bt_%d", time.Now().UnixNano()%100000000000) tx.Create(&model.BalanceTransaction{ - ID: txID, UserID: order.UserID, Type: "recharge", Amount: order.Amount, - OrderID: &req.OrderSn, CreatedAt: time.Now(), + UserID: order.UserID, Type: "recharge", Amount: order.Amount, + RelatedOrder: &req.OrderSn, CreatedAt: time.Now(), }) return nil }) @@ -246,10 +244,9 @@ func BalanceConsumePost(c *gin.Context) { if err := tx.Create(&order).Error; err != nil { return err } - txID := fmt.Sprintf("bt_%d", time.Now().UnixNano()%100000000000) tx.Create(&model.BalanceTransaction{ - ID: txID, UserID: req.UserID, Type: "consume", Amount: -amount, - OrderID: &orderSn, CreatedAt: now, + UserID: req.UserID, Type: "consume", Amount: -amount, + RelatedOrder: &orderSn, CreatedAt: now, }) // 激活权益 if req.ProductType == "fullbook" { @@ -298,9 +295,8 @@ func BalanceRefundPost(c *gin.Context) { return fmt.Errorf("余额不足") } tx.Model(&model.UserBalance{}).Where("user_id = ?", req.UserID).Update("balance", gorm.Expr("balance - ?", req.Amount)) - txID := fmt.Sprintf("bt_%d", time.Now().UnixNano()%100000000000) tx.Create(&model.BalanceTransaction{ - ID: txID, UserID: req.UserID, Type: "refund", Amount: -req.Amount, + UserID: req.UserID, Type: "refund", Amount: -req.Amount, CreatedAt: time.Now(), }) return nil @@ -330,8 +326,8 @@ func AdminUserBalanceGet(c *gin.Context) { transactions := make([]gin.H, 0, len(list)) for _, t := range list { orderID := "" - if t.OrderID != nil { - orderID = *t.OrderID + if t.RelatedOrder != nil { + orderID = *t.RelatedOrder } transactions = append(transactions, gin.H{ "id": t.ID, "type": t.Type, "amount": t.Amount, @@ -375,9 +371,8 @@ func AdminUserBalanceAdjust(c *gin.Context) { return fmt.Errorf("调整后余额不能为负,当前余额 %.2f", ub.Balance) } tx.Exec("INSERT INTO user_balances (user_id, balance, updated_at) VALUES (?, 0, NOW()) ON DUPLICATE KEY UPDATE balance = ?, updated_at = NOW()", userID, newBalance) - txID := fmt.Sprintf("bt_adj_%d", time.Now().UnixNano()%100000000000) return tx.Create(&model.BalanceTransaction{ - ID: txID, UserID: userID, Type: "admin_adjust", Amount: req.Amount, + UserID: userID, Type: "admin_adjust", Amount: req.Amount, CreatedAt: time.Now(), }).Error }) @@ -401,10 +396,9 @@ func ConfirmBalanceRechargeByOrder(db *gorm.DB, order *model.Order) error { return nil // 已处理,幂等 } tx.Exec("INSERT INTO user_balances (user_id, balance, updated_at) VALUES (?, 0, NOW()) ON DUPLICATE KEY UPDATE balance = balance + ?, updated_at = NOW()", order.UserID, order.Amount) - txID := fmt.Sprintf("bt_%d", time.Now().UnixNano()%100000000000) return tx.Create(&model.BalanceTransaction{ - ID: txID, UserID: order.UserID, Type: "recharge", Amount: order.Amount, - OrderID: &orderSn, CreatedAt: time.Now(), + UserID: order.UserID, Type: "recharge", Amount: order.Amount, + RelatedOrder: &orderSn, CreatedAt: time.Now(), }).Error }) } diff --git a/soul-api/internal/model/user_balance.go b/soul-api/internal/model/user_balance.go deleted file mode 100644 index 5e6caaf0..00000000 --- a/soul-api/internal/model/user_balance.go +++ /dev/null @@ -1,24 +0,0 @@ -package model - -import "time" - -// UserBalance 对应表 user_balances -type UserBalance struct { - UserID string `gorm:"column:user_id;primaryKey;size:50"` - Balance float64 `gorm:"column:balance;type:decimal(10,2);default:0"` - UpdatedAt time.Time `gorm:"column:updated_at"` -} - -func (UserBalance) TableName() string { return "user_balances" } - -// BalanceTransaction 对应表 balance_transactions -type BalanceTransaction struct { - ID string `gorm:"column:id;primaryKey;size:50"` - UserID string `gorm:"column:user_id;size:50"` - Type string `gorm:"column:type;size:20"` // recharge, consume, refund, gift - Amount float64 `gorm:"column:amount;type:decimal(10,2)"` - OrderID *string `gorm:"column:order_id;size:50"` - CreatedAt time.Time `gorm:"column:created_at"` -} - -func (BalanceTransaction) TableName() string { return "balance_transactions" } diff --git a/soul-api/internal/router/router.go b/soul-api/internal/router/router.go index 97a1285d..7ba51df1 100644 --- a/soul-api/internal/router/router.go +++ b/soul-api/internal/router/router.go @@ -100,6 +100,7 @@ func Setup(cfg *config.Config) *gin.Engine { admin.GET("/orders", handler.OrdersList) admin.GET("/gift-pay-requests", handler.AdminGiftPayRequestsList) admin.GET("/user/track", handler.UserTrackGet) + admin.GET("/track/stats", handler.AdminTrackStats) } // ----- 鉴权 -----