@mingxy/cerebro-claude-code 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
16
16
|
`);return e===-1?``:n.stack.slice(e+1)})();try{if(!e.stack)e.stack=r;else if(r){let n=r.indexOf(`
|
|
17
17
|
`),i=n===-1?-1:r.indexOf(`
|
|
18
18
|
`,n+1),a=i===-1?``:r.slice(i+1);String(e.stack).endsWith(a)||(e.stack+=`
|
|
19
|
-
`+r)}}catch{}}throw e}}_request(e,n){typeof e==`string`?(n||={},n.url=e):n=e||{},n=py(this.defaults,n);let{transitional:r,paramsSerializer:i,headers:a}=n;r!==void 0&&Fy.assertOptions(r,{silentJSONParsing:Iy.transitional(Iy.boolean),forcedJSONParsing:Iy.transitional(Iy.boolean),clarifyTimeoutError:Iy.transitional(Iy.boolean),legacyInterceptorReqResOrdering:Iy.transitional(Iy.boolean)},!1),i!=null&&(J.isFunction(i)?n.paramsSerializer={serialize:i}:Fy.assertOptions(i,{encode:Iy.function,serialize:Iy.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?n.allowAbsoluteUrls=!0:n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),Fy.assertOptions(n,{baseUrl:Iy.spelling(`baseURL`),withXsrfToken:Iy.spelling(`withXSRFToken`)},!0),n.method=(n.method||this.defaults.method||`get`).toLowerCase();let o=a&&J.merge(a.common,a[n.method]);a&&J.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete a[e]}),n.headers=Xv.concat(o,a);let s=[],c=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(n)===!1)return;c&&=e.synchronous;let r=n.transitional||Sv;r&&r.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)});let l=[];this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let u,d=0,f;if(!c){let e=[jy.bind(this),void 0];for(e.unshift(...s),e.push(...l),f=e.length,u=Promise.resolve(n);d<f;)u=u.then(e[d++],e[d++]);return u}f=s.length;let p=n;for(;d<f;){let e=s[d++],n=s[d++];try{p=e(p)}catch(e){n.call(this,e);break}}try{u=jy.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,f=l.length;d<f;)u=u.then(l[d++],l[d++]);return u}getUri(e){return e=py(this.defaults,e),bv(dy(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};J.forEach([`delete`,`get`,`head`,`options`],function(e){Ly.prototype[e]=function(n,r){return this.request(py(r||{},{method:e,url:n,data:(r||{}).data}))}}),J.forEach([`post`,`put`,`patch`],function(e){function n(n){return function(r,i,a){return this.request(py(a||{},{method:e,headers:n?{"Content-Type":`multipart/form-data`}:{},url:r,data:i}))}}Ly.prototype[e]=n(),Ly.prototype[e+`Form`]=n(!0)});var Xee=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let n;this.promise=new Promise(function(e){n=e});let r=this;this.promise.then(e=>{if(!r._listeners)return;let n=r._listeners.length;for(;n-- >0;)r._listeners[n](e);r._listeners=null}),this.promise.then=e=>{let n,i=new Promise(e=>{r.subscribe(e),n=e}).then(e);return i.cancel=function(){r.unsubscribe(n)},i},e(function(e,i,a){r.reason||(r.reason=new $v(e,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){let e=new AbortController,n=n=>{e.abort(n)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let n;return{token:new e(function(e){n=e}),cancel:n}}};function Zee(e){return function(n){return e.apply(null,n)}}function Qee(e){return J.isObject(e)&&e.isAxiosError===!0}var Ry={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ry).forEach(([e,n])=>{Ry[n]=e});function zy(e){let n=new Ly(e),r=s_(Ly.prototype.request,n);return J.extend(r,Ly.prototype,n,{allOwnKeys:!0}),J.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return zy(py(e,n))},r}var By=zy(Iv);By.Axios=Ly,By.CanceledError=$v,By.CancelToken=Xee,By.isCancel=Qv,By.VERSION=My,By.toFormData=hv,By.AxiosError=lv,By.Cancel=By.CanceledError,By.all=function(e){return Promise.all(e)},By.spread=Zee,By.isAxiosError=Qee,By.mergeConfig=py,By.AxiosHeaders=Xv,By.formToJSON=e=>Pv(J.isHTMLForm(e)?new FormData(e):e),By.getAdapter=ky.getAdapter,By.HttpStatusCode=Ry,By.default=By;var $ee=typeof window<`u`&&window.__OMEM_API_URL__&&window.__OMEM_API_URL__!==`__OMEM_API_URL__`?window.__OMEM_API_URL__:`/`,Vy=By.create({baseURL:$ee,timeout:3e4,headers:{"Content-Type":`application/json`}});Vy.interceptors.request.use(e=>{let n=dh.getState().users.find(e=>e.id===dh.getState().currentUserId);return n?.apiKey&&(e.headers[`X-API-Key`]=n.apiKey,e.headers[`X-Agent-ID`]=`omem-web`),e.data instanceof FormData&&delete e.headers[`Content-Type`],e}),Vy.interceptors.response.use(e=>e.data,e=>(e.response?.status===401&&(dh.getState().logout(),window.location.href=`/login`),Promise.reject(e)));function ete(){let e=et(),{users:n,currentUserId:r,logout:i}=dh(),a=n.find(e=>e.id===r),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(Date.now());return(0,y.useEffect)(()=>{let e=async()=>{try{await Vy.get(`/health`),s(!0),l(Date.now())}catch{s(!1)}};e();let n=setInterval(e,3e4);return()=>clearInterval(n)},[]),(0,G.jsxs)(`header`,{className:`flex h-14 items-center justify-between border-b border-border bg-card px-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(cee,{}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground truncate max-w-[120px] md:max-w-none`,children:a?.spaceName||a?.name||`未登录`}),(0,G.jsx)(Dp,{children:(0,G.jsxs)(Op,{children:[(0,G.jsx)(kp,{children:(0,G.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${o?`bg-[#22c55e] animate-pulse`:`bg-[#ef4444]`}`})}),(0,G.jsx)(Ap,{children:o?`连接正常 - 上次心跳: ${Math.round((Date.now()-c)/1e3)}秒前`:`连接断开`})]})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ch,{}),(0,G.jsxs)(t_,{children:[(0,G.jsxs)(n_,{className:`flex items-center gap-1.5 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,G.jsx)(fee,{className:`h-7 w-7`,children:(0,G.jsx)(pee,{className:`text-xs bg-primary/10 text-primary`,children:(0,G.jsx)(Zm,{className:`h-3.5 w-3.5`})})}),(0,G.jsx)(Zp,{className:`h-3 w-3 text-muted-foreground`})]}),(0,G.jsxs)(r_,{align:`end`,className:`w-48`,children:[(0,G.jsx)(i_,{children:(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:a?.spaceName||`用户`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground truncate max-w-[180px]`,children:a?.apiKey?`${a.apiKey.slice(0,8)}...`:`未登录`})]})}),(0,G.jsx)(o_,{}),(0,G.jsxs)(a_,{onClick:()=>e(`/profile`),children:[(0,G.jsx)(Zm,{className:`size-4 mr-2`}),`用户画像`]}),(0,G.jsxs)(a_,{onClick:()=>e(`/settings`),children:[(0,G.jsx)(Rm,{className:`size-4 mr-2`}),`系统设置`]}),(0,G.jsx)(o_,{}),(0,G.jsxs)(a_,{variant:`destructive`,onClick:()=>{i(),e(`/login`)},children:[(0,G.jsx)(tee,{className:`size-4 mr-2`}),`退出登录`]})]})]})]})]})}function Hy(){return(0,G.jsx)(`footer`,{className:`border-t border-border bg-card px-4 py-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-4 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:`© 2026 Cerebro`}),(0,G.jsx)(`a`,{href:`https://beian.miit.gov.cn/`,target:`_blank`,rel:`noopener noreferrer`,className:`hover:text-foreground transition-colors`,children:`吉ICP备2026003061号`})]})})}var Uy=ch((e,n)=>({isUnlocked:!1,hasPassword:!1,isLoading:!1,checkStatus:async()=>{try{e({hasPassword:(await Vy.get(`/v1/vault/status`)).has_password})}catch{e({hasPassword:!1})}},setPassword:async n=>{e({isLoading:!0});try{await Vy.post(`/v1/vault/password`,{password:n}),e({isUnlocked:!0,hasPassword:!0})}finally{e({isLoading:!1})}},verifyPassword:async e=>{try{return(await Vy.post(`/v1/vault/verify`,{password:e})).valid}catch{return!1}},unlock:async r=>{let i=await n().verifyPassword(r);return i&&e({isUnlocked:!0}),i},lock:()=>e({isUnlocked:!1})}));function tte(){let e=et(),n=dh(e=>e.isAuthenticated),r=Uy(e=>e.checkStatus),[i,a]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{n&&r().then(()=>{a(!Uy.getState().hasPassword)})},[r,n]),(0,G.jsxs)(`div`,{className:`flex h-screen w-full bg-background text-foreground`,children:[(0,G.jsx)(`div`,{className:`hidden md:flex`,children:(0,G.jsx)(nh,{})}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col min-w-0`,children:[(0,G.jsx)(ete,{}),i&&(0,G.jsx)(`div`,{className:`bg-amber-500/10 border-b border-amber-500/20 px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between max-w-3xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-amber-700 dark:text-amber-400`,children:[(0,G.jsx)(Jm,{className:`size-4 shrink-0`}),(0,G.jsx)(`span`,{children:`为了您的隐私安全,请先设置私密密码`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(q,{variant:`link`,size:`sm`,className:`h-auto p-0 text-amber-700 dark:text-amber-400 font-medium`,onClick:()=>e(`/vault`),children:`去设置 →`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(!1),className:`text-amber-700/60 dark:text-amber-400/60 hover:text-amber-700 dark:hover:text-amber-400`,children:(0,G.jsx)($m,{className:`size-4`})})]})]})}),(0,G.jsx)(`main`,{className:`flex-1 overflow-auto p-4 md:p-6`,children:(0,G.jsx)(kt,{})}),(0,G.jsx)(Hy,{})]})]})}var Wy=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),nte={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Gy={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},rte={disabled:!1,...Gy},Ky={valid(e){return e===null?null:e?{[Wy.valid]:``}:{[Wy.invalid]:``}}},qy=y.createContext({invalid:void 0,name:void 0,validityData:{state:nte,errors:[],error:``,value:``,initialValue:null},setValidityData:pi,disabled:void 0,touched:Gy.touched,setTouched:pi,dirty:Gy.dirty,setDirty:pi,filled:Gy.filled,setFilled:pi,focused:Gy.focused,setFocused:pi,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:rte,markedDirtyRef:{current:!1},registerFieldControl:pi,validation:{getValidationProps:(e=hi)=>e,getInputValidationProps:(e=hi)=>e,inputRef:{current:null},commit:async()=>{}}});function Jy(e=!0){let n=y.useContext(qy);if(n.setValidityData===pi&&!e)throw Error(Ir(28));return n}var Yy=y.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:pi,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Xy(){return y.useContext(Yy)}var Zy=y.createContext({controlId:void 0,registerControlId:pi,labelId:void 0,setLabelId:pi,messageIds:[],setMessageIds:pi,getDescriptionProps:e=>e});function Qy(){return y.useContext(Zy)}function $y(e,n){let{enabled:r=!0,getValue:i,id:a,value:o}=n,{registerFieldControl:s}=Jy(),c=y.useRef(null);c.current||=Symbol(),Pr(()=>{let n=c.current;if(!(!n||!r))return s(n,{controlRef:e,getValue:i,id:a,value:o}),()=>{s(n,void 0)}},[e,r,i,a,s,o])}function eb(e={}){let{id:n,implicit:r=!1,controlRef:i}=e,{controlId:a,registerControlId:o}=Qy(),s=yd(n),c=r?a:void 0,l=Tr(()=>Symbol(`labelable-control`)),u=y.useRef(!1),d=y.useRef(n!=null),f=Ca(()=>{!u.current||o===pi||(u.current=!1,o(l.current,void 0))});return Pr(()=>{if(o===pi)return;let e;if(r){let r=i?.current;e=Gi(r)&&r.closest(`label`)!=null?n??null:c??s}else if(n!=null)d.current=!0,e=n;else if(d.current)e=s;else{f();return}if(e===void 0){f();return}u.current=!0,o(l.current,e)},[n,i,c,o,r,s,l,f]),y.useEffect(()=>f,[f]),a??s}var tb=y.forwardRef(function(e,n){let{render:r,className:i,id:a,name:o,value:s,disabled:c=!1,onValueChange:l,defaultValue:u,autoFocus:d=!1,style:f,...p}=e,{state:m,name:h,disabled:g,setTouched:_,setDirty:v,validityData:b,setFocused:x,setFilled:S,validationMode:C,validation:w}=Jy(),T=g||c,E=h??o,D={...m,disabled:T},{labelId:O}=Qy(),k=eb({id:a});Pr(()=>{let e=s!=null;w.inputRef.current?.value||e&&s!==``?S(!0):e&&s===``&&S(!1)},[w.inputRef,S,s]);let A=y.useRef(null);Pr(()=>{d&&A.current===Va(Aa(A.current))&&x(!0)},[d,x]);let[j]=Mg({controlled:s,default:u,name:`FieldControl`,state:`value`}),M=s!==void 0,N=M?j:void 0,P=Ca(()=>w.inputRef.current?.value);return $y(w.inputRef,{id:k,value:N,getValue:P}),Qs(`input`,e,{ref:[n,A],state:D,props:[{id:k,disabled:T,name:E,ref:w.inputRef,"aria-labelledby":O,autoFocus:d,...M?{value:N}:{defaultValue:u},onChange(e){let n=e.currentTarget.value;l?.(n,Ii(xi,e.nativeEvent)),v(n!==b.initialValue),S(n!==``)},onFocus(){x(!0)},onBlur(e){_(!0),x(!1),C===`onBlur`&&w.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(_(!0),w.commit(e.currentTarget.value))}},w.getInputValidationProps(),p],stateAttributesMapping:Ky})}),nb=y.createContext({disabled:!1});function rb(){return y.useContext(nb)}var ib=y.createContext(void 0);function ab(e=!0){let n=y.useContext(ib);if(n===void 0&&!e)throw Error(Ir(3));return n}var ob=y.forwardRef(function(e,n){return(0,G.jsx)(tb,{ref:n,...e})});function sb({className:e,type:n,...r}){return(0,G.jsx)(ob,{type:n,"data-slot":`input`,className:Tp(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...r})}function cb({className:e,...n}){return(0,G.jsx)(`label`,{"data-slot":`label`,className:Tp(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...n})}function lb(){let e=[{cx:250,cy:250,r:8},{cx:160,cy:130,r:4},{cx:360,cy:140,r:3},{cx:390,cy:290,r:5},{cx:330,cy:390,r:3},{cx:170,cy:400,r:4},{cx:110,cy:290,r:3},{cx:200,cy:80,r:5},{cx:310,cy:210,r:3},{cx:140,cy:220,r:3},{cx:280,cy:340,r:3},{cx:420,cy:240,r:3}];return(0,G.jsxs)(`svg`,{viewBox:`0 0 500 500`,className:`w-full h-full`,children:[(0,G.jsx)(`title`,{children:`Memory Network`}),(0,G.jsxs)(`defs`,{children:[(0,G.jsxs)(`radialGradient`,{id:`netGlow`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#c9a227`,stopOpacity:`0.18`}),(0,G.jsx)(`stop`,{offset:`50%`,stopColor:`#c9a227`,stopOpacity:`0.05`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#c9a227`,stopOpacity:`0`})]}),(0,G.jsxs)(`filter`,{id:`glow`,children:[(0,G.jsx)(`feGaussianBlur`,{stdDeviation:`2`,result:`blur`}),(0,G.jsxs)(`feMerge`,{children:[(0,G.jsx)(`feMergeNode`,{in:`blur`}),(0,G.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,G.jsx)(`circle`,{cx:`250`,cy:`250`,r:`210`,fill:`url(#netGlow)`,children:(0,G.jsx)(`animate`,{attributeName:`r`,values:`210;230;210`,dur:`8s`,repeatCount:`indefinite`})}),(0,G.jsx)(`circle`,{cx:`250`,cy:`250`,r:`130`,fill:`none`,stroke:`#c9a227`,strokeWidth:`0.4`,opacity:`0.12`,children:(0,G.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,from:`0 250 250`,to:`360 250 250`,dur:`60s`,repeatCount:`indefinite`})}),(0,G.jsx)(`circle`,{cx:`250`,cy:`250`,r:`175`,fill:`none`,stroke:`#c9a227`,strokeWidth:`0.25`,opacity:`0.08`,children:(0,G.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,from:`360 250 250`,to:`0 250 250`,dur:`90s`,repeatCount:`indefinite`})}),[[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,9],[0,10],[0,11],[1,7],[1,9],[2,7],[2,8],[3,8],[3,4],[4,10],[5,10],[5,6],[6,9],[8,11],[3,11]].map(([n,r],i)=>(0,G.jsx)(`line`,{x1:e[n].cx,y1:e[n].cy,x2:e[r].cx,y2:e[r].cy,stroke:`#c9a227`,strokeWidth:`0.5`,opacity:`0.25`,children:(0,G.jsx)(`animate`,{attributeName:`opacity`,values:`0.25;0.5;0.25`,dur:`${3+i%4}s`,repeatCount:`indefinite`})},`conn-${n}-${r}`)),e.map((e,n)=>(0,G.jsxs)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,fill:`#c9a227`,opacity:n===0?1:.65,filter:n===0?`url(#glow)`:void 0,children:[(0,G.jsx)(`animate`,{attributeName:`r`,values:`${e.r};${e.r*1.5};${e.r}`,dur:`${2+n%3}s`,repeatCount:`indefinite`}),n===0&&(0,G.jsx)(`animate`,{attributeName:`opacity`,values:`1;0.6;1`,dur:`3s`,repeatCount:`indefinite`})]},`node-${e.cx}-${e.cy}`))]})}var ub=[{icon:qp,label:`永久记忆`},{icon:eh,label:`瞬间调取`},{icon:Rm,label:`隐私安全`}];function db(){let e=et(),{users:n,currentUserId:r,addUser:i,setCurrentUser:a,removeUser:o}=dh(),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(!1),h=async r=>{r.preventDefault(),f(``),u(!0);try{let r=window.__OMEM_API_URL__&&window.__OMEM_API_URL__!==`__OMEM_API_URL__`?window.__OMEM_API_URL__:window.location.origin,o=By.create({baseURL:r,headers:{"X-API-Key":s},timeout:1e4});if((await o.get(`/health`)).status!==200)throw Error(`health check failed`);let c=`默认空间`,l=(await o.get(`/v1/spaces`)).data,u=Array.isArray(l)?l:l?.spaces||[];u.length>0&&u[0].name&&(c=u[0].name);let d=n.find(e=>e.apiKey===s);if(d){a(d.id),e(`/dashboard`);return}i({id:crypto.randomUUID(),name:c,apiKey:s,apiUrl:r,lastUsed:new Date().toISOString(),spaceName:c,isProtected:s===`c60beb98-7aab-4985-8c1d-29ffd6aff75a`}),e(`/dashboard`)}catch{f(`验证失败,请检查 API Key 是否正确`)}finally{u(!1)}},g=n=>{a(n.id),e(`/dashboard`)},_=(e,n)=>{e.stopPropagation(),o(n)};return(0,G.jsxs)(`div`,{className:`dark min-h-screen bg-[#070708] grid lg:grid-cols-[55%_45%]`,children:[(0,G.jsxs)(`div`,{className:`hidden lg:flex flex-col justify-between relative overflow-hidden p-12`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03]`,style:{backgroundImage:`radial-gradient(circle at 1px 1px, rgba(255,255,255,0.4) 1px, transparent 0)`,backgroundSize:`40px 40px`}}),(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center scale-110`,children:(0,G.jsx)(lb,{})}),(0,G.jsxs)(`div`,{className:`relative z-10 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-[#c9a227]/10 border border-[#c9a227]/20`,children:(0,G.jsx)(qp,{className:`h-5 w-5 text-[#c9a227]`})}),(0,G.jsx)(`span`,{className:`text-xl font-bold tracking-tight text-white`,children:`Cerebro`})]}),(0,G.jsxs)(`div`,{className:`relative z-10 space-y-8`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-[#c9a227]/20 bg-[#c9a227]/5 px-3 py-1 text-xs font-medium text-[#c9a227]`,children:[(0,G.jsx)(Bm,{className:`h-3 w-3`}),`AI 记忆引擎`]}),(0,G.jsxs)(`h1`,{className:`text-5xl font-bold tracking-tight text-white leading-[1.1]`,children:[`让 AI 记住`,(0,G.jsx)(`br`,{}),(0,G.jsx)(`span`,{className:`text-[#c9a227]`,children:`你的一切`})]}),(0,G.jsxs)(`p`,{className:`text-lg text-white/40 max-w-sm leading-relaxed`,children:[`你的第二大脑,永远在线。`,(0,G.jsx)(`br`,{}),`每一次对话,都值得被铭记。`]})]}),(0,G.jsx)(`div`,{className:`flex gap-6`,children:ub.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-white/40`,children:[(0,G.jsx)(e.icon,{className:`h-4 w-4 text-[#c9a227]/70`}),e.label]},e.label))})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col min-h-screen`,children:[(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,G.jsxs)(`div`,{className:`lg:hidden text-center space-y-4 mb-2`,children:[(0,G.jsx)(`div`,{className:`inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-[#c9a227]/10 border border-[#c9a227]/20`,children:(0,G.jsx)(qp,{className:`h-7 w-7 text-[#c9a227]`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:`Cerebro`}),(0,G.jsx)(`p`,{className:`text-sm text-white/40 mt-1`,children:`让 AI 记住你的一切`})]})]}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-white/[0.08] bg-white/[0.03] backdrop-blur-xl p-6 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:`欢迎回来`}),(0,G.jsx)(`p`,{className:`text-sm text-white/40`,children:`输入 API Key 以访问您的记忆库`})]}),(0,G.jsxs)(`form`,{onSubmit:h,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(cb,{htmlFor:`apiKey`,className:`text-white/70`,children:`API Key`}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(xm,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-white/30`}),(0,G.jsx)(sb,{id:`apiKey`,type:p?`text`:`password`,placeholder:`输入您的 Cerebro API Key`,value:s,onChange:e=>c(e.target.value),className:`pl-9 pr-10 bg-white/[0.05] border-white/10 text-white placeholder:text-white/25 focus:border-[#c9a227]/50 focus:ring-[#c9a227]/20`,disabled:l,required:!0}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`absolute right-3 top-1/2 -translate-y-1/2 text-white/30 hover:text-white/70 transition-colors`,tabIndex:-1,children:p?(0,G.jsx)(sm,{className:`h-4 w-4`}):(0,G.jsx)(cm,{className:`h-4 w-4`})})]})]}),d&&(0,G.jsx)(`div`,{className:`rounded-lg bg-red-500/10 border border-red-500/20 p-3 text-sm text-red-400`,children:d}),(0,G.jsx)(q,{type:`submit`,disabled:l||!s,className:`w-full bg-[#c9a227] hover:bg-[#d4b43a] text-[#070708] font-semibold transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:l?(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`h-4 w-4 border-2 border-[#070708]/30 border-t-[#070708] rounded-full animate-spin`}),`验证中...`]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`验证并登录`,(0,G.jsx)(Hp,{className:`h-4 w-4`})]})})]})]}),n.length>0&&(0,G.jsxs)(`div`,{className:`rounded-2xl border border-white/[0.08] bg-white/[0.03] backdrop-blur-xl p-6 space-y-4`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white/70`,children:`已保存的账号`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>(0,G.jsxs)(`div`,{className:`group flex w-full items-center rounded-xl border transition-all overflow-hidden ${r===e.id?`border-[#c9a227]/30 bg-[#c9a227]/5`:`border-white/10 bg-white/[0.03] hover:border-white/20 hover:bg-white/[0.06]`}`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g(e),className:`flex flex-1 items-center gap-3 p-3 text-left min-w-0`,children:[(0,G.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition-colors ${r===e.id?`bg-[#c9a227] text-[#070708]`:`bg-white/10 text-white/40`}`,children:r===e.id?(0,G.jsx)(Xp,{className:`h-4 w-4`}):(0,G.jsx)(xm,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-0.5 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-white/90 truncate`,children:e.spaceName||e.name}),(0,G.jsx)(`p`,{className:`text-xs text-white/35`,children:Ep(e.apiKey)})]})]}),(0,G.jsx)(`div`,{className:`p-2 opacity-0 transition-opacity group-hover:opacity-100`,children:(0,G.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:n=>{n.stopPropagation(),_(n,e.id)},disabled:e.isProtected,className:`h-8 w-8 disabled:opacity-0 disabled:cursor-not-allowed text-white/40 hover:text-red-400 hover:bg-red-500/10`,title:e.isProtected?`受保护的账号无法删除`:`删除账号`,children:(0,G.jsx)(Km,{className:`h-3.5 w-3.5`})})})]},e.id))})]})]})}),(0,G.jsx)(Hy,{})]})]})}function fb({className:e,size:n=`default`,...r}){return(0,G.jsx)(`div`,{"data-slot":`card`,"data-size":n,className:Tp(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...r})}function pb({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`card-header`,className:Tp(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...n})}function mb({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`card-title`,className:Tp(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...n})}function hb({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`card-description`,className:Tp(`text-sm text-muted-foreground`,e),...n})}function gb({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`card-content`,className:Tp(`px-4 group-data-[size=sm]/card:px-3`,e),...n})}function _b({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`skeleton`,className:Tp(`animate-pulse rounded-md bg-muted`,e),...n})}var vb=s(((e,n)=>{n.exports=Array.isArray})),yb=s(((e,n)=>{n.exports=typeof global==`object`&&global&&global.Object===Object&&global})),bb=s(((e,n)=>{var r=yb(),i=typeof self==`object`&&self&&self.Object===Object&&self;n.exports=r||i||Function(`return this`)()})),xb=s(((e,n)=>{n.exports=bb().Symbol})),Sb=s(((e,n)=>{var r=xb(),i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=r?r.toStringTag:void 0;function c(e){var n=a.call(e,s),r=e[s];try{e[s]=void 0;var i=!0}catch{}var c=o.call(e);return i&&(n?e[s]=r:delete e[s]),c}n.exports=c})),Cb=s(((e,n)=>{var r=Object.prototype.toString;function i(e){return r.call(e)}n.exports=i})),wb=s(((e,n)=>{var r=xb(),i=Sb(),a=Cb(),o=`[object Null]`,s=`[object Undefined]`,c=r?r.toStringTag:void 0;function l(e){return e==null?e===void 0?s:o:c&&c in Object(e)?i(e):a(e)}n.exports=l})),Tb=s(((e,n)=>{function r(e){return typeof e==`object`&&!!e}n.exports=r})),Eb=s(((e,n)=>{var r=wb(),i=Tb(),a=`[object Symbol]`;function o(e){return typeof e==`symbol`||i(e)&&r(e)==a}n.exports=o})),Db=s(((e,n)=>{var r=vb(),i=Eb(),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;function s(e,n){if(r(e))return!1;var s=typeof e;return s==`number`||s==`symbol`||s==`boolean`||e==null||i(e)?!0:o.test(e)||!a.test(e)||n!=null&&e in Object(n)}n.exports=s})),Ob=s(((e,n)=>{function r(e){var n=typeof e;return e!=null&&(n==`object`||n==`function`)}n.exports=r})),kb=s(((e,n)=>{var r=wb(),i=Ob(),a=`[object AsyncFunction]`,o=`[object Function]`,s=`[object GeneratorFunction]`,c=`[object Proxy]`;function l(e){if(!i(e))return!1;var n=r(e);return n==o||n==s||n==a||n==c}n.exports=l})),Ab=s(((e,n)=>{n.exports=bb()[`__core-js_shared__`]})),jb=s(((e,n)=>{var r=Ab(),i=function(){var e=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function a(e){return!!i&&i in e}n.exports=a})),Mb=s(((e,n)=>{var r=Function.prototype.toString;function i(e){if(e!=null){try{return r.call(e)}catch{}try{return e+``}catch{}}return``}n.exports=i})),Nb=s(((e,n)=>{var r=kb(),i=jb(),a=Ob(),o=Mb(),s=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,p=RegExp(`^`+d.call(f).replace(s,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function m(e){return!a(e)||i(e)?!1:(r(e)?p:c).test(o(e))}n.exports=m})),Pb=s(((e,n)=>{function r(e,n){return e?.[n]}n.exports=r})),Fb=s(((e,n)=>{var r=Nb(),i=Pb();function a(e,n){var a=i(e,n);return r(a)?a:void 0}n.exports=a})),Ib=s(((e,n)=>{n.exports=Fb()(Object,`create`)})),Lb=s(((e,n)=>{var r=Ib();function i(){this.__data__=r?r(null):{},this.size=0}n.exports=i})),Rb=s(((e,n)=>{function r(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=+!!n,n}n.exports=r})),zb=s(((e,n)=>{var r=Ib(),i=`__lodash_hash_undefined__`,a=Object.prototype.hasOwnProperty;function o(e){var n=this.__data__;if(r){var o=n[e];return o===i?void 0:o}return a.call(n,e)?n[e]:void 0}n.exports=o})),Bb=s(((e,n)=>{var r=Ib(),i=Object.prototype.hasOwnProperty;function a(e){var n=this.__data__;return r?n[e]!==void 0:i.call(n,e)}n.exports=a})),Vb=s(((e,n)=>{var r=Ib(),i=`__lodash_hash_undefined__`;function a(e,n){var a=this.__data__;return this.size+=+!this.has(e),a[e]=r&&n===void 0?i:n,this}n.exports=a})),Hb=s(((e,n)=>{var r=Lb(),i=Rb(),a=zb(),o=Bb(),s=Vb();function c(e){var n=-1,r=e==null?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,n.exports=c})),Ub=s(((e,n)=>{function r(){this.__data__=[],this.size=0}n.exports=r})),Wb=s(((e,n)=>{function r(e,n){return e===n||e!==e&&n!==n}n.exports=r})),Gb=s(((e,n)=>{var r=Wb();function i(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}n.exports=i})),Kb=s(((e,n)=>{var r=Gb(),i=Array.prototype.splice;function a(e){var n=this.__data__,a=r(n,e);return a<0?!1:(a==n.length-1?n.pop():i.call(n,a,1),--this.size,!0)}n.exports=a})),qb=s(((e,n)=>{var r=Gb();function i(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}n.exports=i})),Jb=s(((e,n)=>{var r=Gb();function i(e){return r(this.__data__,e)>-1}n.exports=i})),Yb=s(((e,n)=>{var r=Gb();function i(e,n){var i=this.__data__,a=r(i,e);return a<0?(++this.size,i.push([e,n])):i[a][1]=n,this}n.exports=i})),Xb=s(((e,n)=>{var r=Ub(),i=Kb(),a=qb(),o=Jb(),s=Yb();function c(e){var n=-1,r=e==null?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,n.exports=c})),Zb=s(((e,n)=>{n.exports=Fb()(bb(),`Map`)})),Qb=s(((e,n)=>{var r=Hb(),i=Xb(),a=Zb();function o(){this.size=0,this.__data__={hash:new r,map:new(a||i),string:new r}}n.exports=o})),$b=s(((e,n)=>{function r(e){var n=typeof e;return n==`string`||n==`number`||n==`symbol`||n==`boolean`?e!==`__proto__`:e===null}n.exports=r})),ex=s(((e,n)=>{var r=$b();function i(e,n){var i=e.__data__;return r(n)?i[typeof n==`string`?`string`:`hash`]:i.map}n.exports=i})),tx=s(((e,n)=>{var r=ex();function i(e){var n=r(this,e).delete(e);return this.size-=+!!n,n}n.exports=i})),nx=s(((e,n)=>{var r=ex();function i(e){return r(this,e).get(e)}n.exports=i})),rx=s(((e,n)=>{var r=ex();function i(e){return r(this,e).has(e)}n.exports=i})),ix=s(((e,n)=>{var r=ex();function i(e,n){var i=r(this,e),a=i.size;return i.set(e,n),this.size+=i.size==a?0:1,this}n.exports=i})),ax=s(((e,n)=>{var r=Qb(),i=tx(),a=nx(),o=rx(),s=ix();function c(e){var n=-1,r=e==null?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,n.exports=c})),ox=s(((e,n)=>{var r=ax(),i=`Expected a function`;function a(e,n){if(typeof e!=`function`||n!=null&&typeof n!=`function`)throw TypeError(i);var o=function(){var r=arguments,i=n?n.apply(this,r):r[0],a=o.cache;if(a.has(i))return a.get(i);var s=e.apply(this,r);return o.cache=a.set(i,s)||a,s};return o.cache=new(a.Cache||r),o}a.Cache=r,n.exports=a})),sx=s(((e,n)=>{var r=ox(),i=500;function a(e){var n=r(e,function(e){return a.size===i&&a.clear(),e}),a=n.cache;return n}n.exports=a})),cx=s(((e,n)=>{var r=sx(),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g;n.exports=r(function(e){var n=[];return e.charCodeAt(0)===46&&n.push(``),e.replace(i,function(e,r,i,o){n.push(i?o.replace(a,`$1`):r||e)}),n})})),lx=s(((e,n)=>{function r(e,n){for(var r=-1,i=e==null?0:e.length,a=Array(i);++r<i;)a[r]=n(e[r],r,e);return a}n.exports=r})),ux=s(((e,n)=>{var r=xb(),i=lx(),a=vb(),o=Eb(),s=1/0,c=r?r.prototype:void 0,l=c?c.toString:void 0;function u(e){if(typeof e==`string`)return e;if(a(e))return i(e,u)+``;if(o(e))return l?l.call(e):``;var n=e+``;return n==`0`&&1/e==-s?`-0`:n}n.exports=u})),dx=s(((e,n)=>{var r=ux();function i(e){return e==null?``:r(e)}n.exports=i})),fx=s(((e,n)=>{var r=vb(),i=Db(),a=cx(),o=dx();function s(e,n){return r(e)?e:i(e,n)?[e]:a(o(e))}n.exports=s})),px=s(((e,n)=>{var r=Eb(),i=1/0;function a(e){if(typeof e==`string`||r(e))return e;var n=e+``;return n==`0`&&1/e==-i?`-0`:n}n.exports=a})),mx=s(((e,n)=>{var r=fx(),i=px();function a(e,n){n=r(n,e);for(var a=0,o=n.length;e!=null&&a<o;)e=e[i(n[a++])];return a&&a==o?e:void 0}n.exports=a})),hx=s(((e,n)=>{var r=mx();function i(e,n,i){var a=e==null?void 0:r(e,n);return a===void 0?i:a}n.exports=i})),gx=s(((e,n)=>{function r(e){return e==null}n.exports=r})),_x=s(((e,n)=>{var r=wb(),i=vb(),a=Tb(),o=`[object String]`;function s(e){return typeof e==`string`||!i(e)&&a(e)&&r(e)==o}n.exports=s})),vx=s((e=>{var n=Symbol.for(`react.element`),r=Symbol.for(`react.portal`),i=Symbol.for(`react.fragment`),a=Symbol.for(`react.strict_mode`),o=Symbol.for(`react.profiler`),s=Symbol.for(`react.provider`),c=Symbol.for(`react.context`),l=Symbol.for(`react.server_context`),u=Symbol.for(`react.forward_ref`),d=Symbol.for(`react.suspense`),f=Symbol.for(`react.suspense_list`),p=Symbol.for(`react.memo`),m=Symbol.for(`react.lazy`);function h(e){if(typeof e==`object`&&e){var h=e.$$typeof;switch(h){case n:switch(e=e.type,e){case i:case o:case a:case d:case f:return e;default:switch(e&&=e.$$typeof,e){case l:case c:case u:case m:case p:case s:return e;default:return h}}case r:return h}}}e.isFragment=function(e){return h(e)===i}})),yx=s(((e,n)=>{n.exports=vx()})),bx=s(((e,n)=>{var r=wb(),i=Tb(),a=`[object Number]`;function o(e){return typeof e==`number`||i(e)&&r(e)==a}n.exports=o})),xx=s(((e,n)=>{var r=bx();function i(e){return r(e)&&e!=+e}n.exports=i})),Sx=u(_x()),Cx=u(xx()),wx=u(hx()),Tx=u(bx()),Ex=u(gx()),Dx=function(e){return e===0?0:e>0?1:-1},Ox=function(e){return(0,Sx.default)(e)&&e.indexOf(`%`)===e.length-1},Y=function(e){return(0,Tx.default)(e)&&!(0,Cx.default)(e)},kx=function(e){return(0,Ex.default)(e)},Ax=function(e){return Y(e)||(0,Sx.default)(e)},jx=0,Mx=function(e){var n=++jx;return`${e||``}${n}`},Nx=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Y(e)&&!(0,Sx.default)(e))return r;var a;if(Ox(e)){var o=e.indexOf(`%`);a=n*parseFloat(e.slice(0,o))/100}else a=+e;return(0,Cx.default)(a)&&(a=r),i&&a>n&&(a=n),a},Px=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},Fx=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i<n;i++)if(!r[e[i]])r[e[i]]=!0;else return!0;return!1},Ix=function(e,n){return Y(e)&&Y(n)?function(r){return e+r*(n-e)}:function(){return n}};function Lx(e,n,r){return!e||!e.length?null:e.find(function(e){return e&&(typeof n==`function`?n(e):(0,wx.default)(e,n))===r})}var Rx=function(e,n){return Y(e)&&Y(n)?e-n:(0,Sx.default)(e)&&(0,Sx.default)(n)?e.localeCompare(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))};function zx(e,n){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(n,r)||e[r]!==n[r]))return!1;for(var i in n)if({}.hasOwnProperty.call(n,i)&&!{}.hasOwnProperty.call(e,i))return!1;return!0}var Bx=u(Ob());function Vx(e){"@babel/helpers - typeof";return Vx=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Vx(e)}var Hx=[`viewBox`,`children`],Ux=`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`),Wx=[`points`,`pathLength`],Gx={svg:Hx,polygon:Wx,polyline:Wx},Kx=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`),qx=function(e,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,y.isValidElement)(e)&&(r=e.props),!(0,Bx.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){Kx.includes(e)&&(i[e]=n||function(n){return r[e](r,n)})}),i},Jx=function(e,n,r){return function(i){return e(n,r,i),null}},Yx=function(e,n,r){if(!(0,Bx.default)(e)||Vx(e)!==`object`)return null;var i=null;return Object.keys(e).forEach(function(a){var o=e[a];Kx.includes(a)&&typeof o==`function`&&(i||={},i[a]=Jx(o,n,r))}),i},Xx=u(kb()),Zx=yx(),Qx=[`children`],$x=[`children`];function eS(e,n){if(e==null)return{};var r=tS(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function tS(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}function nS(e){"@babel/helpers - typeof";return nS=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nS(e)}var rS={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},iS=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},aS=null,oS=null,sS=function e(n){if(n===aS&&Array.isArray(oS))return oS;var r=[];return y.Children.forEach(n,function(n){(0,Ex.default)(n)||((0,Zx.isFragment)(n)?r=r.concat(e(n.props.children)):r.push(n))}),oS=r,aS=n,r};function cS(e,n){var r=[],i=[];return i=Array.isArray(n)?n.map(function(e){return iS(e)}):[iS(n)],sS(e).forEach(function(e){var n=(0,wx.default)(e,`type.displayName`)||(0,wx.default)(e,`type.name`);i.indexOf(n)!==-1&&r.push(e)}),r}function lS(e,n){var r=cS(e,n);return r&&r[0]}var uS=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!Y(r)||r<=0||!Y(i)||i<=0)},dS=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),fS=function(e){return e&&e.type&&(0,Sx.default)(e.type)&&dS.indexOf(e.type)>=0},pS=function(e){return e&&nS(e)===`object`&&`clipDot`in e},mS=function(e,n,r,i){var a=Gx?.[i]??[];return n.startsWith(`data-`)||!(0,Xx.default)(e)&&(i&&a.includes(n)||Ux.includes(n))||r&&Kx.includes(n)},hS=function(e,n,r){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var i=e;if((0,y.isValidElement)(e)&&(i=e.props),!(0,Bx.default)(i))return null;var a={};return Object.keys(i).forEach(function(e){mS(i?.[e],e,n,r)&&(a[e]=i[e])}),a},gS=function e(n,r){if(n===r)return!0;var i=y.Children.count(n);if(i!==y.Children.count(r))return!1;if(i===0)return!0;if(i===1)return _S(Array.isArray(n)?n[0]:n,Array.isArray(r)?r[0]:r);for(var a=0;a<i;a++){var o=n[a],s=r[a];if(Array.isArray(o)||Array.isArray(s)){if(!e(o,s))return!1}else if(!_S(o,s))return!1}return!0},_S=function(e,n){if((0,Ex.default)(e)&&(0,Ex.default)(n))return!0;if(!(0,Ex.default)(e)&&!(0,Ex.default)(n)){var r=e.props||{},i=r.children,a=eS(r,Qx),o=n.props||{},s=o.children,c=eS(o,$x);return i&&s?zx(a,c)&&gS(i,s):!i&&!s?zx(a,c):!1}return!1},vS=function(e,n){var r=[],i={};return sS(e).forEach(function(e,a){if(fS(e))r.push(e);else if(e){var o=iS(e.type),s=n[o]||{},c=s.handler,l=s.once;if(c&&(!l||!i[o])){var u=c(e,o,a);r.push(u),i[o]=!0}}}),r},yS=function(e){var n=e&&e.type;return n&&rS[n]?rS[n]:null},bS=function(e,n){return sS(n).indexOf(e)},xS=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function SS(){return SS=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},SS.apply(this,arguments)}function CS(e,n){if(e==null)return{};var r=wS(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function wS(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}function TS(e){var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=CS(e,xS),d=a||{width:r,height:i,x:0,y:0},f=Zd(`recharts-surface`,o);return y.createElement(`svg`,SS({},hS(u,!0,`svg`),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`}),y.createElement(`title`,null,c),y.createElement(`desc`,null,l),n)}var ES=[`children`,`className`];function DS(){return DS=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},DS.apply(this,arguments)}function OS(e,n){if(e==null)return{};var r=kS(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function kS(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}var AS=y.forwardRef(function(e,n){var r=e.children,i=e.className,a=OS(e,ES),o=Zd(`recharts-layer`,i);return y.createElement(`g`,DS({className:o},hS(a,!0),{ref:n}),r)}),jS=!1,MS=function(e,n){var r=[...arguments].slice(2);if(jS&&typeof console<`u`&&console.warn&&(n===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(n===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var i=0;console.warn(n.replace(/%s/g,function(){return r[i++]}))}},NS=s(((e,n)=>{function r(e,n,r){var i=-1,a=e.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var o=Array(a);++i<a;)o[i]=e[i+n];return o}n.exports=r})),PS=s(((e,n)=>{var r=NS();function i(e,n,i){var a=e.length;return i=i===void 0?a:i,!n&&i>=a?e:r(e,n,i)}n.exports=i})),FS=s(((e,n)=>{var r=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function i(e){return r.test(e)}n.exports=i})),IS=s(((e,n)=>{function r(e){return e.split(``)}n.exports=r})),LS=s(((e,n)=>{var r=`\\ud800-\\udfff`,i=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,a=`\\ufe0e\\ufe0f`,o=`[`+r+`]`,s=`[`+i+`]`,c=`\\ud83c[\\udffb-\\udfff]`,l=`(?:`+s+`|`+c+`)`,u=`[^`+r+`]`,d=`(?:\\ud83c[\\udde6-\\uddff]){2}`,f=`[\\ud800-\\udbff][\\udc00-\\udfff]`,p=`\\u200d`,m=l+`?`,h=`[`+a+`]?`,g=`(?:`+p+`(?:`+[u,d,f].join(`|`)+`)`+h+m+`)*`,_=h+m+g,v=`(?:`+[u+s+`?`,s,d,f,o].join(`|`)+`)`,y=RegExp(c+`(?=`+c+`)|`+v+_,`g`);function b(e){return e.match(y)||[]}n.exports=b})),RS=s(((e,n)=>{var r=IS(),i=FS(),a=LS();function o(e){return i(e)?a(e):r(e)}n.exports=o})),zS=s(((e,n)=>{var r=PS(),i=FS(),a=RS(),o=dx();function s(e){return function(n){n=o(n);var s=i(n)?a(n):void 0,c=s?s[0]:n.charAt(0),l=s?r(s,1).join(``):n.slice(1);return c[e]()+l}}n.exports=s})),BS=s(((e,n)=>{n.exports=zS()(`toUpperCase`)}));function VS(e){return function(){return e}}var HS=Math.cos,US=Math.sin,WS=Math.sqrt,GS=Math.PI;GS/2;var KS=2*GS,qS=Math.PI,JS=2*qS,YS=1e-6,XS=JS-YS;function ZS(e){this._+=e[0];for(let n=1,r=e.length;n<r;++n)this._+=arguments[n]+e[n]}function QS(e){let n=Math.floor(e);if(!(n>=0))throw Error(`invalid digits: ${e}`);if(n>15)return ZS;let r=10**n;return function(e){this._+=e[0];for(let n=1,i=e.length;n<i;++n)this._+=Math.round(arguments[n]*r)/r+e[n]}}var $S=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?ZS:QS(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,i){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(e,n,r,i,a,o){this._append`C${+e},${+n},${+r},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(e,n,r,i,a){if(e=+e,n=+n,r=+r,i=+i,a=+a,a<0)throw Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,c=r-e,l=i-n,u=o-e,d=s-n,f=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(f>YS)if(!(Math.abs(d*c-l*u)>YS)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-o,m=i-s,h=c*c+l*l,g=p*p+m*m,_=Math.sqrt(h),v=Math.sqrt(f),y=a*Math.tan((qS-Math.acos((h+f-g)/(2*_*v)))/2),b=y/v,x=y/_;Math.abs(b-1)>YS&&this._append`L${e+b*u},${n+b*d}`,this._append`A${a},${a},0,0,${+(d*p>u*m)},${this._x1=e+x*c},${this._y1=n+x*l}`}}arc(e,n,r,i,a,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw Error(`negative radius: ${r}`);let s=r*Math.cos(i),c=r*Math.sin(i),l=e+s,u=n+c,d=1^o,f=o?i-a:a-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>YS||Math.abs(this._y1-u)>YS)&&this._append`L${l},${u}`,r&&(f<0&&(f=f%JS+JS),f>XS?this._append`A${r},${r},0,1,${d},${e-s},${n-c}A${r},${r},0,1,${d},${this._x1=l},${this._y1=u}`:f>YS&&this._append`A${r},${r},0,${+(f>=qS)},${d},${this._x1=e+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function eC(){return new $S}eC.prototype=$S.prototype;function tC(e){let n=3;return e.digits=function(r){if(!arguments.length)return n;if(r==null)n=null;else{let e=Math.floor(r);if(!(e>=0))throw RangeError(`invalid digits: ${r}`);n=e}return e},()=>new $S(n)}Array.prototype.slice;function nC(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function rC(e){this._context=e}rC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;default:this._context.lineTo(e,n);break}}};function iC(e){return new rC(e)}function aC(e){return e[0]}function oC(e){return e[1]}function sC(e,n){var r=VS(!0),i=null,a=iC,o=null,s=tC(c);e=typeof e==`function`?e:e===void 0?aC:VS(e),n=typeof n==`function`?n:n===void 0?oC:VS(n);function c(c){var l,u=(c=nC(c)).length,d,f=!1,p;for(i??(o=a(p=s())),l=0;l<=u;++l)!(l<u&&r(d=c[l],l,c))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+e(d,l,c),+n(d,l,c));if(p)return o=null,p+``||null}return c.x=function(n){return arguments.length?(e=typeof n==`function`?n:VS(+n),c):e},c.y=function(e){return arguments.length?(n=typeof e==`function`?e:VS(+e),c):n},c.defined=function(e){return arguments.length?(r=typeof e==`function`?e:VS(!!e),c):r},c.curve=function(e){return arguments.length?(a=e,i!=null&&(o=a(i)),c):a},c.context=function(e){return arguments.length?(e==null?i=o=null:o=a(i=e),c):i},c}function cC(e,n,r){var i=null,a=VS(!0),o=null,s=iC,c=null,l=tC(u);e=typeof e==`function`?e:e===void 0?aC:VS(+e),n=typeof n==`function`?n:VS(n===void 0?0:+n),r=typeof r==`function`?r:r===void 0?oC:VS(+r);function u(u){var d,f,p,m=(u=nC(u)).length,h,g=!1,_,v=Array(m),y=Array(m);for(o??(c=s(_=l())),d=0;d<=m;++d){if(!(d<m&&a(h=u[d],d,u))===g)if(g=!g)f=d,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),p=d-1;p>=f;--p)c.point(v[p],y[p]);c.lineEnd(),c.areaEnd()}g&&(v[d]=+e(h,d,u),y[d]=+n(h,d,u),c.point(i?+i(h,d,u):v[d],r?+r(h,d,u):y[d]))}if(_)return c=null,_+``||null}function d(){return sC().defined(a).curve(s).context(o)}return u.x=function(n){return arguments.length?(e=typeof n==`function`?n:VS(+n),i=null,u):e},u.x0=function(n){return arguments.length?(e=typeof n==`function`?n:VS(+n),u):e},u.x1=function(e){return arguments.length?(i=e==null?null:typeof e==`function`?e:VS(+e),u):i},u.y=function(e){return arguments.length?(n=typeof e==`function`?e:VS(+e),r=null,u):n},u.y0=function(e){return arguments.length?(n=typeof e==`function`?e:VS(+e),u):n},u.y1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:VS(+e),u):r},u.lineX0=u.lineY0=function(){return d().x(e).y(n)},u.lineY1=function(){return d().x(e).y(r)},u.lineX1=function(){return d().x(i).y(n)},u.defined=function(e){return arguments.length?(a=typeof e==`function`?e:VS(!!e),u):a},u.curve=function(e){return arguments.length?(s=e,o!=null&&(c=s(o)),u):s},u.context=function(e){return arguments.length?(e==null?o=c=null:c=s(o=e),u):o},u}var lC=class{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}this._x0=e,this._y0=n}};function uC(e){return new lC(e,!0)}function dC(e){return new lC(e,!1)}var fC={draw(e,n){let r=WS(n/GS);e.moveTo(r,0),e.arc(0,0,r,0,KS)}},pC={draw(e,n){let r=WS(n/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},mC=WS(1/3),hC=mC*2,gC={draw(e,n){let r=WS(n/hC),i=r*mC;e.moveTo(0,-r),e.lineTo(i,0),e.lineTo(0,r),e.lineTo(-i,0),e.closePath()}},_C={draw(e,n){let r=WS(n),i=-r/2;e.rect(i,i,r,r)}},vC=.8908130915292852,yC=US(GS/10)/US(7*GS/10),bC=US(KS/10)*yC,xC=-HS(KS/10)*yC,SC={draw(e,n){let r=WS(n*vC),i=bC*r,a=xC*r;e.moveTo(0,-r),e.lineTo(i,a);for(let n=1;n<5;++n){let o=KS*n/5,s=HS(o),c=US(o);e.lineTo(c*r,-s*r),e.lineTo(s*i-c*a,c*i+s*a)}e.closePath()}},CC=WS(3),wC={draw(e,n){let r=-WS(n/(CC*3));e.moveTo(0,r*2),e.lineTo(-CC*r,-r),e.lineTo(CC*r,-r),e.closePath()}},TC=-.5,EC=WS(3)/2,DC=1/WS(12),OC=(DC/2+1)*3,kC={draw(e,n){let r=WS(n/OC),i=r/2,a=r*DC,o=i,s=r*DC+r,c=-o,l=s;e.moveTo(i,a),e.lineTo(o,s),e.lineTo(c,l),e.lineTo(TC*i-EC*a,EC*i+TC*a),e.lineTo(TC*o-EC*s,EC*o+TC*s),e.lineTo(TC*c-EC*l,EC*c+TC*l),e.lineTo(TC*i+EC*a,TC*a-EC*i),e.lineTo(TC*o+EC*s,TC*s-EC*o),e.lineTo(TC*c+EC*l,TC*l-EC*c),e.closePath()}};function AC(e,n){let r=null,i=tC(a);e=typeof e==`function`?e:VS(e||fC),n=typeof n==`function`?n:VS(n===void 0?64:+n);function a(){let a;if(r||=a=i(),e.apply(this,arguments).draw(r,+n.apply(this,arguments)),a)return r=null,a+``||null}return a.type=function(n){return arguments.length?(e=typeof n==`function`?n:VS(n),a):e},a.size=function(e){return arguments.length?(n=typeof e==`function`?e:VS(+e),a):n},a.context=function(e){return arguments.length?(r=e??null,a):r},a}function jC(){}function MC(e,n,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+n)/6,(e._y0+4*e._y1+r)/6)}function NC(e){this._context=e}NC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:MC(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:MC(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function PC(e){return new NC(e)}function FC(e){this._context=e}FC.prototype={areaStart:jC,areaEnd:jC,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._x2=e,this._y2=n;break;case 1:this._point=2,this._x3=e,this._y3=n;break;case 2:this._point=3,this._x4=e,this._y4=n,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+n)/6);break;default:MC(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function IC(e){return new FC(e)}function LC(e){this._context=e}LC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(r,i):this._context.moveTo(r,i);break;case 3:this._point=4;default:MC(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function RC(e){return new LC(e)}function zC(e){this._context=e}zC.prototype={areaStart:jC,areaEnd:jC,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,n){e=+e,n=+n,this._point?this._context.lineTo(e,n):(this._point=1,this._context.moveTo(e,n))}};function BC(e){return new zC(e)}function VC(e){return e<0?-1:1}function HC(e,n,r){var i=e._x1-e._x0,a=n-e._x1,o=(e._y1-e._y0)/(i||a<0&&-0),s=(r-e._y1)/(a||i<0&&-0),c=(o*a+s*i)/(i+a);return(VC(o)+VC(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(c))||0}function UC(e,n){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-n)/2:n}function WC(e,n,r){var i=e._x0,a=e._y0,o=e._x1,s=e._y1,c=(o-i)/3;e._context.bezierCurveTo(i+c,a+c*n,o-c,s-c*r,o,s)}function GC(e){this._context=e}GC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:WC(this,this._t0,UC(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){var r=NaN;if(e=+e,n=+n,!(e===this._x1&&n===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3,WC(this,UC(this,r=HC(this,e,n)),r);break;default:WC(this,this._t0,r=HC(this,e,n));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n,this._t0=r}}};function KC(e){this._context=new qC(e)}(KC.prototype=Object.create(GC.prototype)).point=function(e,n){GC.prototype.point.call(this,n,e)};function qC(e){this._context=e}qC.prototype={moveTo:function(e,n){this._context.moveTo(n,e)},closePath:function(){this._context.closePath()},lineTo:function(e,n){this._context.lineTo(n,e)},bezierCurveTo:function(e,n,r,i,a,o){this._context.bezierCurveTo(n,e,i,r,o,a)}};function JC(e){return new GC(e)}function YC(e){return new KC(e)}function XC(e){this._context=e}XC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,n=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],n[0]):this._context.moveTo(e[0],n[0]),r===2)this._context.lineTo(e[1],n[1]);else for(var i=ZC(e),a=ZC(n),o=0,s=1;s<r;++o,++s)this._context.bezierCurveTo(i[0][o],a[0][o],i[1][o],a[1][o],e[s],n[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,n){this._x.push(+e),this._y.push(+n)}};function ZC(e){var n,r=e.length-1,i,a=Array(r),o=Array(r),s=Array(r);for(a[0]=0,o[0]=2,s[0]=e[0]+2*e[1],n=1;n<r-1;++n)a[n]=1,o[n]=4,s[n]=4*e[n]+2*e[n+1];for(a[r-1]=2,o[r-1]=7,s[r-1]=8*e[r-1]+e[r],n=1;n<r;++n)i=a[n]/o[n-1],o[n]-=i,s[n]-=i*s[n-1];for(a[r-1]=s[r-1]/o[r-1],n=r-2;n>=0;--n)a[n]=(s[n]-a[n+1])/o[n];for(o[r-1]=(e[r]+a[r-1])/2,n=0;n<r-1;++n)o[n]=2*e[n+1]-a[n+1];return[a,o]}function QC(e){return new XC(e)}function $C(e,n){this._context=e,this._t=n}$C.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(e,n);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,n)}break}this._x=e,this._y=n}};function ew(e){return new $C(e,.5)}function tw(e){return new $C(e,0)}function nw(e){return new $C(e,1)}function rw(e,n){if((s=e.length)>1)for(var r=1,i,a,o=e[n[0]],s,c=o.length;r<s;++r)for(a=o,o=e[n[r]],i=0;i<c;++i)o[i][1]+=o[i][0]=isNaN(a[i][1])?a[i][0]:a[i][1]}function iw(e){for(var n=e.length,r=Array(n);--n>=0;)r[n]=n;return r}function aw(e,n){return e[n]}function ow(e){let n=[];return n.key=e,n}function sw(){var e=VS([]),n=iw,r=rw,i=aw;function a(a){var o=Array.from(e.apply(this,arguments),ow),s,c=o.length,l=-1,u;for(let e of a)for(s=0,++l;s<c;++s)(o[s][l]=[0,+i(e,o[s].key,l,a)]).data=e;for(s=0,u=nC(n(o));s<c;++s)o[u[s]].index=s;return r(o,u),o}return a.keys=function(n){return arguments.length?(e=typeof n==`function`?n:VS(Array.from(n)),a):e},a.value=function(e){return arguments.length?(i=typeof e==`function`?e:VS(+e),a):i},a.order=function(e){return arguments.length?(n=e==null?iw:typeof e==`function`?e:VS(Array.from(e)),a):n},a.offset=function(e){return arguments.length?(r=e??rw,a):r},a}function cw(e,n){if((i=e.length)>0){for(var r,i,a=0,o=e[0].length,s;a<o;++a){for(s=r=0;r<i;++r)s+=e[r][a][1]||0;if(s)for(r=0;r<i;++r)e[r][a][1]/=s}rw(e,n)}}function lw(e,n){if((a=e.length)>0){for(var r=0,i=e[n[0]],a,o=i.length;r<o;++r){for(var s=0,c=0;s<a;++s)c+=e[s][r][1]||0;i[r][1]+=i[r][0]=-c/2}rw(e,n)}}function uw(e,n){if(!(!((s=e.length)>0)||!((o=(a=e[n[0]]).length)>0))){for(var r=0,i=1,a,o,s;i<o;++i){for(var c=0,l=0,u=0;c<s;++c){for(var d=e[n[c]],f=d[i][1]||0,p=(f-(d[i-1][1]||0))/2,m=0;m<c;++m){var h=e[n[m]],g=h[i][1]||0,_=h[i-1][1]||0;p+=g-_}l+=f,u+=p*f}a[i-1][1]+=a[i-1][0]=r,l&&(r-=u/l)}a[i-1][1]+=a[i-1][0]=r,rw(e,n)}}var dw=u(BS());function fw(e){"@babel/helpers - typeof";return fw=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fw(e)}var pw=[`type`,`size`,`sizeType`];function mw(){return mw=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},mw.apply(this,arguments)}function hw(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function gw(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]==null?{}:arguments[n];n%2?hw(Object(r),!0).forEach(function(n){_w(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _w(e,n,r){return n=vw(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function vw(e){var n=yw(e,`string`);return fw(n)==`symbol`?n:n+``}function yw(e,n){if(fw(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(fw(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function bw(e,n){if(e==null)return{};var r=xw(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function xw(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}var Sw={symbolCircle:fC,symbolCross:pC,symbolDiamond:gC,symbolSquare:_C,symbolStar:SC,symbolTriangle:wC,symbolWye:kC},Cw=Math.PI/180,ww=function(e){return Sw[`symbol${(0,dw.default)(e)}`]||fC},Tw=function(e,n,r){if(n===`area`)return e;switch(r){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var i=18*Cw;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.tan(i)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Ew=function(e,n){Sw[`symbol${(0,dw.default)(e)}`]=n},Dw=function(e){var n=e.type,r=n===void 0?`circle`:n,i=e.size,a=i===void 0?64:i,o=e.sizeType,s=o===void 0?`area`:o,c=gw(gw({},bw(e,pw)),{},{type:r,size:a,sizeType:s}),l=function(){var e=ww(r);return AC().type(e).size(Tw(a,s,r))()},u=c.className,d=c.cx,f=c.cy,p=hS(c,!0);return d===+d&&f===+f&&a===+a?y.createElement(`path`,mw({},p,{className:Zd(`recharts-symbols`,u),transform:`translate(${d}, ${f})`,d:l()})):null};Dw.registerSymbol=Ew;function Ow(e){"@babel/helpers - typeof";return Ow=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ow(e)}function kw(){return kw=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},kw.apply(this,arguments)}function Aw(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function jw(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]==null?{}:arguments[n];n%2?Aw(Object(r),!0).forEach(function(n){Vw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Aw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mw(e,n){if(!(e instanceof n))throw TypeError(`Cannot call a class as a function`)}function Nw(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,`value`in i&&(i.writable=!0),Object.defineProperty(e,Hw(i.key),i)}}function Pw(e,n,r){return n&&Nw(e.prototype,n),r&&Nw(e,r),Object.defineProperty(e,`prototype`,{writable:!1}),e}function Fw(e,n,r){return n=zw(n),Iw(e,Rw()?Reflect.construct(n,r||[],zw(e).constructor):n.apply(e,r))}function Iw(e,n){if(n&&(Ow(n)===`object`||typeof n==`function`))return n;if(n!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Lw(e)}function Lw(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Rw(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Rw=function(){return!!e})()}function zw(e){return zw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zw(e)}function ite(e,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),n&&Bw(e,n)}function Bw(e,n){return Bw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Bw(e,n)}function Vw(e,n,r){return n=Hw(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Hw(e){var n=ate(e,`string`);return Ow(n)==`symbol`?n:n+``}function ate(e,n){if(Ow(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(Ow(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var Uw=32,Ww=function(e){function n(){return Mw(this,n),Fw(this,n,arguments)}return ite(n,e),Pw(n,[{key:`renderIcon`,value:function(e){var n=this.props.inactiveColor,r=Uw/2,i=Uw/6,a=Uw/3,o=e.inactive?n:e.color;if(e.type===`plainline`)return y.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:o,strokeDasharray:e.payload.strokeDasharray,x1:0,y1:r,x2:Uw,y2:r,className:`recharts-legend-icon`});if(e.type===`line`)return y.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:o,d:`M0,${r}h${a}
|
|
19
|
+
`+r)}}catch{}}throw e}}_request(e,n){typeof e==`string`?(n||={},n.url=e):n=e||{},n=py(this.defaults,n);let{transitional:r,paramsSerializer:i,headers:a}=n;r!==void 0&&Fy.assertOptions(r,{silentJSONParsing:Iy.transitional(Iy.boolean),forcedJSONParsing:Iy.transitional(Iy.boolean),clarifyTimeoutError:Iy.transitional(Iy.boolean),legacyInterceptorReqResOrdering:Iy.transitional(Iy.boolean)},!1),i!=null&&(J.isFunction(i)?n.paramsSerializer={serialize:i}:Fy.assertOptions(i,{encode:Iy.function,serialize:Iy.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?n.allowAbsoluteUrls=!0:n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),Fy.assertOptions(n,{baseUrl:Iy.spelling(`baseURL`),withXsrfToken:Iy.spelling(`withXSRFToken`)},!0),n.method=(n.method||this.defaults.method||`get`).toLowerCase();let o=a&&J.merge(a.common,a[n.method]);a&&J.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete a[e]}),n.headers=Xv.concat(o,a);let s=[],c=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(n)===!1)return;c&&=e.synchronous;let r=n.transitional||Sv;r&&r.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)});let l=[];this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let u,d=0,f;if(!c){let e=[jy.bind(this),void 0];for(e.unshift(...s),e.push(...l),f=e.length,u=Promise.resolve(n);d<f;)u=u.then(e[d++],e[d++]);return u}f=s.length;let p=n;for(;d<f;){let e=s[d++],n=s[d++];try{p=e(p)}catch(e){n.call(this,e);break}}try{u=jy.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,f=l.length;d<f;)u=u.then(l[d++],l[d++]);return u}getUri(e){return e=py(this.defaults,e),bv(dy(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};J.forEach([`delete`,`get`,`head`,`options`],function(e){Ly.prototype[e]=function(n,r){return this.request(py(r||{},{method:e,url:n,data:(r||{}).data}))}}),J.forEach([`post`,`put`,`patch`],function(e){function n(n){return function(r,i,a){return this.request(py(a||{},{method:e,headers:n?{"Content-Type":`multipart/form-data`}:{},url:r,data:i}))}}Ly.prototype[e]=n(),Ly.prototype[e+`Form`]=n(!0)});var Xee=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let n;this.promise=new Promise(function(e){n=e});let r=this;this.promise.then(e=>{if(!r._listeners)return;let n=r._listeners.length;for(;n-- >0;)r._listeners[n](e);r._listeners=null}),this.promise.then=e=>{let n,i=new Promise(e=>{r.subscribe(e),n=e}).then(e);return i.cancel=function(){r.unsubscribe(n)},i},e(function(e,i,a){r.reason||(r.reason=new $v(e,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){let e=new AbortController,n=n=>{e.abort(n)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let n;return{token:new e(function(e){n=e}),cancel:n}}};function Zee(e){return function(n){return e.apply(null,n)}}function Qee(e){return J.isObject(e)&&e.isAxiosError===!0}var Ry={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ry).forEach(([e,n])=>{Ry[n]=e});function zy(e){let n=new Ly(e),r=s_(Ly.prototype.request,n);return J.extend(r,Ly.prototype,n,{allOwnKeys:!0}),J.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return zy(py(e,n))},r}var By=zy(Iv);By.Axios=Ly,By.CanceledError=$v,By.CancelToken=Xee,By.isCancel=Qv,By.VERSION=My,By.toFormData=hv,By.AxiosError=lv,By.Cancel=By.CanceledError,By.all=function(e){return Promise.all(e)},By.spread=Zee,By.isAxiosError=Qee,By.mergeConfig=py,By.AxiosHeaders=Xv,By.formToJSON=e=>Pv(J.isHTMLForm(e)?new FormData(e):e),By.getAdapter=ky.getAdapter,By.HttpStatusCode=Ry,By.default=By;var $ee=typeof window<`u`&&window.__OMEM_API_URL__&&window.__OMEM_API_URL__!==`__OMEM_API_URL__`?window.__OMEM_API_URL__:`/`,Vy=By.create({baseURL:$ee,timeout:3e4,headers:{"Content-Type":`application/json`}});Vy.interceptors.request.use(e=>{let n=dh.getState().users.find(e=>e.id===dh.getState().currentUserId);return n?.apiKey&&(e.headers[`X-API-Key`]=n.apiKey,e.headers[`X-Agent-ID`]=`omem-web`),e.data instanceof FormData&&delete e.headers[`Content-Type`],e}),Vy.interceptors.response.use(e=>e.data,e=>(e.response?.status===401&&(dh.getState().logout(),window.location.href=`/login`),Promise.reject(e)));function ete(){let e=et(),{users:n,currentUserId:r,logout:i}=dh(),a=n.find(e=>e.id===r),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(Date.now());return(0,y.useEffect)(()=>{let e=async()=>{try{await Vy.get(`/health`),s(!0),l(Date.now())}catch{s(!1)}};e();let n=setInterval(e,3e4);return()=>clearInterval(n)},[]),(0,G.jsxs)(`header`,{className:`flex h-14 items-center justify-between border-b border-border bg-card px-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(cee,{}),(0,G.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground truncate max-w-[120px] md:max-w-none`,children:a?.spaceName||a?.name||`未登录`}),(0,G.jsx)(Dp,{children:(0,G.jsxs)(Op,{children:[(0,G.jsx)(kp,{children:(0,G.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${o?`bg-[#22c55e] animate-pulse`:`bg-[#ef4444]`}`})}),(0,G.jsx)(Ap,{children:o?`连接正常 - 上次心跳: ${Math.round((Date.now()-c)/1e3)}秒前`:`连接断开`})]})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ch,{}),(0,G.jsxs)(t_,{children:[(0,G.jsxs)(n_,{className:`flex items-center gap-1.5 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,G.jsx)(fee,{className:`h-7 w-7`,children:(0,G.jsx)(pee,{className:`text-xs bg-primary/10 text-primary`,children:(0,G.jsx)(Zm,{className:`h-3.5 w-3.5`})})}),(0,G.jsx)(Zp,{className:`h-3 w-3 text-muted-foreground`})]}),(0,G.jsxs)(r_,{align:`end`,className:`w-48`,children:[(0,G.jsx)(i_,{children:(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:a?.spaceName||`用户`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground truncate max-w-[180px]`,children:a?.apiKey?`${a.apiKey.slice(0,8)}...`:`未登录`})]})}),(0,G.jsx)(o_,{}),(0,G.jsxs)(a_,{onClick:()=>e(`/profile`),children:[(0,G.jsx)(Zm,{className:`size-4 mr-2`}),`用户画像`]}),(0,G.jsxs)(a_,{onClick:()=>e(`/settings`),children:[(0,G.jsx)(Rm,{className:`size-4 mr-2`}),`系统设置`]}),(0,G.jsx)(o_,{}),(0,G.jsxs)(a_,{variant:`destructive`,onClick:()=>{i(),e(`/login`)},children:[(0,G.jsx)(tee,{className:`size-4 mr-2`}),`退出登录`]})]})]})]})]})}function Hy(){return(0,G.jsx)(`footer`,{className:`border-t border-border bg-card px-4 py-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-4 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:`© 2026 Cerebro`}),(0,G.jsx)(`a`,{href:`https://beian.miit.gov.cn/`,target:`_blank`,rel:`noopener noreferrer`,className:`hover:text-foreground transition-colors`,children:`吉ICP备2026003061号`})]})})}var Uy=ch((e,n)=>({isUnlocked:!1,hasPassword:!1,isLoading:!1,checkStatus:async()=>{try{e({hasPassword:(await Vy.get(`/v1/vault/status`)).has_password})}catch{e({hasPassword:!1})}},setPassword:async n=>{e({isLoading:!0});try{await Vy.post(`/v1/vault/password`,{password:n}),e({isUnlocked:!0,hasPassword:!0})}finally{e({isLoading:!1})}},verifyPassword:async e=>{try{return(await Vy.post(`/v1/vault/verify`,{password:e})).valid}catch{return!1}},unlock:async r=>{let i=await n().verifyPassword(r);return i&&e({isUnlocked:!0}),i},lock:()=>e({isUnlocked:!1})}));function tte(){let e=et(),n=dh(e=>e.isAuthenticated),r=Uy(e=>e.checkStatus),[i,a]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{n&&r().then(()=>{a(!Uy.getState().hasPassword)})},[r,n]),(0,G.jsxs)(`div`,{className:`flex h-screen w-full bg-background text-foreground`,children:[(0,G.jsx)(`div`,{className:`hidden md:flex`,children:(0,G.jsx)(nh,{})}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col min-w-0`,children:[(0,G.jsx)(ete,{}),i&&(0,G.jsx)(`div`,{className:`bg-amber-500/10 border-b border-amber-500/20 px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between max-w-3xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-amber-700 dark:text-amber-400`,children:[(0,G.jsx)(Jm,{className:`size-4 shrink-0`}),(0,G.jsx)(`span`,{children:`为了您的隐私安全,请先设置私密密码`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(q,{variant:`link`,size:`sm`,className:`h-auto p-0 text-amber-700 dark:text-amber-400 font-medium`,onClick:()=>e(`/vault`),children:`去设置 →`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(!1),className:`text-amber-700/60 dark:text-amber-400/60 hover:text-amber-700 dark:hover:text-amber-400`,children:(0,G.jsx)($m,{className:`size-4`})})]})]})}),(0,G.jsx)(`main`,{className:`flex-1 overflow-auto p-4 md:p-6`,children:(0,G.jsx)(kt,{})}),(0,G.jsx)(Hy,{})]})]})}var Wy=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),nte={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Gy={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},rte={disabled:!1,...Gy},Ky={valid(e){return e===null?null:e?{[Wy.valid]:``}:{[Wy.invalid]:``}}},qy=y.createContext({invalid:void 0,name:void 0,validityData:{state:nte,errors:[],error:``,value:``,initialValue:null},setValidityData:pi,disabled:void 0,touched:Gy.touched,setTouched:pi,dirty:Gy.dirty,setDirty:pi,filled:Gy.filled,setFilled:pi,focused:Gy.focused,setFocused:pi,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:rte,markedDirtyRef:{current:!1},registerFieldControl:pi,validation:{getValidationProps:(e=hi)=>e,getInputValidationProps:(e=hi)=>e,inputRef:{current:null},commit:async()=>{}}});function Jy(e=!0){let n=y.useContext(qy);if(n.setValidityData===pi&&!e)throw Error(Ir(28));return n}var Yy=y.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:pi,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Xy(){return y.useContext(Yy)}var Zy=y.createContext({controlId:void 0,registerControlId:pi,labelId:void 0,setLabelId:pi,messageIds:[],setMessageIds:pi,getDescriptionProps:e=>e});function Qy(){return y.useContext(Zy)}function $y(e,n){let{enabled:r=!0,getValue:i,id:a,value:o}=n,{registerFieldControl:s}=Jy(),c=y.useRef(null);c.current||=Symbol(),Pr(()=>{let n=c.current;if(!(!n||!r))return s(n,{controlRef:e,getValue:i,id:a,value:o}),()=>{s(n,void 0)}},[e,r,i,a,s,o])}function eb(e={}){let{id:n,implicit:r=!1,controlRef:i}=e,{controlId:a,registerControlId:o}=Qy(),s=yd(n),c=r?a:void 0,l=Tr(()=>Symbol(`labelable-control`)),u=y.useRef(!1),d=y.useRef(n!=null),f=Ca(()=>{!u.current||o===pi||(u.current=!1,o(l.current,void 0))});return Pr(()=>{if(o===pi)return;let e;if(r){let r=i?.current;e=Gi(r)&&r.closest(`label`)!=null?n??null:c??s}else if(n!=null)d.current=!0,e=n;else if(d.current)e=s;else{f();return}if(e===void 0){f();return}u.current=!0,o(l.current,e)},[n,i,c,o,r,s,l,f]),y.useEffect(()=>f,[f]),a??s}var tb=y.forwardRef(function(e,n){let{render:r,className:i,id:a,name:o,value:s,disabled:c=!1,onValueChange:l,defaultValue:u,autoFocus:d=!1,style:f,...p}=e,{state:m,name:h,disabled:g,setTouched:_,setDirty:v,validityData:b,setFocused:x,setFilled:S,validationMode:C,validation:w}=Jy(),T=g||c,E=h??o,D={...m,disabled:T},{labelId:O}=Qy(),k=eb({id:a});Pr(()=>{let e=s!=null;w.inputRef.current?.value||e&&s!==``?S(!0):e&&s===``&&S(!1)},[w.inputRef,S,s]);let A=y.useRef(null);Pr(()=>{d&&A.current===Va(Aa(A.current))&&x(!0)},[d,x]);let[j]=Mg({controlled:s,default:u,name:`FieldControl`,state:`value`}),M=s!==void 0,N=M?j:void 0,P=Ca(()=>w.inputRef.current?.value);return $y(w.inputRef,{id:k,value:N,getValue:P}),Qs(`input`,e,{ref:[n,A],state:D,props:[{id:k,disabled:T,name:E,ref:w.inputRef,"aria-labelledby":O,autoFocus:d,...M?{value:N}:{defaultValue:u},onChange(e){let n=e.currentTarget.value;l?.(n,Ii(xi,e.nativeEvent)),v(n!==b.initialValue),S(n!==``)},onFocus(){x(!0)},onBlur(e){_(!0),x(!1),C===`onBlur`&&w.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(_(!0),w.commit(e.currentTarget.value))}},w.getInputValidationProps(),p],stateAttributesMapping:Ky})}),nb=y.createContext({disabled:!1});function rb(){return y.useContext(nb)}var ib=y.createContext(void 0);function ab(e=!0){let n=y.useContext(ib);if(n===void 0&&!e)throw Error(Ir(3));return n}var ob=y.forwardRef(function(e,n){return(0,G.jsx)(tb,{ref:n,...e})});function sb({className:e,type:n,...r}){return(0,G.jsx)(ob,{type:n,"data-slot":`input`,className:Tp(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...r})}function cb({className:e,...n}){return(0,G.jsx)(`label`,{"data-slot":`label`,className:Tp(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...n})}function lb(){let e=[{cx:250,cy:250,r:8},{cx:160,cy:130,r:4},{cx:360,cy:140,r:3},{cx:390,cy:290,r:5},{cx:330,cy:390,r:3},{cx:170,cy:400,r:4},{cx:110,cy:290,r:3},{cx:200,cy:80,r:5},{cx:310,cy:210,r:3},{cx:140,cy:220,r:3},{cx:280,cy:340,r:3},{cx:420,cy:240,r:3}];return(0,G.jsxs)(`svg`,{viewBox:`0 0 500 500`,className:`w-full h-full`,children:[(0,G.jsx)(`title`,{children:`Memory Network`}),(0,G.jsxs)(`defs`,{children:[(0,G.jsxs)(`radialGradient`,{id:`netGlow`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,G.jsx)(`stop`,{offset:`0%`,stopColor:`#c9a227`,stopOpacity:`0.18`}),(0,G.jsx)(`stop`,{offset:`50%`,stopColor:`#c9a227`,stopOpacity:`0.05`}),(0,G.jsx)(`stop`,{offset:`100%`,stopColor:`#c9a227`,stopOpacity:`0`})]}),(0,G.jsxs)(`filter`,{id:`glow`,children:[(0,G.jsx)(`feGaussianBlur`,{stdDeviation:`2`,result:`blur`}),(0,G.jsxs)(`feMerge`,{children:[(0,G.jsx)(`feMergeNode`,{in:`blur`}),(0,G.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,G.jsx)(`circle`,{cx:`250`,cy:`250`,r:`210`,fill:`url(#netGlow)`,children:(0,G.jsx)(`animate`,{attributeName:`r`,values:`210;230;210`,dur:`8s`,repeatCount:`indefinite`})}),(0,G.jsx)(`circle`,{cx:`250`,cy:`250`,r:`130`,fill:`none`,stroke:`#c9a227`,strokeWidth:`0.4`,opacity:`0.12`,children:(0,G.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,from:`0 250 250`,to:`360 250 250`,dur:`60s`,repeatCount:`indefinite`})}),(0,G.jsx)(`circle`,{cx:`250`,cy:`250`,r:`175`,fill:`none`,stroke:`#c9a227`,strokeWidth:`0.25`,opacity:`0.08`,children:(0,G.jsx)(`animateTransform`,{attributeName:`transform`,type:`rotate`,from:`360 250 250`,to:`0 250 250`,dur:`90s`,repeatCount:`indefinite`})}),[[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,9],[0,10],[0,11],[1,7],[1,9],[2,7],[2,8],[3,8],[3,4],[4,10],[5,10],[5,6],[6,9],[8,11],[3,11]].map(([n,r],i)=>(0,G.jsx)(`line`,{x1:e[n].cx,y1:e[n].cy,x2:e[r].cx,y2:e[r].cy,stroke:`#c9a227`,strokeWidth:`0.5`,opacity:`0.25`,children:(0,G.jsx)(`animate`,{attributeName:`opacity`,values:`0.25;0.5;0.25`,dur:`${3+i%4}s`,repeatCount:`indefinite`})},`conn-${n}-${r}`)),e.map((e,n)=>(0,G.jsxs)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,fill:`#c9a227`,opacity:n===0?1:.65,filter:n===0?`url(#glow)`:void 0,children:[(0,G.jsx)(`animate`,{attributeName:`r`,values:`${e.r};${e.r*1.5};${e.r}`,dur:`${2+n%3}s`,repeatCount:`indefinite`}),n===0&&(0,G.jsx)(`animate`,{attributeName:`opacity`,values:`1;0.6;1`,dur:`3s`,repeatCount:`indefinite`})]},`node-${e.cx}-${e.cy}`))]})}var ub=[{icon:qp,label:`永久记忆`},{icon:eh,label:`瞬间调取`},{icon:Rm,label:`隐私安全`}];function db(){let e=et(),{users:n,currentUserId:r,addUser:i,setCurrentUser:a,removeUser:o}=dh(),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(!1),h=async r=>{r.preventDefault(),f(``),u(!0);try{let r=window.__OMEM_API_URL__&&window.__OMEM_API_URL__!==`__OMEM_API_URL__`?window.__OMEM_API_URL__:window.location.origin,o=By.create({baseURL:r,headers:{"X-API-Key":s},timeout:1e4});if((await o.get(`/health`)).status!==200)throw Error(`health check failed`);let c=`默认空间`,l=(await o.get(`/v1/spaces`)).data,u=Array.isArray(l)?l:l?.spaces||[];u.length>0&&u[0].name&&(c=u[0].name);let d=n.find(e=>e.apiKey===s);if(d){a(d.id),e(`/dashboard`);return}i({id:crypto.randomUUID(),name:c,apiKey:s,apiUrl:r,lastUsed:new Date().toISOString(),spaceName:c}),e(`/dashboard`)}catch{f(`验证失败,请检查 API Key 是否正确`)}finally{u(!1)}},g=n=>{a(n.id),e(`/dashboard`)},_=(e,n)=>{e.stopPropagation(),o(n)};return(0,G.jsxs)(`div`,{className:`dark min-h-screen bg-[#070708] grid lg:grid-cols-[55%_45%]`,children:[(0,G.jsxs)(`div`,{className:`hidden lg:flex flex-col justify-between relative overflow-hidden p-12`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03]`,style:{backgroundImage:`radial-gradient(circle at 1px 1px, rgba(255,255,255,0.4) 1px, transparent 0)`,backgroundSize:`40px 40px`}}),(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center scale-110`,children:(0,G.jsx)(lb,{})}),(0,G.jsxs)(`div`,{className:`relative z-10 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-[#c9a227]/10 border border-[#c9a227]/20`,children:(0,G.jsx)(qp,{className:`h-5 w-5 text-[#c9a227]`})}),(0,G.jsx)(`span`,{className:`text-xl font-bold tracking-tight text-white`,children:`Cerebro`})]}),(0,G.jsxs)(`div`,{className:`relative z-10 space-y-8`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-[#c9a227]/20 bg-[#c9a227]/5 px-3 py-1 text-xs font-medium text-[#c9a227]`,children:[(0,G.jsx)(Bm,{className:`h-3 w-3`}),`AI 记忆引擎`]}),(0,G.jsxs)(`h1`,{className:`text-5xl font-bold tracking-tight text-white leading-[1.1]`,children:[`让 AI 记住`,(0,G.jsx)(`br`,{}),(0,G.jsx)(`span`,{className:`text-[#c9a227]`,children:`你的一切`})]}),(0,G.jsxs)(`p`,{className:`text-lg text-white/40 max-w-sm leading-relaxed`,children:[`你的第二大脑,永远在线。`,(0,G.jsx)(`br`,{}),`每一次对话,都值得被铭记。`]})]}),(0,G.jsx)(`div`,{className:`flex gap-6`,children:ub.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-white/40`,children:[(0,G.jsx)(e.icon,{className:`h-4 w-4 text-[#c9a227]/70`}),e.label]},e.label))})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col min-h-screen`,children:[(0,G.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-6`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,G.jsxs)(`div`,{className:`lg:hidden text-center space-y-4 mb-2`,children:[(0,G.jsx)(`div`,{className:`inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-[#c9a227]/10 border border-[#c9a227]/20`,children:(0,G.jsx)(qp,{className:`h-7 w-7 text-[#c9a227]`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:`Cerebro`}),(0,G.jsx)(`p`,{className:`text-sm text-white/40 mt-1`,children:`让 AI 记住你的一切`})]})]}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-white/[0.08] bg-white/[0.03] backdrop-blur-xl p-6 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold text-white`,children:`欢迎回来`}),(0,G.jsx)(`p`,{className:`text-sm text-white/40`,children:`输入 API Key 以访问您的记忆库`})]}),(0,G.jsxs)(`form`,{onSubmit:h,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(cb,{htmlFor:`apiKey`,className:`text-white/70`,children:`API Key`}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(xm,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-white/30`}),(0,G.jsx)(sb,{id:`apiKey`,type:p?`text`:`password`,placeholder:`输入您的 Cerebro API Key`,value:s,onChange:e=>c(e.target.value),className:`pl-9 pr-10 bg-white/[0.05] border-white/10 text-white placeholder:text-white/25 focus:border-[#c9a227]/50 focus:ring-[#c9a227]/20`,disabled:l,required:!0}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`absolute right-3 top-1/2 -translate-y-1/2 text-white/30 hover:text-white/70 transition-colors`,tabIndex:-1,children:p?(0,G.jsx)(sm,{className:`h-4 w-4`}):(0,G.jsx)(cm,{className:`h-4 w-4`})})]})]}),d&&(0,G.jsx)(`div`,{className:`rounded-lg bg-red-500/10 border border-red-500/20 p-3 text-sm text-red-400`,children:d}),(0,G.jsx)(q,{type:`submit`,disabled:l||!s,className:`w-full bg-[#c9a227] hover:bg-[#d4b43a] text-[#070708] font-semibold transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:l?(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`h-4 w-4 border-2 border-[#070708]/30 border-t-[#070708] rounded-full animate-spin`}),`验证中...`]}):(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`验证并登录`,(0,G.jsx)(Hp,{className:`h-4 w-4`})]})})]})]}),n.length>0&&(0,G.jsxs)(`div`,{className:`rounded-2xl border border-white/[0.08] bg-white/[0.03] backdrop-blur-xl p-6 space-y-4`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-white/70`,children:`已保存的账号`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>(0,G.jsxs)(`div`,{className:`group flex w-full items-center rounded-xl border transition-all overflow-hidden ${r===e.id?`border-[#c9a227]/30 bg-[#c9a227]/5`:`border-white/10 bg-white/[0.03] hover:border-white/20 hover:bg-white/[0.06]`}`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g(e),className:`flex flex-1 items-center gap-3 p-3 text-left min-w-0`,children:[(0,G.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition-colors ${r===e.id?`bg-[#c9a227] text-[#070708]`:`bg-white/10 text-white/40`}`,children:r===e.id?(0,G.jsx)(Xp,{className:`h-4 w-4`}):(0,G.jsx)(xm,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-0.5 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-white/90 truncate`,children:e.spaceName||e.name}),(0,G.jsx)(`p`,{className:`text-xs text-white/35`,children:Ep(e.apiKey)})]})]}),(0,G.jsx)(`div`,{className:`p-2 opacity-0 transition-opacity group-hover:opacity-100`,children:(0,G.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:n=>{n.stopPropagation(),_(n,e.id)},disabled:e.id===r,className:`h-8 w-8 disabled:opacity-0 disabled:cursor-not-allowed text-white/40 hover:text-red-400 hover:bg-red-500/10`,title:e.id===r?`当前使用的账号无法删除`:`删除账号`,children:(0,G.jsx)(Km,{className:`h-3.5 w-3.5`})})})]},e.id))})]})]})}),(0,G.jsx)(Hy,{})]})]})}function fb({className:e,size:n=`default`,...r}){return(0,G.jsx)(`div`,{"data-slot":`card`,"data-size":n,className:Tp(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...r})}function pb({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`card-header`,className:Tp(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...n})}function mb({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`card-title`,className:Tp(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...n})}function hb({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`card-description`,className:Tp(`text-sm text-muted-foreground`,e),...n})}function gb({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`card-content`,className:Tp(`px-4 group-data-[size=sm]/card:px-3`,e),...n})}function _b({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`skeleton`,className:Tp(`animate-pulse rounded-md bg-muted`,e),...n})}var vb=s(((e,n)=>{n.exports=Array.isArray})),yb=s(((e,n)=>{n.exports=typeof global==`object`&&global&&global.Object===Object&&global})),bb=s(((e,n)=>{var r=yb(),i=typeof self==`object`&&self&&self.Object===Object&&self;n.exports=r||i||Function(`return this`)()})),xb=s(((e,n)=>{n.exports=bb().Symbol})),Sb=s(((e,n)=>{var r=xb(),i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=r?r.toStringTag:void 0;function c(e){var n=a.call(e,s),r=e[s];try{e[s]=void 0;var i=!0}catch{}var c=o.call(e);return i&&(n?e[s]=r:delete e[s]),c}n.exports=c})),Cb=s(((e,n)=>{var r=Object.prototype.toString;function i(e){return r.call(e)}n.exports=i})),wb=s(((e,n)=>{var r=xb(),i=Sb(),a=Cb(),o=`[object Null]`,s=`[object Undefined]`,c=r?r.toStringTag:void 0;function l(e){return e==null?e===void 0?s:o:c&&c in Object(e)?i(e):a(e)}n.exports=l})),Tb=s(((e,n)=>{function r(e){return typeof e==`object`&&!!e}n.exports=r})),Eb=s(((e,n)=>{var r=wb(),i=Tb(),a=`[object Symbol]`;function o(e){return typeof e==`symbol`||i(e)&&r(e)==a}n.exports=o})),Db=s(((e,n)=>{var r=vb(),i=Eb(),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;function s(e,n){if(r(e))return!1;var s=typeof e;return s==`number`||s==`symbol`||s==`boolean`||e==null||i(e)?!0:o.test(e)||!a.test(e)||n!=null&&e in Object(n)}n.exports=s})),Ob=s(((e,n)=>{function r(e){var n=typeof e;return e!=null&&(n==`object`||n==`function`)}n.exports=r})),kb=s(((e,n)=>{var r=wb(),i=Ob(),a=`[object AsyncFunction]`,o=`[object Function]`,s=`[object GeneratorFunction]`,c=`[object Proxy]`;function l(e){if(!i(e))return!1;var n=r(e);return n==o||n==s||n==a||n==c}n.exports=l})),Ab=s(((e,n)=>{n.exports=bb()[`__core-js_shared__`]})),jb=s(((e,n)=>{var r=Ab(),i=function(){var e=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function a(e){return!!i&&i in e}n.exports=a})),Mb=s(((e,n)=>{var r=Function.prototype.toString;function i(e){if(e!=null){try{return r.call(e)}catch{}try{return e+``}catch{}}return``}n.exports=i})),Nb=s(((e,n)=>{var r=kb(),i=jb(),a=Ob(),o=Mb(),s=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,d=l.toString,f=u.hasOwnProperty,p=RegExp(`^`+d.call(f).replace(s,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function m(e){return!a(e)||i(e)?!1:(r(e)?p:c).test(o(e))}n.exports=m})),Pb=s(((e,n)=>{function r(e,n){return e?.[n]}n.exports=r})),Fb=s(((e,n)=>{var r=Nb(),i=Pb();function a(e,n){var a=i(e,n);return r(a)?a:void 0}n.exports=a})),Ib=s(((e,n)=>{n.exports=Fb()(Object,`create`)})),Lb=s(((e,n)=>{var r=Ib();function i(){this.__data__=r?r(null):{},this.size=0}n.exports=i})),Rb=s(((e,n)=>{function r(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=+!!n,n}n.exports=r})),zb=s(((e,n)=>{var r=Ib(),i=`__lodash_hash_undefined__`,a=Object.prototype.hasOwnProperty;function o(e){var n=this.__data__;if(r){var o=n[e];return o===i?void 0:o}return a.call(n,e)?n[e]:void 0}n.exports=o})),Bb=s(((e,n)=>{var r=Ib(),i=Object.prototype.hasOwnProperty;function a(e){var n=this.__data__;return r?n[e]!==void 0:i.call(n,e)}n.exports=a})),Vb=s(((e,n)=>{var r=Ib(),i=`__lodash_hash_undefined__`;function a(e,n){var a=this.__data__;return this.size+=+!this.has(e),a[e]=r&&n===void 0?i:n,this}n.exports=a})),Hb=s(((e,n)=>{var r=Lb(),i=Rb(),a=zb(),o=Bb(),s=Vb();function c(e){var n=-1,r=e==null?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,n.exports=c})),Ub=s(((e,n)=>{function r(){this.__data__=[],this.size=0}n.exports=r})),Wb=s(((e,n)=>{function r(e,n){return e===n||e!==e&&n!==n}n.exports=r})),Gb=s(((e,n)=>{var r=Wb();function i(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}n.exports=i})),Kb=s(((e,n)=>{var r=Gb(),i=Array.prototype.splice;function a(e){var n=this.__data__,a=r(n,e);return a<0?!1:(a==n.length-1?n.pop():i.call(n,a,1),--this.size,!0)}n.exports=a})),qb=s(((e,n)=>{var r=Gb();function i(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}n.exports=i})),Jb=s(((e,n)=>{var r=Gb();function i(e){return r(this.__data__,e)>-1}n.exports=i})),Yb=s(((e,n)=>{var r=Gb();function i(e,n){var i=this.__data__,a=r(i,e);return a<0?(++this.size,i.push([e,n])):i[a][1]=n,this}n.exports=i})),Xb=s(((e,n)=>{var r=Ub(),i=Kb(),a=qb(),o=Jb(),s=Yb();function c(e){var n=-1,r=e==null?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,n.exports=c})),Zb=s(((e,n)=>{n.exports=Fb()(bb(),`Map`)})),Qb=s(((e,n)=>{var r=Hb(),i=Xb(),a=Zb();function o(){this.size=0,this.__data__={hash:new r,map:new(a||i),string:new r}}n.exports=o})),$b=s(((e,n)=>{function r(e){var n=typeof e;return n==`string`||n==`number`||n==`symbol`||n==`boolean`?e!==`__proto__`:e===null}n.exports=r})),ex=s(((e,n)=>{var r=$b();function i(e,n){var i=e.__data__;return r(n)?i[typeof n==`string`?`string`:`hash`]:i.map}n.exports=i})),tx=s(((e,n)=>{var r=ex();function i(e){var n=r(this,e).delete(e);return this.size-=+!!n,n}n.exports=i})),nx=s(((e,n)=>{var r=ex();function i(e){return r(this,e).get(e)}n.exports=i})),rx=s(((e,n)=>{var r=ex();function i(e){return r(this,e).has(e)}n.exports=i})),ix=s(((e,n)=>{var r=ex();function i(e,n){var i=r(this,e),a=i.size;return i.set(e,n),this.size+=i.size==a?0:1,this}n.exports=i})),ax=s(((e,n)=>{var r=Qb(),i=tx(),a=nx(),o=rx(),s=ix();function c(e){var n=-1,r=e==null?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,n.exports=c})),ox=s(((e,n)=>{var r=ax(),i=`Expected a function`;function a(e,n){if(typeof e!=`function`||n!=null&&typeof n!=`function`)throw TypeError(i);var o=function(){var r=arguments,i=n?n.apply(this,r):r[0],a=o.cache;if(a.has(i))return a.get(i);var s=e.apply(this,r);return o.cache=a.set(i,s)||a,s};return o.cache=new(a.Cache||r),o}a.Cache=r,n.exports=a})),sx=s(((e,n)=>{var r=ox(),i=500;function a(e){var n=r(e,function(e){return a.size===i&&a.clear(),e}),a=n.cache;return n}n.exports=a})),cx=s(((e,n)=>{var r=sx(),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g;n.exports=r(function(e){var n=[];return e.charCodeAt(0)===46&&n.push(``),e.replace(i,function(e,r,i,o){n.push(i?o.replace(a,`$1`):r||e)}),n})})),lx=s(((e,n)=>{function r(e,n){for(var r=-1,i=e==null?0:e.length,a=Array(i);++r<i;)a[r]=n(e[r],r,e);return a}n.exports=r})),ux=s(((e,n)=>{var r=xb(),i=lx(),a=vb(),o=Eb(),s=1/0,c=r?r.prototype:void 0,l=c?c.toString:void 0;function u(e){if(typeof e==`string`)return e;if(a(e))return i(e,u)+``;if(o(e))return l?l.call(e):``;var n=e+``;return n==`0`&&1/e==-s?`-0`:n}n.exports=u})),dx=s(((e,n)=>{var r=ux();function i(e){return e==null?``:r(e)}n.exports=i})),fx=s(((e,n)=>{var r=vb(),i=Db(),a=cx(),o=dx();function s(e,n){return r(e)?e:i(e,n)?[e]:a(o(e))}n.exports=s})),px=s(((e,n)=>{var r=Eb(),i=1/0;function a(e){if(typeof e==`string`||r(e))return e;var n=e+``;return n==`0`&&1/e==-i?`-0`:n}n.exports=a})),mx=s(((e,n)=>{var r=fx(),i=px();function a(e,n){n=r(n,e);for(var a=0,o=n.length;e!=null&&a<o;)e=e[i(n[a++])];return a&&a==o?e:void 0}n.exports=a})),hx=s(((e,n)=>{var r=mx();function i(e,n,i){var a=e==null?void 0:r(e,n);return a===void 0?i:a}n.exports=i})),gx=s(((e,n)=>{function r(e){return e==null}n.exports=r})),_x=s(((e,n)=>{var r=wb(),i=vb(),a=Tb(),o=`[object String]`;function s(e){return typeof e==`string`||!i(e)&&a(e)&&r(e)==o}n.exports=s})),vx=s((e=>{var n=Symbol.for(`react.element`),r=Symbol.for(`react.portal`),i=Symbol.for(`react.fragment`),a=Symbol.for(`react.strict_mode`),o=Symbol.for(`react.profiler`),s=Symbol.for(`react.provider`),c=Symbol.for(`react.context`),l=Symbol.for(`react.server_context`),u=Symbol.for(`react.forward_ref`),d=Symbol.for(`react.suspense`),f=Symbol.for(`react.suspense_list`),p=Symbol.for(`react.memo`),m=Symbol.for(`react.lazy`);function h(e){if(typeof e==`object`&&e){var h=e.$$typeof;switch(h){case n:switch(e=e.type,e){case i:case o:case a:case d:case f:return e;default:switch(e&&=e.$$typeof,e){case l:case c:case u:case m:case p:case s:return e;default:return h}}case r:return h}}}e.isFragment=function(e){return h(e)===i}})),yx=s(((e,n)=>{n.exports=vx()})),bx=s(((e,n)=>{var r=wb(),i=Tb(),a=`[object Number]`;function o(e){return typeof e==`number`||i(e)&&r(e)==a}n.exports=o})),xx=s(((e,n)=>{var r=bx();function i(e){return r(e)&&e!=+e}n.exports=i})),Sx=u(_x()),Cx=u(xx()),wx=u(hx()),Tx=u(bx()),Ex=u(gx()),Dx=function(e){return e===0?0:e>0?1:-1},Ox=function(e){return(0,Sx.default)(e)&&e.indexOf(`%`)===e.length-1},Y=function(e){return(0,Tx.default)(e)&&!(0,Cx.default)(e)},kx=function(e){return(0,Ex.default)(e)},Ax=function(e){return Y(e)||(0,Sx.default)(e)},jx=0,Mx=function(e){var n=++jx;return`${e||``}${n}`},Nx=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Y(e)&&!(0,Sx.default)(e))return r;var a;if(Ox(e)){var o=e.indexOf(`%`);a=n*parseFloat(e.slice(0,o))/100}else a=+e;return(0,Cx.default)(a)&&(a=r),i&&a>n&&(a=n),a},Px=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},Fx=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i<n;i++)if(!r[e[i]])r[e[i]]=!0;else return!0;return!1},Ix=function(e,n){return Y(e)&&Y(n)?function(r){return e+r*(n-e)}:function(){return n}};function Lx(e,n,r){return!e||!e.length?null:e.find(function(e){return e&&(typeof n==`function`?n(e):(0,wx.default)(e,n))===r})}var Rx=function(e,n){return Y(e)&&Y(n)?e-n:(0,Sx.default)(e)&&(0,Sx.default)(n)?e.localeCompare(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))};function zx(e,n){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(n,r)||e[r]!==n[r]))return!1;for(var i in n)if({}.hasOwnProperty.call(n,i)&&!{}.hasOwnProperty.call(e,i))return!1;return!0}var Bx=u(Ob());function Vx(e){"@babel/helpers - typeof";return Vx=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Vx(e)}var Hx=[`viewBox`,`children`],Ux=`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`),Wx=[`points`,`pathLength`],Gx={svg:Hx,polygon:Wx,polyline:Wx},Kx=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`),qx=function(e,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,y.isValidElement)(e)&&(r=e.props),!(0,Bx.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){Kx.includes(e)&&(i[e]=n||function(n){return r[e](r,n)})}),i},Jx=function(e,n,r){return function(i){return e(n,r,i),null}},Yx=function(e,n,r){if(!(0,Bx.default)(e)||Vx(e)!==`object`)return null;var i=null;return Object.keys(e).forEach(function(a){var o=e[a];Kx.includes(a)&&typeof o==`function`&&(i||={},i[a]=Jx(o,n,r))}),i},Xx=u(kb()),Zx=yx(),Qx=[`children`],$x=[`children`];function eS(e,n){if(e==null)return{};var r=tS(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function tS(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}function nS(e){"@babel/helpers - typeof";return nS=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nS(e)}var rS={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},iS=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},aS=null,oS=null,sS=function e(n){if(n===aS&&Array.isArray(oS))return oS;var r=[];return y.Children.forEach(n,function(n){(0,Ex.default)(n)||((0,Zx.isFragment)(n)?r=r.concat(e(n.props.children)):r.push(n))}),oS=r,aS=n,r};function cS(e,n){var r=[],i=[];return i=Array.isArray(n)?n.map(function(e){return iS(e)}):[iS(n)],sS(e).forEach(function(e){var n=(0,wx.default)(e,`type.displayName`)||(0,wx.default)(e,`type.name`);i.indexOf(n)!==-1&&r.push(e)}),r}function lS(e,n){var r=cS(e,n);return r&&r[0]}var uS=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!Y(r)||r<=0||!Y(i)||i<=0)},dS=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),fS=function(e){return e&&e.type&&(0,Sx.default)(e.type)&&dS.indexOf(e.type)>=0},pS=function(e){return e&&nS(e)===`object`&&`clipDot`in e},mS=function(e,n,r,i){var a=Gx?.[i]??[];return n.startsWith(`data-`)||!(0,Xx.default)(e)&&(i&&a.includes(n)||Ux.includes(n))||r&&Kx.includes(n)},hS=function(e,n,r){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var i=e;if((0,y.isValidElement)(e)&&(i=e.props),!(0,Bx.default)(i))return null;var a={};return Object.keys(i).forEach(function(e){mS(i?.[e],e,n,r)&&(a[e]=i[e])}),a},gS=function e(n,r){if(n===r)return!0;var i=y.Children.count(n);if(i!==y.Children.count(r))return!1;if(i===0)return!0;if(i===1)return _S(Array.isArray(n)?n[0]:n,Array.isArray(r)?r[0]:r);for(var a=0;a<i;a++){var o=n[a],s=r[a];if(Array.isArray(o)||Array.isArray(s)){if(!e(o,s))return!1}else if(!_S(o,s))return!1}return!0},_S=function(e,n){if((0,Ex.default)(e)&&(0,Ex.default)(n))return!0;if(!(0,Ex.default)(e)&&!(0,Ex.default)(n)){var r=e.props||{},i=r.children,a=eS(r,Qx),o=n.props||{},s=o.children,c=eS(o,$x);return i&&s?zx(a,c)&&gS(i,s):!i&&!s?zx(a,c):!1}return!1},vS=function(e,n){var r=[],i={};return sS(e).forEach(function(e,a){if(fS(e))r.push(e);else if(e){var o=iS(e.type),s=n[o]||{},c=s.handler,l=s.once;if(c&&(!l||!i[o])){var u=c(e,o,a);r.push(u),i[o]=!0}}}),r},yS=function(e){var n=e&&e.type;return n&&rS[n]?rS[n]:null},bS=function(e,n){return sS(n).indexOf(e)},xS=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function SS(){return SS=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},SS.apply(this,arguments)}function CS(e,n){if(e==null)return{};var r=wS(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function wS(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}function TS(e){var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=CS(e,xS),d=a||{width:r,height:i,x:0,y:0},f=Zd(`recharts-surface`,o);return y.createElement(`svg`,SS({},hS(u,!0,`svg`),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`}),y.createElement(`title`,null,c),y.createElement(`desc`,null,l),n)}var ES=[`children`,`className`];function DS(){return DS=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},DS.apply(this,arguments)}function OS(e,n){if(e==null)return{};var r=kS(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function kS(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}var AS=y.forwardRef(function(e,n){var r=e.children,i=e.className,a=OS(e,ES),o=Zd(`recharts-layer`,i);return y.createElement(`g`,DS({className:o},hS(a,!0),{ref:n}),r)}),jS=!1,MS=function(e,n){var r=[...arguments].slice(2);if(jS&&typeof console<`u`&&console.warn&&(n===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(n===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var i=0;console.warn(n.replace(/%s/g,function(){return r[i++]}))}},NS=s(((e,n)=>{function r(e,n,r){var i=-1,a=e.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var o=Array(a);++i<a;)o[i]=e[i+n];return o}n.exports=r})),PS=s(((e,n)=>{var r=NS();function i(e,n,i){var a=e.length;return i=i===void 0?a:i,!n&&i>=a?e:r(e,n,i)}n.exports=i})),FS=s(((e,n)=>{var r=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function i(e){return r.test(e)}n.exports=i})),IS=s(((e,n)=>{function r(e){return e.split(``)}n.exports=r})),LS=s(((e,n)=>{var r=`\\ud800-\\udfff`,i=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,a=`\\ufe0e\\ufe0f`,o=`[`+r+`]`,s=`[`+i+`]`,c=`\\ud83c[\\udffb-\\udfff]`,l=`(?:`+s+`|`+c+`)`,u=`[^`+r+`]`,d=`(?:\\ud83c[\\udde6-\\uddff]){2}`,f=`[\\ud800-\\udbff][\\udc00-\\udfff]`,p=`\\u200d`,m=l+`?`,h=`[`+a+`]?`,g=`(?:`+p+`(?:`+[u,d,f].join(`|`)+`)`+h+m+`)*`,_=h+m+g,v=`(?:`+[u+s+`?`,s,d,f,o].join(`|`)+`)`,y=RegExp(c+`(?=`+c+`)|`+v+_,`g`);function b(e){return e.match(y)||[]}n.exports=b})),RS=s(((e,n)=>{var r=IS(),i=FS(),a=LS();function o(e){return i(e)?a(e):r(e)}n.exports=o})),zS=s(((e,n)=>{var r=PS(),i=FS(),a=RS(),o=dx();function s(e){return function(n){n=o(n);var s=i(n)?a(n):void 0,c=s?s[0]:n.charAt(0),l=s?r(s,1).join(``):n.slice(1);return c[e]()+l}}n.exports=s})),BS=s(((e,n)=>{n.exports=zS()(`toUpperCase`)}));function VS(e){return function(){return e}}var HS=Math.cos,US=Math.sin,WS=Math.sqrt,GS=Math.PI;GS/2;var KS=2*GS,qS=Math.PI,JS=2*qS,YS=1e-6,XS=JS-YS;function ZS(e){this._+=e[0];for(let n=1,r=e.length;n<r;++n)this._+=arguments[n]+e[n]}function QS(e){let n=Math.floor(e);if(!(n>=0))throw Error(`invalid digits: ${e}`);if(n>15)return ZS;let r=10**n;return function(e){this._+=e[0];for(let n=1,i=e.length;n<i;++n)this._+=Math.round(arguments[n]*r)/r+e[n]}}var $S=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?ZS:QS(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,i){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(e,n,r,i,a,o){this._append`C${+e},${+n},${+r},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(e,n,r,i,a){if(e=+e,n=+n,r=+r,i=+i,a=+a,a<0)throw Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,c=r-e,l=i-n,u=o-e,d=s-n,f=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(f>YS)if(!(Math.abs(d*c-l*u)>YS)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-o,m=i-s,h=c*c+l*l,g=p*p+m*m,_=Math.sqrt(h),v=Math.sqrt(f),y=a*Math.tan((qS-Math.acos((h+f-g)/(2*_*v)))/2),b=y/v,x=y/_;Math.abs(b-1)>YS&&this._append`L${e+b*u},${n+b*d}`,this._append`A${a},${a},0,0,${+(d*p>u*m)},${this._x1=e+x*c},${this._y1=n+x*l}`}}arc(e,n,r,i,a,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw Error(`negative radius: ${r}`);let s=r*Math.cos(i),c=r*Math.sin(i),l=e+s,u=n+c,d=1^o,f=o?i-a:a-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>YS||Math.abs(this._y1-u)>YS)&&this._append`L${l},${u}`,r&&(f<0&&(f=f%JS+JS),f>XS?this._append`A${r},${r},0,1,${d},${e-s},${n-c}A${r},${r},0,1,${d},${this._x1=l},${this._y1=u}`:f>YS&&this._append`A${r},${r},0,${+(f>=qS)},${d},${this._x1=e+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function eC(){return new $S}eC.prototype=$S.prototype;function tC(e){let n=3;return e.digits=function(r){if(!arguments.length)return n;if(r==null)n=null;else{let e=Math.floor(r);if(!(e>=0))throw RangeError(`invalid digits: ${r}`);n=e}return e},()=>new $S(n)}Array.prototype.slice;function nC(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function rC(e){this._context=e}rC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;default:this._context.lineTo(e,n);break}}};function iC(e){return new rC(e)}function aC(e){return e[0]}function oC(e){return e[1]}function sC(e,n){var r=VS(!0),i=null,a=iC,o=null,s=tC(c);e=typeof e==`function`?e:e===void 0?aC:VS(e),n=typeof n==`function`?n:n===void 0?oC:VS(n);function c(c){var l,u=(c=nC(c)).length,d,f=!1,p;for(i??(o=a(p=s())),l=0;l<=u;++l)!(l<u&&r(d=c[l],l,c))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+e(d,l,c),+n(d,l,c));if(p)return o=null,p+``||null}return c.x=function(n){return arguments.length?(e=typeof n==`function`?n:VS(+n),c):e},c.y=function(e){return arguments.length?(n=typeof e==`function`?e:VS(+e),c):n},c.defined=function(e){return arguments.length?(r=typeof e==`function`?e:VS(!!e),c):r},c.curve=function(e){return arguments.length?(a=e,i!=null&&(o=a(i)),c):a},c.context=function(e){return arguments.length?(e==null?i=o=null:o=a(i=e),c):i},c}function cC(e,n,r){var i=null,a=VS(!0),o=null,s=iC,c=null,l=tC(u);e=typeof e==`function`?e:e===void 0?aC:VS(+e),n=typeof n==`function`?n:VS(n===void 0?0:+n),r=typeof r==`function`?r:r===void 0?oC:VS(+r);function u(u){var d,f,p,m=(u=nC(u)).length,h,g=!1,_,v=Array(m),y=Array(m);for(o??(c=s(_=l())),d=0;d<=m;++d){if(!(d<m&&a(h=u[d],d,u))===g)if(g=!g)f=d,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),p=d-1;p>=f;--p)c.point(v[p],y[p]);c.lineEnd(),c.areaEnd()}g&&(v[d]=+e(h,d,u),y[d]=+n(h,d,u),c.point(i?+i(h,d,u):v[d],r?+r(h,d,u):y[d]))}if(_)return c=null,_+``||null}function d(){return sC().defined(a).curve(s).context(o)}return u.x=function(n){return arguments.length?(e=typeof n==`function`?n:VS(+n),i=null,u):e},u.x0=function(n){return arguments.length?(e=typeof n==`function`?n:VS(+n),u):e},u.x1=function(e){return arguments.length?(i=e==null?null:typeof e==`function`?e:VS(+e),u):i},u.y=function(e){return arguments.length?(n=typeof e==`function`?e:VS(+e),r=null,u):n},u.y0=function(e){return arguments.length?(n=typeof e==`function`?e:VS(+e),u):n},u.y1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:VS(+e),u):r},u.lineX0=u.lineY0=function(){return d().x(e).y(n)},u.lineY1=function(){return d().x(e).y(r)},u.lineX1=function(){return d().x(i).y(n)},u.defined=function(e){return arguments.length?(a=typeof e==`function`?e:VS(!!e),u):a},u.curve=function(e){return arguments.length?(s=e,o!=null&&(c=s(o)),u):s},u.context=function(e){return arguments.length?(e==null?o=c=null:c=s(o=e),u):o},u}var lC=class{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}this._x0=e,this._y0=n}};function uC(e){return new lC(e,!0)}function dC(e){return new lC(e,!1)}var fC={draw(e,n){let r=WS(n/GS);e.moveTo(r,0),e.arc(0,0,r,0,KS)}},pC={draw(e,n){let r=WS(n/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},mC=WS(1/3),hC=mC*2,gC={draw(e,n){let r=WS(n/hC),i=r*mC;e.moveTo(0,-r),e.lineTo(i,0),e.lineTo(0,r),e.lineTo(-i,0),e.closePath()}},_C={draw(e,n){let r=WS(n),i=-r/2;e.rect(i,i,r,r)}},vC=.8908130915292852,yC=US(GS/10)/US(7*GS/10),bC=US(KS/10)*yC,xC=-HS(KS/10)*yC,SC={draw(e,n){let r=WS(n*vC),i=bC*r,a=xC*r;e.moveTo(0,-r),e.lineTo(i,a);for(let n=1;n<5;++n){let o=KS*n/5,s=HS(o),c=US(o);e.lineTo(c*r,-s*r),e.lineTo(s*i-c*a,c*i+s*a)}e.closePath()}},CC=WS(3),wC={draw(e,n){let r=-WS(n/(CC*3));e.moveTo(0,r*2),e.lineTo(-CC*r,-r),e.lineTo(CC*r,-r),e.closePath()}},TC=-.5,EC=WS(3)/2,DC=1/WS(12),OC=(DC/2+1)*3,kC={draw(e,n){let r=WS(n/OC),i=r/2,a=r*DC,o=i,s=r*DC+r,c=-o,l=s;e.moveTo(i,a),e.lineTo(o,s),e.lineTo(c,l),e.lineTo(TC*i-EC*a,EC*i+TC*a),e.lineTo(TC*o-EC*s,EC*o+TC*s),e.lineTo(TC*c-EC*l,EC*c+TC*l),e.lineTo(TC*i+EC*a,TC*a-EC*i),e.lineTo(TC*o+EC*s,TC*s-EC*o),e.lineTo(TC*c+EC*l,TC*l-EC*c),e.closePath()}};function AC(e,n){let r=null,i=tC(a);e=typeof e==`function`?e:VS(e||fC),n=typeof n==`function`?n:VS(n===void 0?64:+n);function a(){let a;if(r||=a=i(),e.apply(this,arguments).draw(r,+n.apply(this,arguments)),a)return r=null,a+``||null}return a.type=function(n){return arguments.length?(e=typeof n==`function`?n:VS(n),a):e},a.size=function(e){return arguments.length?(n=typeof e==`function`?e:VS(+e),a):n},a.context=function(e){return arguments.length?(r=e??null,a):r},a}function jC(){}function MC(e,n,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+n)/6,(e._y0+4*e._y1+r)/6)}function NC(e){this._context=e}NC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:MC(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:MC(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function PC(e){return new NC(e)}function FC(e){this._context=e}FC.prototype={areaStart:jC,areaEnd:jC,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._x2=e,this._y2=n;break;case 1:this._point=2,this._x3=e,this._y3=n;break;case 2:this._point=3,this._x4=e,this._y4=n,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+n)/6);break;default:MC(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function IC(e){return new FC(e)}function LC(e){this._context=e}LC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(r,i):this._context.moveTo(r,i);break;case 3:this._point=4;default:MC(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function RC(e){return new LC(e)}function zC(e){this._context=e}zC.prototype={areaStart:jC,areaEnd:jC,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,n){e=+e,n=+n,this._point?this._context.lineTo(e,n):(this._point=1,this._context.moveTo(e,n))}};function BC(e){return new zC(e)}function VC(e){return e<0?-1:1}function HC(e,n,r){var i=e._x1-e._x0,a=n-e._x1,o=(e._y1-e._y0)/(i||a<0&&-0),s=(r-e._y1)/(a||i<0&&-0),c=(o*a+s*i)/(i+a);return(VC(o)+VC(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(c))||0}function UC(e,n){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-n)/2:n}function WC(e,n,r){var i=e._x0,a=e._y0,o=e._x1,s=e._y1,c=(o-i)/3;e._context.bezierCurveTo(i+c,a+c*n,o-c,s-c*r,o,s)}function GC(e){this._context=e}GC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:WC(this,this._t0,UC(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){var r=NaN;if(e=+e,n=+n,!(e===this._x1&&n===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3,WC(this,UC(this,r=HC(this,e,n)),r);break;default:WC(this,this._t0,r=HC(this,e,n));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n,this._t0=r}}};function KC(e){this._context=new qC(e)}(KC.prototype=Object.create(GC.prototype)).point=function(e,n){GC.prototype.point.call(this,n,e)};function qC(e){this._context=e}qC.prototype={moveTo:function(e,n){this._context.moveTo(n,e)},closePath:function(){this._context.closePath()},lineTo:function(e,n){this._context.lineTo(n,e)},bezierCurveTo:function(e,n,r,i,a,o){this._context.bezierCurveTo(n,e,i,r,o,a)}};function JC(e){return new GC(e)}function YC(e){return new KC(e)}function XC(e){this._context=e}XC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,n=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],n[0]):this._context.moveTo(e[0],n[0]),r===2)this._context.lineTo(e[1],n[1]);else for(var i=ZC(e),a=ZC(n),o=0,s=1;s<r;++o,++s)this._context.bezierCurveTo(i[0][o],a[0][o],i[1][o],a[1][o],e[s],n[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,n){this._x.push(+e),this._y.push(+n)}};function ZC(e){var n,r=e.length-1,i,a=Array(r),o=Array(r),s=Array(r);for(a[0]=0,o[0]=2,s[0]=e[0]+2*e[1],n=1;n<r-1;++n)a[n]=1,o[n]=4,s[n]=4*e[n]+2*e[n+1];for(a[r-1]=2,o[r-1]=7,s[r-1]=8*e[r-1]+e[r],n=1;n<r;++n)i=a[n]/o[n-1],o[n]-=i,s[n]-=i*s[n-1];for(a[r-1]=s[r-1]/o[r-1],n=r-2;n>=0;--n)a[n]=(s[n]-a[n+1])/o[n];for(o[r-1]=(e[r]+a[r-1])/2,n=0;n<r-1;++n)o[n]=2*e[n+1]-a[n+1];return[a,o]}function QC(e){return new XC(e)}function $C(e,n){this._context=e,this._t=n}$C.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(e,n);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,n)}break}this._x=e,this._y=n}};function ew(e){return new $C(e,.5)}function tw(e){return new $C(e,0)}function nw(e){return new $C(e,1)}function rw(e,n){if((s=e.length)>1)for(var r=1,i,a,o=e[n[0]],s,c=o.length;r<s;++r)for(a=o,o=e[n[r]],i=0;i<c;++i)o[i][1]+=o[i][0]=isNaN(a[i][1])?a[i][0]:a[i][1]}function iw(e){for(var n=e.length,r=Array(n);--n>=0;)r[n]=n;return r}function aw(e,n){return e[n]}function ow(e){let n=[];return n.key=e,n}function sw(){var e=VS([]),n=iw,r=rw,i=aw;function a(a){var o=Array.from(e.apply(this,arguments),ow),s,c=o.length,l=-1,u;for(let e of a)for(s=0,++l;s<c;++s)(o[s][l]=[0,+i(e,o[s].key,l,a)]).data=e;for(s=0,u=nC(n(o));s<c;++s)o[u[s]].index=s;return r(o,u),o}return a.keys=function(n){return arguments.length?(e=typeof n==`function`?n:VS(Array.from(n)),a):e},a.value=function(e){return arguments.length?(i=typeof e==`function`?e:VS(+e),a):i},a.order=function(e){return arguments.length?(n=e==null?iw:typeof e==`function`?e:VS(Array.from(e)),a):n},a.offset=function(e){return arguments.length?(r=e??rw,a):r},a}function cw(e,n){if((i=e.length)>0){for(var r,i,a=0,o=e[0].length,s;a<o;++a){for(s=r=0;r<i;++r)s+=e[r][a][1]||0;if(s)for(r=0;r<i;++r)e[r][a][1]/=s}rw(e,n)}}function lw(e,n){if((a=e.length)>0){for(var r=0,i=e[n[0]],a,o=i.length;r<o;++r){for(var s=0,c=0;s<a;++s)c+=e[s][r][1]||0;i[r][1]+=i[r][0]=-c/2}rw(e,n)}}function uw(e,n){if(!(!((s=e.length)>0)||!((o=(a=e[n[0]]).length)>0))){for(var r=0,i=1,a,o,s;i<o;++i){for(var c=0,l=0,u=0;c<s;++c){for(var d=e[n[c]],f=d[i][1]||0,p=(f-(d[i-1][1]||0))/2,m=0;m<c;++m){var h=e[n[m]],g=h[i][1]||0,_=h[i-1][1]||0;p+=g-_}l+=f,u+=p*f}a[i-1][1]+=a[i-1][0]=r,l&&(r-=u/l)}a[i-1][1]+=a[i-1][0]=r,rw(e,n)}}var dw=u(BS());function fw(e){"@babel/helpers - typeof";return fw=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fw(e)}var pw=[`type`,`size`,`sizeType`];function mw(){return mw=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},mw.apply(this,arguments)}function hw(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function gw(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]==null?{}:arguments[n];n%2?hw(Object(r),!0).forEach(function(n){_w(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _w(e,n,r){return n=vw(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function vw(e){var n=yw(e,`string`);return fw(n)==`symbol`?n:n+``}function yw(e,n){if(fw(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(fw(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function bw(e,n){if(e==null)return{};var r=xw(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function xw(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}var Sw={symbolCircle:fC,symbolCross:pC,symbolDiamond:gC,symbolSquare:_C,symbolStar:SC,symbolTriangle:wC,symbolWye:kC},Cw=Math.PI/180,ww=function(e){return Sw[`symbol${(0,dw.default)(e)}`]||fC},Tw=function(e,n,r){if(n===`area`)return e;switch(r){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var i=18*Cw;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.tan(i)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Ew=function(e,n){Sw[`symbol${(0,dw.default)(e)}`]=n},Dw=function(e){var n=e.type,r=n===void 0?`circle`:n,i=e.size,a=i===void 0?64:i,o=e.sizeType,s=o===void 0?`area`:o,c=gw(gw({},bw(e,pw)),{},{type:r,size:a,sizeType:s}),l=function(){var e=ww(r);return AC().type(e).size(Tw(a,s,r))()},u=c.className,d=c.cx,f=c.cy,p=hS(c,!0);return d===+d&&f===+f&&a===+a?y.createElement(`path`,mw({},p,{className:Zd(`recharts-symbols`,u),transform:`translate(${d}, ${f})`,d:l()})):null};Dw.registerSymbol=Ew;function Ow(e){"@babel/helpers - typeof";return Ow=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ow(e)}function kw(){return kw=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},kw.apply(this,arguments)}function Aw(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function jw(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]==null?{}:arguments[n];n%2?Aw(Object(r),!0).forEach(function(n){Vw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Aw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mw(e,n){if(!(e instanceof n))throw TypeError(`Cannot call a class as a function`)}function Nw(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,`value`in i&&(i.writable=!0),Object.defineProperty(e,Hw(i.key),i)}}function Pw(e,n,r){return n&&Nw(e.prototype,n),r&&Nw(e,r),Object.defineProperty(e,`prototype`,{writable:!1}),e}function Fw(e,n,r){return n=zw(n),Iw(e,Rw()?Reflect.construct(n,r||[],zw(e).constructor):n.apply(e,r))}function Iw(e,n){if(n&&(Ow(n)===`object`||typeof n==`function`))return n;if(n!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Lw(e)}function Lw(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Rw(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Rw=function(){return!!e})()}function zw(e){return zw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zw(e)}function ite(e,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),n&&Bw(e,n)}function Bw(e,n){return Bw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Bw(e,n)}function Vw(e,n,r){return n=Hw(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Hw(e){var n=ate(e,`string`);return Ow(n)==`symbol`?n:n+``}function ate(e,n){if(Ow(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(Ow(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var Uw=32,Ww=function(e){function n(){return Mw(this,n),Fw(this,n,arguments)}return ite(n,e),Pw(n,[{key:`renderIcon`,value:function(e){var n=this.props.inactiveColor,r=Uw/2,i=Uw/6,a=Uw/3,o=e.inactive?n:e.color;if(e.type===`plainline`)return y.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:o,strokeDasharray:e.payload.strokeDasharray,x1:0,y1:r,x2:Uw,y2:r,className:`recharts-legend-icon`});if(e.type===`line`)return y.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:o,d:`M0,${r}h${a}
|
|
20
20
|
A${i},${i},0,1,1,${2*a},${r}
|
|
21
21
|
H${Uw}M${2*a},${r}
|
|
22
22
|
A${i},${i},0,1,1,${a},${r}`,className:`recharts-legend-icon`});if(e.type===`rect`)return y.createElement(`path`,{stroke:`none`,fill:o,d:`M0,${Uw/8}h${Uw}v${Uw*3/4}h${-Uw}z`,className:`recharts-legend-icon`});if(y.isValidElement(e.legendIcon)){var s=jw({},e);return delete s.legendIcon,y.cloneElement(e.legendIcon,s)}return y.createElement(Dw,{fill:o,cx:r,cy:r,size:Uw,sizeType:`diameter`,type:e.type})}},{key:`renderItems`,value:function(){var e=this,n=this.props,r=n.payload,i=n.iconSize,a=n.layout,o=n.formatter,s=n.inactiveColor,c={x:0,y:0,width:Uw,height:Uw},l={display:a===`horizontal`?`inline-block`:`block`,marginRight:10},u={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return r.map(function(n,r){var a=n.formatter||o,d=Zd(Vw(Vw({"recharts-legend-item":!0},`legend-item-${r}`,!0),`inactive`,n.inactive));if(n.type===`none`)return null;var f=(0,Xx.default)(n.value)?null:n.value;MS(!(0,Xx.default)(n.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var p=n.inactive?s:n.color;return y.createElement(`li`,kw({className:d,style:l,key:`legend-item-${r}`},Yx(e.props,n,r)),y.createElement(TS,{width:i,height:i,viewBox:c,style:u},e.renderIcon(n)),y.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:p}},a?a(f,n,r):f))})}},{key:`render`,value:function(){var e=this.props,n=e.payload,r=e.layout,i=e.align;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return y.createElement(`ul`,{className:`recharts-default-legend`,style:a},this.renderItems())}}])}(y.PureComponent);Vw(Ww,`displayName`,`Legend`),Vw(Ww,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var ote=s(((e,n)=>{var r=Xb();function i(){this.__data__=new r,this.size=0}n.exports=i})),ste=s(((e,n)=>{function r(e){var n=this.__data__,r=n.delete(e);return this.size=n.size,r}n.exports=r})),cte=s(((e,n)=>{function r(e){return this.__data__.get(e)}n.exports=r})),lte=s(((e,n)=>{function r(e){return this.__data__.has(e)}n.exports=r})),ute=s(((e,n)=>{var r=Xb(),i=Zb(),a=ax(),o=200;function s(e,n){var s=this.__data__;if(s instanceof r){var c=s.__data__;if(!i||c.length<o-1)return c.push([e,n]),this.size=++s.size,this;s=this.__data__=new a(c)}return s.set(e,n),this.size=s.size,this}n.exports=s})),Gw=s(((e,n)=>{var r=Xb(),i=ote(),a=ste(),o=cte(),s=lte(),c=ute();function l(e){this.size=(this.__data__=new r(e)).size}l.prototype.clear=i,l.prototype.delete=a,l.prototype.get=o,l.prototype.has=s,l.prototype.set=c,n.exports=l})),dte=s(((e,n)=>{var r=`__lodash_hash_undefined__`;function i(e){return this.__data__.set(e,r),this}n.exports=i})),fte=s(((e,n)=>{function r(e){return this.__data__.has(e)}n.exports=r})),Kw=s(((e,n)=>{var r=ax(),i=dte(),a=fte();function o(e){var n=-1,i=e==null?0:e.length;for(this.__data__=new r;++n<i;)this.add(e[n])}o.prototype.add=o.prototype.push=i,o.prototype.has=a,n.exports=o})),qw=s(((e,n)=>{function r(e,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(e[r],r,e))return!0;return!1}n.exports=r})),Jw=s(((e,n)=>{function r(e,n){return e.has(n)}n.exports=r})),Yw=s(((e,n)=>{var r=Kw(),i=qw(),a=Jw(),o=1,s=2;function c(e,n,c,l,u,d){var f=c&o,p=e.length,m=n.length;if(p!=m&&!(f&&m>p))return!1;var h=d.get(e),g=d.get(n);if(h&&g)return h==n&&g==e;var _=-1,v=!0,y=c&s?new r:void 0;for(d.set(e,n),d.set(n,e);++_<p;){var b=e[_],x=n[_];if(l)var S=f?l(x,b,_,n,e,d):l(b,x,_,e,n,d);if(S!==void 0){if(S)continue;v=!1;break}if(y){if(!i(n,function(e,n){if(!a(y,n)&&(b===e||u(b,e,c,l,d)))return y.push(n)})){v=!1;break}}else if(!(b===x||u(b,x,c,l,d))){v=!1;break}}return d.delete(e),d.delete(n),v}n.exports=c})),pte=s(((e,n)=>{n.exports=bb().Uint8Array})),mte=s(((e,n)=>{function r(e){var n=-1,r=Array(e.size);return e.forEach(function(e,i){r[++n]=[i,e]}),r}n.exports=r})),Xw=s(((e,n)=>{function r(e){var n=-1,r=Array(e.size);return e.forEach(function(e){r[++n]=e}),r}n.exports=r})),hte=s(((e,n)=>{var r=xb(),i=pte(),a=Wb(),o=Yw(),s=mte(),c=Xw(),l=1,u=2,d=`[object Boolean]`,f=`[object Date]`,p=`[object Error]`,m=`[object Map]`,h=`[object Number]`,g=`[object RegExp]`,_=`[object Set]`,v=`[object String]`,y=`[object Symbol]`,b=`[object ArrayBuffer]`,x=`[object DataView]`,S=r?r.prototype:void 0,C=S?S.valueOf:void 0;function w(e,n,r,S,w,T,E){switch(r){case x:if(e.byteLength!=n.byteLength||e.byteOffset!=n.byteOffset)return!1;e=e.buffer,n=n.buffer;case b:return!(e.byteLength!=n.byteLength||!T(new i(e),new i(n)));case d:case f:case h:return a(+e,+n);case p:return e.name==n.name&&e.message==n.message;case g:case v:return e==n+``;case m:var D=s;case _:var O=S&l;if(D||=c,e.size!=n.size&&!O)return!1;var k=E.get(e);if(k)return k==n;S|=u,E.set(e,n);var A=o(D(e),D(n),S,w,T,E);return E.delete(e),A;case y:if(C)return C.call(e)==C.call(n)}return!1}n.exports=w})),Zw=s(((e,n)=>{function r(e,n){for(var r=-1,i=n.length,a=e.length;++r<i;)e[a+r]=n[r];return e}n.exports=r})),gte=s(((e,n)=>{var r=Zw(),i=vb();function a(e,n,a){var o=n(e);return i(e)?o:r(o,a(e))}n.exports=a})),_te=s(((e,n)=>{function r(e,n){for(var r=-1,i=e==null?0:e.length,a=0,o=[];++r<i;){var s=e[r];n(s,r,e)&&(o[a++]=s)}return o}n.exports=r})),vte=s(((e,n)=>{function r(){return[]}n.exports=r})),yte=s(((e,n)=>{var r=_te(),i=vte(),a=Object.prototype.propertyIsEnumerable,o=Object.getOwnPropertySymbols;n.exports=o?function(e){return e==null?[]:(e=Object(e),r(o(e),function(n){return a.call(e,n)}))}:i})),bte=s(((e,n)=>{function r(e,n){for(var r=-1,i=Array(e);++r<e;)i[r]=n(r);return i}n.exports=r})),xte=s(((e,n)=>{var r=wb(),i=Tb(),a=`[object Arguments]`;function o(e){return i(e)&&r(e)==a}n.exports=o})),Qw=s(((e,n)=>{var r=xte(),i=Tb(),a=Object.prototype,o=a.hasOwnProperty,s=a.propertyIsEnumerable;n.exports=r(function(){return arguments}())?r:function(e){return i(e)&&o.call(e,`callee`)&&!s.call(e,`callee`)}})),Ste=s(((e,n)=>{function r(){return!1}n.exports=r})),$w=s(((e,n)=>{var r=bb(),i=Ste(),a=typeof e==`object`&&e&&!e.nodeType&&e,o=a&&typeof n==`object`&&n&&!n.nodeType&&n,s=o&&o.exports===a?r.Buffer:void 0;n.exports=(s?s.isBuffer:void 0)||i})),eT=s(((e,n)=>{var r=9007199254740991,i=/^(?:0|[1-9]\d*)$/;function a(e,n){var a=typeof e;return n??=r,!!n&&(a==`number`||a!=`symbol`&&i.test(e))&&e>-1&&e%1==0&&e<n}n.exports=a})),tT=s(((e,n)=>{var r=9007199254740991;function i(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=r}n.exports=i})),Cte=s(((e,n)=>{var r=wb(),i=tT(),a=Tb(),o=`[object Arguments]`,s=`[object Array]`,c=`[object Boolean]`,l=`[object Date]`,u=`[object Error]`,d=`[object Function]`,f=`[object Map]`,p=`[object Number]`,m=`[object Object]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object WeakMap]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=`[object Float32Array]`,S=`[object Float64Array]`,C=`[object Int8Array]`,w=`[object Int16Array]`,T=`[object Int32Array]`,E=`[object Uint8Array]`,D=`[object Uint8ClampedArray]`,O=`[object Uint16Array]`,k=`[object Uint32Array]`,A={};A[x]=A[S]=A[C]=A[w]=A[T]=A[E]=A[D]=A[O]=A[k]=!0,A[o]=A[s]=A[y]=A[c]=A[b]=A[l]=A[u]=A[d]=A[f]=A[p]=A[m]=A[h]=A[g]=A[_]=A[v]=!1;function j(e){return a(e)&&i(e.length)&&!!A[r(e)]}n.exports=j})),nT=s(((e,n)=>{function r(e){return function(n){return e(n)}}n.exports=r})),wte=s(((e,n)=>{var r=yb(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof n==`object`&&n&&!n.nodeType&&n,o=a&&a.exports===i&&r.process;n.exports=function(){try{return a&&a.require&&a.require(`util`).types||o&&o.binding&&o.binding(`util`)}catch{}}()})),rT=s(((e,n)=>{var r=Cte(),i=nT(),a=wte(),o=a&&a.isTypedArray;n.exports=o?i(o):r})),Tte=s(((e,n)=>{var r=bte(),i=Qw(),a=vb(),o=$w(),s=eT(),c=rT(),l=Object.prototype.hasOwnProperty;function u(e,n){var u=a(e),d=!u&&i(e),f=!u&&!d&&o(e),p=!u&&!d&&!f&&c(e),m=u||d||f||p,h=m?r(e.length,String):[],g=h.length;for(var _ in e)(n||l.call(e,_))&&!(m&&(_==`length`||f&&(_==`offset`||_==`parent`)||p&&(_==`buffer`||_==`byteLength`||_==`byteOffset`)||s(_,g)))&&h.push(_);return h}n.exports=u})),Ete=s(((e,n)=>{var r=Object.prototype;function i(e){var n=e&&e.constructor;return e===(typeof n==`function`&&n.prototype||r)}n.exports=i})),iT=s(((e,n)=>{function r(e,n){return function(r){return e(n(r))}}n.exports=r})),Dte=s(((e,n)=>{n.exports=iT()(Object.keys,Object)})),Ote=s(((e,n)=>{var r=Ete(),i=Dte(),a=Object.prototype.hasOwnProperty;function o(e){if(!r(e))return i(e);var n=[];for(var o in Object(e))a.call(e,o)&&o!=`constructor`&&n.push(o);return n}n.exports=o})),aT=s(((e,n)=>{var r=kb(),i=tT();function a(e){return e!=null&&i(e.length)&&!r(e)}n.exports=a})),oT=s(((e,n)=>{var r=Tte(),i=Ote(),a=aT();function o(e){return a(e)?r(e):i(e)}n.exports=o})),kte=s(((e,n)=>{var r=gte(),i=yte(),a=oT();function o(e){return r(e,a,i)}n.exports=o})),Ate=s(((e,n)=>{var r=kte(),i=1,a=Object.prototype.hasOwnProperty;function o(e,n,o,s,c,l){var u=o&i,d=r(e),f=d.length;if(f!=r(n).length&&!u)return!1;for(var p=f;p--;){var m=d[p];if(!(u?m in n:a.call(n,m)))return!1}var h=l.get(e),g=l.get(n);if(h&&g)return h==n&&g==e;var _=!0;l.set(e,n),l.set(n,e);for(var v=u;++p<f;){m=d[p];var y=e[m],b=n[m];if(s)var x=u?s(b,y,m,n,e,l):s(y,b,m,e,n,l);if(!(x===void 0?y===b||c(y,b,o,s,l):x)){_=!1;break}v||=m==`constructor`}if(_&&!v){var S=e.constructor,C=n.constructor;S!=C&&`constructor`in e&&`constructor`in n&&!(typeof S==`function`&&S instanceof S&&typeof C==`function`&&C instanceof C)&&(_=!1)}return l.delete(e),l.delete(n),_}n.exports=o})),jte=s(((e,n)=>{n.exports=Fb()(bb(),`DataView`)})),Mte=s(((e,n)=>{n.exports=Fb()(bb(),`Promise`)})),sT=s(((e,n)=>{n.exports=Fb()(bb(),`Set`)})),Nte=s(((e,n)=>{n.exports=Fb()(bb(),`WeakMap`)})),Pte=s(((e,n)=>{var r=jte(),i=Zb(),a=Mte(),o=sT(),s=Nte(),c=wb(),l=Mb(),u=`[object Map]`,d=`[object Object]`,f=`[object Promise]`,p=`[object Set]`,m=`[object WeakMap]`,h=`[object DataView]`,g=l(r),_=l(i),v=l(a),y=l(o),b=l(s),x=c;(r&&x(new r(new ArrayBuffer(1)))!=h||i&&x(new i)!=u||a&&x(a.resolve())!=f||o&&x(new o)!=p||s&&x(new s)!=m)&&(x=function(e){var n=c(e),r=n==d?e.constructor:void 0,i=r?l(r):``;if(i)switch(i){case g:return h;case _:return u;case v:return f;case y:return p;case b:return m}return n}),n.exports=x})),Fte=s(((e,n)=>{var r=Gw(),i=Yw(),a=hte(),o=Ate(),s=Pte(),c=vb(),l=$w(),u=rT(),d=1,f=`[object Arguments]`,p=`[object Array]`,m=`[object Object]`,h=Object.prototype.hasOwnProperty;function g(e,n,g,_,v,y){var b=c(e),x=c(n),S=b?p:s(e),C=x?p:s(n);S=S==f?m:S,C=C==f?m:C;var w=S==m,T=C==m,E=S==C;if(E&&l(e)){if(!l(n))return!1;b=!0,w=!1}if(E&&!w)return y||=new r,b||u(e)?i(e,n,g,_,v,y):a(e,n,S,g,_,v,y);if(!(g&d)){var D=w&&h.call(e,`__wrapped__`),O=T&&h.call(n,`__wrapped__`);if(D||O){var k=D?e.value():e,A=O?n.value():n;return y||=new r,v(k,A,g,_,y)}}return E?(y||=new r,o(e,n,g,_,v,y)):!1}n.exports=g})),cT=s(((e,n)=>{var r=Fte(),i=Tb();function a(e,n,o,s,c){return e===n?!0:e==null||n==null||!i(e)&&!i(n)?e!==e&&n!==n:r(e,n,o,s,a,c)}n.exports=a})),Ite=s(((e,n)=>{var r=Gw(),i=cT(),a=1,o=2;function s(e,n,s,c){var l=s.length,u=l,d=!c;if(e==null)return!u;for(e=Object(e);l--;){var f=s[l];if(d&&f[2]?f[1]!==e[f[0]]:!(f[0]in e))return!1}for(;++l<u;){f=s[l];var p=f[0],m=e[p],h=f[1];if(d&&f[2]){if(m===void 0&&!(p in e))return!1}else{var g=new r;if(c)var _=c(m,h,p,e,n,g);if(!(_===void 0?i(h,m,a|o,c,g):_))return!1}}return!0}n.exports=s})),lT=s(((e,n)=>{var r=Ob();function i(e){return e===e&&!r(e)}n.exports=i})),Lte=s(((e,n)=>{var r=lT(),i=oT();function a(e){for(var n=i(e),a=n.length;a--;){var o=n[a],s=e[o];n[a]=[o,s,r(s)]}return n}n.exports=a})),uT=s(((e,n)=>{function r(e,n){return function(r){return r==null?!1:r[e]===n&&(n!==void 0||e in Object(r))}}n.exports=r})),Rte=s(((e,n)=>{var r=Ite(),i=Lte(),a=uT();function o(e){var n=i(e);return n.length==1&&n[0][2]?a(n[0][0],n[0][1]):function(i){return i===e||r(i,e,n)}}n.exports=o})),zte=s(((e,n)=>{function r(e,n){return e!=null&&n in Object(e)}n.exports=r})),Bte=s(((e,n)=>{var r=fx(),i=Qw(),a=vb(),o=eT(),s=tT(),c=px();function l(e,n,l){n=r(n,e);for(var u=-1,d=n.length,f=!1;++u<d;){var p=c(n[u]);if(!(f=e!=null&&l(e,p)))break;e=e[p]}return f||++u!=d?f:(d=e==null?0:e.length,!!d&&s(d)&&o(p,d)&&(a(e)||i(e)))}n.exports=l})),Vte=s(((e,n)=>{var r=zte(),i=Bte();function a(e,n){return e!=null&&i(e,n,r)}n.exports=a})),Hte=s(((e,n)=>{var r=cT(),i=hx(),a=Vte(),o=Db(),s=lT(),c=uT(),l=px(),u=1,d=2;function f(e,n){return o(e)&&s(n)?c(l(e),n):function(o){var s=i(o,e);return s===void 0&&s===n?a(o,e):r(n,s,u|d)}}n.exports=f})),dT=s(((e,n)=>{function r(e){return e}n.exports=r})),Ute=s(((e,n)=>{function r(e){return function(n){return n?.[e]}}n.exports=r})),Wte=s(((e,n)=>{var r=mx();function i(e){return function(n){return r(n,e)}}n.exports=i})),Gte=s(((e,n)=>{var r=Ute(),i=Wte(),a=Db(),o=px();function s(e){return a(e)?r(o(e)):i(e)}n.exports=s})),fT=s(((e,n)=>{var r=Rte(),i=Hte(),a=dT(),o=vb(),s=Gte();function c(e){return typeof e==`function`?e:e==null?a:typeof e==`object`?o(e)?i(e[0],e[1]):r(e):s(e)}n.exports=c})),pT=s(((e,n)=>{function r(e,n,r,i){for(var a=e.length,o=r+(i?1:-1);i?o--:++o<a;)if(n(e[o],o,e))return o;return-1}n.exports=r})),Kte=s(((e,n)=>{function r(e){return e!==e}n.exports=r})),qte=s(((e,n)=>{function r(e,n,r){for(var i=r-1,a=e.length;++i<a;)if(e[i]===n)return i;return-1}n.exports=r})),Jte=s(((e,n)=>{var r=pT(),i=Kte(),a=qte();function o(e,n,o){return n===n?a(e,n,o):r(e,i,o)}n.exports=o})),Yte=s(((e,n)=>{var r=Jte();function i(e,n){return!!(e!=null&&e.length)&&r(e,n,0)>-1}n.exports=i})),Xte=s(((e,n)=>{function r(e,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;)if(r(n,e[i]))return!0;return!1}n.exports=r})),Zte=s(((e,n)=>{function r(){}n.exports=r})),Qte=s(((e,n)=>{var r=sT(),i=Zte(),a=Xw();n.exports=r&&1/a(new r([,-0]))[1]==1/0?function(e){return new r(e)}:i})),$te=s(((e,n)=>{var r=Kw(),i=Yte(),a=Xte(),o=Jw(),s=Qte(),c=Xw(),l=200;function u(e,n,u){var d=-1,f=i,p=e.length,m=!0,h=[],g=h;if(u)m=!1,f=a;else if(p>=l){var _=n?null:s(e);if(_)return c(_);m=!1,f=o,g=new r}else g=n?[]:h;outer:for(;++d<p;){var v=e[d],y=n?n(v):v;if(v=u||v!==0?v:0,m&&y===y){for(var b=g.length;b--;)if(g[b]===y)continue outer;n&&g.push(y),h.push(v)}else f(g,y,u)||(g!==h&&g.push(y),h.push(v))}return h}n.exports=u})),mT=u(s(((e,n)=>{var r=fT(),i=$te();function a(e,n){return e&&e.length?i(e,r(n,2)):[]}n.exports=a}))());function hT(e,n,r){return n===!0?(0,mT.default)(e,r):(0,Xx.default)(n)?(0,mT.default)(e,n):e}function gT(e){"@babel/helpers - typeof";return gT=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},gT(e)}var ene=[`ref`];function _T(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function vT(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]==null?{}:arguments[n];n%2?_T(Object(r),!0).forEach(function(n){CT(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_T(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tne(e,n){if(!(e instanceof n))throw TypeError(`Cannot call a class as a function`)}function yT(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,`value`in i&&(i.writable=!0),Object.defineProperty(e,wT(i.key),i)}}function nne(e,n,r){return n&&yT(e.prototype,n),r&&yT(e,r),Object.defineProperty(e,`prototype`,{writable:!1}),e}function rne(e,n,r){return n=xT(n),ine(e,bT()?Reflect.construct(n,r||[],xT(e).constructor):n.apply(e,r))}function ine(e,n){if(n&&(gT(n)===`object`||typeof n==`function`))return n;if(n!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return ane(e)}function ane(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function bT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bT=function(){return!!e})()}function xT(e){return xT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xT(e)}function one(e,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),n&&ST(e,n)}function ST(e,n){return ST=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},ST(e,n)}function CT(e,n,r){return n=wT(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function wT(e){var n=sne(e,`string`);return gT(n)==`symbol`?n:n+``}function sne(e,n){if(gT(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(gT(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function cne(e,n){if(e==null)return{};var r=lne(e,n),i,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)i=o[a],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function lne(e,n){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;r[i]=e[i]}return r}function une(e){return e.value}function dne(e,n){if(y.isValidElement(e))return y.cloneElement(e,n);if(typeof e==`function`)return y.createElement(e,n);n.ref;var r=cne(n,ene);return y.createElement(Ww,r)}var TT=1,ET=function(e){function n(){var e;tne(this,n);var r=[...arguments];return e=rne(this,n,[].concat(r)),CT(e,`lastBoundingBox`,{width:-1,height:-1}),e}return one(n,e),nne(n,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,n=this.getBBox();n?(Math.abs(n.width-this.lastBoundingBox.width)>TT||Math.abs(n.height-this.lastBoundingBox.height)>TT)&&(this.lastBoundingBox.width=n.width,this.lastBoundingBox.height=n.height,e&&e(n)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?vT({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var n=this.props,r=n.layout,i=n.align,a=n.verticalAlign,o=n.margin,s=n.chartWidth,c=n.chartHeight,l,u;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))if(i===`center`&&r===`vertical`){var d=this.getBBoxSnapshot();l={left:((s||0)-d.width)/2}}else l=i===`right`?{right:o&&o.right||0}:{left:o&&o.left||0};if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))if(a===`middle`){var f=this.getBBoxSnapshot();u={top:((c||0)-f.height)/2}}else u=a===`bottom`?{bottom:o&&o.bottom||0}:{top:o&&o.top||0};return vT(vT({},l),u)}},{key:`render`,value:function(){var e=this,n=this.props,r=n.content,i=n.width,a=n.height,o=n.wrapperStyle,s=n.payloadUniqBy,c=n.payload,l=vT(vT({position:`absolute`,width:i||`auto`,height:a||`auto`},this.getDefaultPosition(o)),o);return y.createElement(`div`,{className:`recharts-legend-wrapper`,style:l,ref:function(n){e.wrapperNode=n}},dne(r,vT(vT({},this.props),{},{payload:hT(c,s,une)})))}}],[{key:`getWithHeight`,value:function(e,n){var r=vT(vT({},this.defaultProps),e.props).layout;return r===`vertical`&&Y(e.props.height)?{height:e.props.height}:r===`horizontal`?{width:e.props.width||n}:null}}])}(y.PureComponent);CT(ET,`displayName`,`Legend`),CT(ET,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var fne=s(((e,n)=>{var r=xb(),i=Qw(),a=vb(),o=r?r.isConcatSpreadable:void 0;function s(e){return a(e)||i(e)||!!(o&&e&&e[o])}n.exports=s})),DT=s(((e,n)=>{var r=Zw(),i=fne();function a(e,n,o,s,c){var l=-1,u=e.length;for(o||=i,c||=[];++l<u;){var d=e[l];n>0&&o(d)?n>1?a(d,n-1,o,s,c):r(c,d):s||(c[c.length]=d)}return c}n.exports=a})),pne=s(((e,n)=>{function r(e){return function(n,r,i){for(var a=-1,o=Object(n),s=i(n),c=s.length;c--;){var l=s[e?c:++a];if(r(o[l],l,o)===!1)break}return n}}n.exports=r})),mne=s(((e,n)=>{n.exports=pne()()})),OT=s(((e,n)=>{var r=mne(),i=oT();function a(e,n){return e&&r(e,n,i)}n.exports=a})),hne=s(((e,n)=>{var r=aT();function i(e,n){return function(i,a){if(i==null)return i;if(!r(i))return e(i,a);for(var o=i.length,s=n?o:-1,c=Object(i);(n?s--:++s<o)&&a(c[s],s,c)!==!1;);return i}}n.exports=i})),kT=s(((e,n)=>{var r=OT();n.exports=hne()(r)})),AT=s(((e,n)=>{var r=kT(),i=aT();function a(e,n){var a=-1,o=i(e)?Array(e.length):[];return r(e,function(e,r,i){o[++a]=n(e,r,i)}),o}n.exports=a})),gne=s(((e,n)=>{function r(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}n.exports=r})),_ne=s(((e,n)=>{var r=Eb();function i(e,n){if(e!==n){var i=e!==void 0,a=e===null,o=e===e,s=r(e),c=n!==void 0,l=n===null,u=n===n,d=r(n);if(!l&&!d&&!s&&e>n||s&&c&&u&&!l&&!d||a&&c&&u||!i&&u||!o)return 1;if(!a&&!s&&!d&&e<n||d&&i&&o&&!a&&!s||l&&i&&o||!c&&o||!u)return-1}return 0}n.exports=i})),vne=s(((e,n)=>{var r=_ne();function i(e,n,i){for(var a=-1,o=e.criteria,s=n.criteria,c=o.length,l=i.length;++a<c;){var u=r(o[a],s[a]);if(u)return a>=l?u:u*(i[a]==`desc`?-1:1)}return e.index-n.index}n.exports=i})),yne=s(((e,n)=>{var r=lx(),i=mx(),a=fT(),o=AT(),s=gne(),c=nT(),l=vne(),u=dT(),d=vb();function f(e,n,f){n=n.length?r(n,function(e){return d(e)?function(n){return i(n,e.length===1?e[0]:e)}:e}):[u];var p=-1;return n=r(n,c(a)),s(o(e,function(e,i,a){return{criteria:r(n,function(n){return n(e)}),index:++p,value:e}}),function(e,n){return l(e,n,f)})}n.exports=f})),bne=s(((e,n)=>{function r(e,n,r){switch(r.length){case 0:return e.call(n);case 1:return e.call(n,r[0]);case 2:return e.call(n,r[0],r[1]);case 3:return e.call(n,r[0],r[1],r[2])}return e.apply(n,r)}n.exports=r})),xne=s(((e,n)=>{var r=bne(),i=Math.max;function a(e,n,a){return n=i(n===void 0?e.length-1:n,0),function(){for(var o=arguments,s=-1,c=i(o.length-n,0),l=Array(c);++s<c;)l[s]=o[n+s];s=-1;for(var u=Array(n+1);++s<n;)u[s]=o[s];return u[n]=a(l),r(e,this,u)}}n.exports=a})),Sne=s(((e,n)=>{function r(e){return function(){return e}}n.exports=r})),jT=s(((e,n)=>{var r=Fb();n.exports=function(){try{var e=r(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),Cne=s(((e,n)=>{var r=Sne(),i=jT(),a=dT();n.exports=i?function(e,n){return i(e,`toString`,{configurable:!0,enumerable:!1,value:r(n),writable:!0})}:a})),wne=s(((e,n)=>{var r=800,i=16,a=Date.now;function o(e){var n=0,o=0;return function(){var s=a(),c=i-(s-o);if(o=s,c>0){if(++n>=r)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}n.exports=o})),Tne=s(((e,n)=>{var r=Cne();n.exports=wne()(r)})),Ene=s(((e,n)=>{var r=dT(),i=xne(),a=Tne();function o(e,n){return a(i(e,n,r),e+``)}n.exports=o})),MT=s(((e,n)=>{var r=Wb(),i=aT(),a=eT(),o=Ob();function s(e,n,s){if(!o(s))return!1;var c=typeof n;return(c==`number`?i(s)&&a(n,s.length):c==`string`&&n in s)?r(s[n],e):!1}n.exports=s})),NT=u(s(((e,n)=>{var r=DT(),i=yne(),a=Ene(),o=MT();n.exports=a(function(e,n){if(e==null)return[];var a=n.length;return a>1&&o(e,n[0],n[1])?n=[]:a>2&&o(n[0],n[1],n[2])&&(n=[n[0]]),i(e,r(n,1),[])})}))());function PT(e){"@babel/helpers - typeof";return PT=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},PT(e)}function FT(){return FT=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},FT.apply(this,arguments)}function Dne(e,n){return jne(e)||Ane(e,n)||kne(e,n)||One()}function One(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -161,5 +161,5 @@ $1`).replace(/(\s-\s)/g,`
|
|
|
161
161
|
`)?e:e.replace(/(#{1,3}\s+[^#])/g,`
|
|
162
162
|
$1`).replace(/(\d+\.\s+[^\d])/g,`
|
|
163
163
|
$1`).replace(/(\s-\s)/g,`
|
|
164
|
-
- `).trim()}function Ime(e){return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function Lme(e){return e?e.length<=16?e:e.slice(0,8)+`...`+e.slice(-8):`—`}function Rme(e,n=80){return e?e.length<=n?e:e.slice(0,n)+`...`:`—`}function zme({type:e}){return e===`auto`?(0,G.jsxs)(bJ,{variant:`secondary`,className:`text-xs bg-blue-100 text-blue-700 hover:bg-blue-100 border-blue-200`,children:[(0,G.jsx)(eh,{className:`size-3 mr-1`}),`自动注入`]}):(0,G.jsxs)(bJ,{variant:`outline`,className:`text-xs bg-emerald-50 text-emerald-700 hover:bg-emerald-50 border-emerald-200`,children:[(0,G.jsx)(Am,{className:`size-3 mr-1`}),`手动注入`]})}function Bme({category:e}){return(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs font-normal ${DJ(e)}`,children:e||`未分类`})}function S9({label:e,value:n,max:r=1}){let i=Math.max(0,Math.min(n,r))/r*100;return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{className:`font-medium`,children:n===0?`—`:`${i.toFixed(1)}%`})]}),(0,G.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-muted overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all`,style:{width:`${i}%`}})})]})}function Vme({relevance:e,isKept:n}){return n?e?e===`high`?(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-emerald-500/10 text-emerald-600 border-emerald-500/30`,children:`🟢 高相关`}):e===`medium`?(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-yellow-500/10 text-yellow-600 border-yellow-500/30`,children:`🟡 中相关`}):(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-muted text-muted-foreground border-border`,children:e||`—`}):(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-blue-500/10 text-blue-600 border-blue-500/30`,children:`🔵 保留`}):(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-red-500/10 text-red-600 border-red-500/30`,children:`🔴 被精炼掉`})}function Hme({item:e,memory:n,memoryLoading:r,vaultUnlocked:i,memoryUnlocked:a,onUnlock:o,onLock:s,onVaultUnlock:c}){let l=!!e.refine_relevance,[u,d]=(0,y.useState)(`raw`),[f,p]=(0,y.useState)(!1),[m,h]=(0,y.useState)(``),[g,_]=(0,y.useState)(null),v=Uy(e=>e.unlock),b=Uy(e=>e.isUnlocked),x=n?.visibility===`private`||(n?.tags||[]).some(e=>e===`私密`||e.toLowerCase()===`private`),S=x&&!a,C=async()=>{n&&(S?i||b?o?.(n.id):p(!0):(s?.(n.id),p(!1)))},w=async()=>{if(!m.trim()){_(`请输入密码`);return}await v(m)?(p(!1),h(``),_(null),c?.(),n&&o?.(n.id)):_(`密码错误`)};return(0,G.jsxs)(`div`,{className:`rounded-md border bg-muted/50 p-3 space-y-3 ${e.is_kept?`border-border`:`border-dashed border-red-500/30 opacity-75`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(Vme,{relevance:e.refine_relevance,isKept:e.is_kept}),(0,G.jsx)(Bme,{category:n?.category}),x&&(0,G.jsxs)(bJ,{variant:`secondary`,className:`text-xs bg-amber-100 text-amber-700 hover:bg-amber-100 border-amber-200`,children:[(0,G.jsx)(Om,{className:`size-3 mr-1`}),`私密`]}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:[e.memory_id?.slice(0,8),`...`]})]}),x&&(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),C()},className:`text-xs text-amber-500 hover:text-amber-600 flex items-center gap-1 shrink-0`,children:[S?(0,G.jsx)(Om,{className:`size-3`}):(0,G.jsx)(Dm,{className:`size-3`}),S?`解锁`:`锁定`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border pb-1`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>l&&d(`refine`),className:`text-xs px-2 py-1 rounded transition-colors ${l?u===`refine`?`bg-primary/10 text-primary font-medium`:`text-muted-foreground hover:text-foreground`:`text-muted-foreground/40 cursor-not-allowed`}`,children:`精炼`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>d(`raw`),className:`text-xs px-2 py-1 rounded transition-colors ${u===`raw`?`bg-primary/10 text-primary font-medium`:`text-muted-foreground hover:text-foreground`}`,children:`原始`})]}),u===`refine`?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[e.refine_reasoning?(0,G.jsxs)(`div`,{className:`text-sm text-foreground`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`推理说明:`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e.refine_reasoning})]}):(0,G.jsx)(`div`,{className:`text-sm text-muted-foreground italic`,children:`未经精炼 · 自动保留`}),(0,G.jsx)(S9,{label:`相似度得分`,value:e.score,max:1})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:r?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(_b,{className:`h-4 w-3/4`}),(0,G.jsx)(_b,{className:`h-4 w-1/2`})]}):n?(0,G.jsx)(G.Fragment,{children:S?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,G.jsx)(Om,{className:`size-4`}),(0,G.jsx)(`span`,{children:`私密记忆内容已隐藏`})]}),f&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sb,{type:`password`,placeholder:`输入 Vault 密码...`,value:m,onChange:e=>{h(e.target.value),_(null)},onKeyDown:e=>e.key===`Enter`&&w(),className:g?`border-destructive flex-1`:`flex-1`}),(0,G.jsx)(q,{size:`sm`,onClick:w,children:`解锁`})]}),g&&(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:g})]})]}):(0,G.jsx)(`div`,{className:`prose prose-sm dark:prose-invert max-w-none`,children:(0,G.jsx)(_0,{remarkPlugins:[i3],children:Fme(n.content||n.l0_abstract||`—`)})})}):(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`记忆内容加载失败`})})]})}function Ume({event:e,initialItems:n,isLast:r,defaultExpanded:i,vaultUnlocked:a,unlockedMemories:o,manuallyLocked:s,onUnlock:c,onLock:l,onVaultUnlock:u}){let[d,f]=(0,y.useState)(i||!1),[p,m]=(0,y.useState)(!0),[h,g]=(0,y.useState)(n??null),[_,v]=(0,y.useState)(new Map),[b,x]=(0,y.useState)(new Set);(0,y.useEffect)(()=>{n&&h===null&&g(n)},[n,h]);let S=(0,y.useCallback)(async e=>{try{x(n=>new Set(n).add(e));let n=await Vy.get(`/v1/memories/${e}`);v(r=>{let i=new Map(r);return i.set(e,n),i})}catch(e){console.error(`Failed to fetch memory:`,e)}finally{x(n=>{let r=new Set(n);return r.delete(e),r})}},[]),C=(0,y.useRef)(new Set);(0,y.useEffect)(()=>{!d||!h||h.length===0||h.forEach(e=>{C.current.has(e.memory_id)||(C.current.add(e.memory_id),S(e.memory_id))})},[d,h,S]);let w=e=>a&&!s.has(e)||o.has(e);return(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,G.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full bg-primary ring-4 ring-primary/20`}),!r&&(0,G.jsx)(`div`,{className:`w-px flex-1 bg-border mt-1`})]}),(0,G.jsx)(`div`,{className:`flex-1 pb-6`,children:(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-card transition-colors hover:bg-muted/50`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>f(!d),className:`w-full text-left p-4 cursor-pointer`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(zme,{type:e.recall_type}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,G.jsx)(rm,{className:`size-3`}),Ime(e.created_at)]})]}),d?(0,G.jsx)(em,{className:`size-4 text-muted-foreground`}):(0,G.jsx)(Zp,{className:`size-4 text-muted-foreground`})]}),(0,G.jsxs)(`div`,{className:`mt-2 text-sm text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(Im,{className:`size-3.5`}),(0,G.jsx)(`span`,{className:`line-clamp-1`,title:e.query_text||`—`,children:Rme(e.query_text)})]})]}),d&&(0,G.jsxs)(`div`,{className:`px-4 pb-4 space-y-4 border-t border-border pt-4`,children:[e.profile_content&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[(0,G.jsx)(Kp,{className:`size-3`}),`画像注入内容`]}),(0,G.jsx)(`div`,{className:`rounded-md border border-indigo-500/20 bg-indigo-500/5 p-3`,children:(0,G.jsx)(`div`,{className:`prose prose-sm dark:prose-invert max-w-none text-sm text-indigo-700 dark:text-indigo-300`,children:(0,G.jsx)(_0,{remarkPlugins:[i3],children:e.profile_content.replace(/<\/?cerebro-profile>/g,``).trim()})})})]}),e.injected_content&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>m(!p),className:`flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:[(0,G.jsx)(im,{className:`size-3`}),`注入内容`,p?(0,G.jsx)(em,{className:`size-3`}):(0,G.jsx)(Zp,{className:`size-3`})]}),p&&(0,G.jsx)(`div`,{className:`rounded-md border border-emerald-500/20 bg-emerald-500/5 p-3 max-h-96 overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`prose prose-sm dark:prose-invert max-w-none text-sm text-emerald-700 dark:text-emerald-300`,children:(0,G.jsx)(_0,{remarkPlugins:[i3],children:e.injected_content.replace(/<\/?cerebro-context>/g,``).trim()})})})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[(0,G.jsx)(Kp,{className:`size-3`}),`关联记忆`]})}),h&&h.length>0?(0,G.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,G.jsx)(Hme,{item:e,memory:_.get(e.memory_id)||null,memoryLoading:b.has(e.memory_id),vaultUnlocked:a,memoryUnlocked:w(e.memory_id),onUnlock:c,onLock:l,onVaultUnlock:u},e.id))}):(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`暂无召回项`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[(0,G.jsx)(Yp,{className:`size-3`}),`匹配指标`]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,G.jsx)(S9,{label:`最大相似度`,value:e.max_score}),(0,G.jsx)(S9,{label:`LLM 置信度`,value:e.llm_confidence})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:`统计:`}),(0,G.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[`保留 `,e.kept_count,` 条`]}),e.discarded_count>0&&(0,G.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`精炼掉 `,e.discarded_count,` 条`]}),e.injected_count!=null&&e.injected_count>0&&(0,G.jsxs)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:[`实际注入 `,e.injected_count,` 条`]}),e.profile_injected&&(0,G.jsx)(`span`,{className:`text-indigo-600 dark:text-indigo-400`,children:`👤 画像已注入`})]})]})]})})]})}function Wme(){let{id:e}=it(),n=et(),r=Ze(),i=()=>{let e=r.state;e?.from?n(e.from,{replace:!0}):n(-1)},a=e?decodeURIComponent(e):``,[o,s]=(0,y.useState)([]),[c,l]=(0,y.useState)(new Map),[u,d]=(0,y.useState)(!0),[f,p]=(0,y.useState)(null),[m,h]=(0,y.useState)(1),[g,_]=(0,y.useState)(!1),[v,b]=(0,y.useState)(!1),[x,S]=(0,y.useState)(``),[C,w]=(0,y.useState)(null),T=Uy(e=>e.unlock),E=Uy(e=>e.lock),[D,O]=(0,y.useState)(!1),[k,A]=(0,y.useState)(new Set),[j,M]=(0,y.useState)(new Set),[N,P]=(0,y.useState)(null),F=Math.ceil(o.length/10),I=o.slice((m-1)*10,m*10);(0,y.useEffect)(()=>{if(!a)return;async function e(){try{d(!0),p(null);let e=await Vy.get(`/v1/recall-events`,{params:{session_id:a,limit:1e4,offset:0,expand:`items`}});if(s((e?.events||[]).sort((e,n)=>new Date(n.created_at).getTime()-new Date(e.created_at).getTime())),e?.event_items){let n=new Map;e.event_items.forEach(e=>n.set(e.id,e.items||[])),l(n)}}catch(e){console.error(`Failed to fetch session detail:`,e),p(`加载 Session 详情失败`),ir.error(`加载 Session 详情失败`)}finally{d(!1)}}e()},[a]);let L=()=>{_(!0)},R=async()=>{try{await Vy.delete(`/v1/session-recalls/session/${a}`),ir.success(`Session 记录已删除`),n(-1)}catch(e){console.error(`Failed to delete session records:`,e),ir.error(`删除失败`)}finally{_(!1)}},z=async()=>{if(!x.trim()){w(`请输入密码`);return}if(!await T(x)){w(`密码错误`);return}O(!0),N&&(A(e=>new Set(e).add(N)),P(null)),w(null),b(!1),S(``)},ee=()=>{O(!1),A(new Set),M(new Set),E()},B=e=>{k.has(e)||D&&!j.has(e)?(M(n=>new Set(n).add(e)),A(n=>{let r=new Set(n);return r.delete(e),r})):D?M(n=>{let r=new Set(n);return r.delete(e),r}):(P(e),b(!0))},V={total:o.length,auto:o.filter(e=>e.recall_type===`auto`).length,manual:o.filter(e=>e.recall_type===`manual`).length,totalKept:o.reduce((e,n)=>e+n.kept_count,0),totalDiscarded:o.reduce((e,n)=>e+n.discarded_count,0)};return u?(0,G.jsxs)(`div`,{className:`space-y-6 max-w-3xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(_b,{className:`h-8 w-8`}),(0,G.jsx)(_b,{className:`h-6 w-32`})]}),(0,G.jsx)(_b,{className:`h-4 w-1/2`}),(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsx)(_b,{className:`h-3 w-3 rounded-full`}),(0,G.jsx)(`div`,{className:`flex-1 space-y-2`,children:(0,G.jsx)(_b,{className:`h-20 w-full`})})]},e))})]}):f?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:()=>i(),children:[(0,G.jsx)(Vp,{className:`size-4 mr-1.5`}),`返回`]}),(0,G.jsx)(`div`,{className:`rounded-lg border border-destructive/50 bg-destructive/10 p-6 text-sm text-destructive`,children:f})]}):(0,G.jsxs)(`div`,{className:`space-y-6 max-w-3xl`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:()=>i(),children:[(0,G.jsx)(Vp,{className:`size-4 mr-1.5`}),`返回`]})})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:[`Session 详情 - `,Lme(a)]}),(0,G.jsx)(`div`,{className:`flex items-center gap-3 text-sm text-muted-foreground flex-wrap`,children:(0,G.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:a})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,G.jsx)(fb,{children:(0,G.jsxs)(gb,{className:`pt-4 text-center`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold`,children:V.total}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`总召回事件`})]})}),(0,G.jsx)(fb,{children:(0,G.jsxs)(gb,{className:`pt-4 text-center`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold`,children:V.auto}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`自动注入`})]})}),(0,G.jsx)(fb,{children:(0,G.jsxs)(gb,{className:`pt-4 text-center`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold`,children:V.manual}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`手动注入`})]})})]}),V.totalKept>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,G.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400 font-medium`,children:[`共保留 `,V.totalKept,` 条记忆`]}),V.totalDiscarded>0&&(0,G.jsxs)(`span`,{className:`text-red-600 dark:text-red-400 font-medium`,children:[`共精炼掉 `,V.totalDiscarded,` 条记忆`]})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:`召回事件时间线`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`共 `,o.length,` 个事件`]}),F>1&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>h(e=>Math.max(1,e-1)),disabled:m===1,children:(0,G.jsx)(Qp,{className:`size-3`})}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground min-w-[3ch] text-center`,children:[m,`/`,F]}),(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>h(e=>Math.min(F,e+1)),disabled:m===F,children:(0,G.jsx)($p,{className:`size-3`})})]}),D?(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:ee,children:[(0,G.jsx)(Om,{className:`size-3.5 mr-1`}),`锁定 Vault`]}):(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>b(!v),children:[(0,G.jsx)(Dm,{className:`size-3.5 mr-1`}),`解锁 Vault`]})]})]}),v&&(0,G.jsxs)(`div`,{className:`space-y-2 max-w-md`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sb,{type:`password`,placeholder:`输入 Vault 密码...`,value:x,onChange:e=>{S(e.target.value),w(null)},onKeyDown:e=>e.key===`Enter`&&z(),className:C?`border-destructive flex-1`:`flex-1`}),(0,G.jsx)(q,{size:`sm`,onClick:z,children:`解锁`})]}),C&&(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:C})]}),o.length===0?(0,G.jsx)(`div`,{className:`rounded-lg border border-border bg-card p-8 text-center text-sm text-muted-foreground`,children:`暂无召回事件`}):(0,G.jsxs)(G.Fragment,{children:[I.map((e,n)=>(0,G.jsx)(Ume,{event:e,initialItems:c.get(e.id),isLast:n===I.length-1&&m===F,defaultExpanded:n===0&&m===1,vaultUnlocked:D,unlockedMemories:k,manuallyLocked:j,onUnlock:B,onLock:B,onVaultUnlock:()=>O(!0)},e.id)),F>1&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-4`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`共 `,o.length,` 个事件`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>h(e=>Math.max(1,e-1)),disabled:m===1,children:(0,G.jsx)(Qp,{className:`size-4`})}),(0,G.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[m,` / `,F]}),(0,G.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>h(e=>Math.min(F,e+1)),disabled:m===F,children:(0,G.jsx)($p,{className:`size-4`})})]})]})]})]}),o.length>0&&(0,G.jsx)(`div`,{className:`pt-4 border-t border-border`,children:(0,G.jsxs)(q,{variant:`outline`,size:`sm`,className:`text-destructive hover:bg-destructive/10 hover:text-destructive`,onClick:L,children:[(0,G.jsx)(Km,{className:`size-3.5 mr-1`}),`删除 Session 所有记录`]})}),(0,G.jsx)(uJ,{open:g,onOpenChange:e=>!e&&_(!1),children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除 Session 记录`}),(0,G.jsx)(hJ,{children:`此操作将删除该 Session 的所有召回记录,不可撤销。确定要继续吗?`})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{onClick:()=>_(!1),children:`取消`}),(0,G.jsx)(gJ,{onClick:R,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`删除`})]})]})})]})}function C9({...e}){return(0,G.jsx)(yg,{"data-slot":`dialog`,...e})}function Gme({...e}){return(0,G.jsx)(xg,{"data-slot":`dialog-trigger`,...e})}function Kme({...e}){return(0,G.jsx)(tg,{"data-slot":`dialog-portal`,...e})}function qme({className:e,...n}){return(0,G.jsx)(Dh,{"data-slot":`dialog-overlay`,className:Tp(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})}function w9({className:e,children:n,showCloseButton:r=!0,...i}){return(0,G.jsxs)(Kme,{children:[(0,G.jsx)(qme,{}),(0,G.jsxs)($h,{"data-slot":`dialog-content`,className:Tp(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...i,children:[n,r&&(0,G.jsxs)(Oh,{"data-slot":`dialog-close`,render:(0,G.jsx)(q,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,G.jsx)($m,{}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function T9({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`dialog-header`,className:Tp(`flex flex-col gap-2`,e),...n})}function E9({className:e,showCloseButton:n=!1,children:r,...i}){return(0,G.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Tp(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...i,children:[r,n&&(0,G.jsx)(Oh,{render:(0,G.jsx)(q,{variant:`outline`}),children:`Close`})]})}function D9({className:e,...n}){return(0,G.jsx)(bg,{"data-slot":`dialog-title`,className:Tp(`text-base leading-none font-medium`,e),...n})}function O9({className:e,...n}){return(0,G.jsx)(kh,{"data-slot":`dialog-description`,className:Tp(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...n})}function Jme(){let[e,n]=(0,y.useState)([]),[r,i]=(0,y.useState)(!0),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(`team`),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(`member`),[b,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)({}),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)(`member`),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)(null),[I,L]=(0,y.useState)(!1),R=dh(e=>e.currentUserId),z=dh(e=>e.users.find(e=>e.id===R)),ee=e.find(e=>e.id===p),B=e=>z?e.owner_id===z.apiKey||e.members.some(e=>e.user_id===z.apiKey&&(e.role===`admin`||e.role===`Admin`)):!1;(0,y.useEffect)(()=>{async function e(){if(!ee?.members?.length)return;T(!0);let e={};await Promise.all(ee.members.map(async n=>{try{let r=await Vy.get(`/v1/tenants/${encodeURIComponent(n.user_id)}`);r&&(e[n.user_id]={name:r.name,created_at:r.created_at})}catch{}})),C(e),T(!1)}p&&e()},[p,ee?.members]),(0,y.useEffect)(()=>{async function e(){try{i(!0),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to fetch spaces:`,e),ir.error(`加载空间列表失败`)}finally{i(!1)}}e()},[]);async function V(){if(!s.trim()){ir.error(`请输入空间名称`);return}try{await Vy.post(`/v1/spaces`,{name:s.trim(),space_type:l}),ir.success(`空间创建成功`),o(!1),c(``),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to create space:`,e),ir.error(`空间创建失败`)}}async function H(){if(!d)return;let r=e.find(e=>e.id===d)?.members.map(e=>e.user_id).filter(e=>e!==z?.apiKey)||[];try{await Vy.delete(`/v1/spaces/${encodeURIComponent(d)}`),ir.success(`空间已删除`),n(e=>e.filter(e=>e.id!==d)),dh.getState().removeUsersByApiKeys(r)}catch(e){console.error(`Failed to delete space:`,e),ir.error(`空间删除失败`)}finally{f(null)}}async function U(){if(p){N(!0);try{let e=await Vy.post(`/v1/tenants`,{name:O.trim()||void 0}),r=e.id,i=e.api_key;await Vy.post(`/v1/spaces/${encodeURIComponent(p)}/members`,{user_id:r,role:A}),F(i),ir.success(`新用户创建并加入空间成功`),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to create user:`,e);let n=e.response?.data?.error||e.message||``;ir.error(`创建用户失败:${n||`请稍后重试`}`)}finally{N(!1)}}}async function te(e){if(p)try{await Vy.delete(`/v1/spaces/${encodeURIComponent(p)}/members/${encodeURIComponent(e)}`),ir.success(`成员已移除`),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to remove member:`,e);let n=e.response?.data?.error||e.message||``;ir.error(`移除成员失败:${n||`请稍后重试`}`)}}async function W(){if(!p||!h.trim()){ir.error(`请输入用户ID`);return}let e=h.trim();if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)){ir.error(`用户ID格式不正确,请输入有效的 UUID(如:c60beb98-7aab-4985-8c1d-29ffd6aff75a)`);return}x(!0);try{await Vy.post(`/v1/spaces/${encodeURIComponent(p)}/members`,{user_id:e,role:_}),ir.success(`成员添加成功`),g(``),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to add member:`,e);let n=e.response?.data?.error||e.message||``;n.includes(`not found`)||n.includes(`不存在`)?ir.error(`该用户不存在,请确认用户ID正确`):n.includes(`permission`)||n.includes(`权限`)?ir.error(`您没有权限添加成员`):ir.error(`添加成员失败:${n||`请检查用户ID是否正确`}`)}finally{x(!1)}}return r?(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`空间管理`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`管理您的记忆空间`})]}),(0,G.jsx)(_b,{className:`h-9 w-24`})]}),(0,G.jsx)(`div`,{className:`grid gap-4`,children:[1,2].map(e=>(0,G.jsx)(_b,{className:`h-32 w-full`},e))})]}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`空间管理`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`管理您的记忆空间`})]}),(0,G.jsxs)(C9,{open:a,onOpenChange:o,children:[(0,G.jsx)(Gme,{render:(0,G.jsxs)(q,{size:`sm`,children:[(0,G.jsx)(Mm,{className:`size-4 mr-1.5`}),`新建空间`]})}),(0,G.jsxs)(w9,{children:[(0,G.jsx)(T9,{children:(0,G.jsx)(D9,{children:`新建空间`})}),(0,G.jsxs)(`div`,{className:`space-y-4 pt-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`空间名称`}),(0,G.jsx)(sb,{placeholder:`输入空间名称`,value:s,onChange:e=>c(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`空间类型`}),(0,G.jsxs)(d9,{value:l,onValueChange:e=>u(e||`team`),children:[(0,G.jsx)(p9,{children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`team`,children:`团队`}),(0,G.jsx)(h9,{value:`personal`,children:`个人`}),(0,G.jsx)(h9,{value:`shared`,children:`共享`})]})]})]}),(0,G.jsx)(q,{className:`w-full`,onClick:V,children:`创建`})]})]})]})]}),e.length===0?(0,G.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground border border-dashed border-border rounded-lg`,children:[(0,G.jsx)(`p`,{children:`暂无空间`}),(0,G.jsx)(`p`,{className:`text-sm mt-1`,children:`点击右上角按钮创建新空间`})]}):(0,G.jsx)(`div`,{className:`grid gap-4`,children:e.map(e=>(0,G.jsxs)(fb,{className:`group transition-colors hover:bg-accent/50`,children:[(0,G.jsx)(pb,{className:`pb-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold`,children:e.name}),(0,G.jsx)(bJ,{variant:`outline`,children:e.space_type})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,G.jsx)(Rm,{className:`size-3`}),e.members.length,` 成员`]}),(0,G.jsxs)(q,{variant:`ghost`,size:`sm`,className:`h-7 opacity-0 group-hover:opacity-100 transition-opacity`,onClick:()=>{m(e.id),g(``),v(`member`)},children:[(0,G.jsx)(Xm,{className:`size-3.5 mr-1`}),`管理成员`]}),e.space_type!==`personal`&&B(e)&&(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7 opacity-0 group-hover:opacity-100 transition-opacity`,onClick:()=>f(e.id),children:(0,G.jsx)(Km,{className:`size-3.5 text-destructive`})})]})]})}),(0,G.jsxs)(gb,{className:`pt-0 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-muted-foreground flex-wrap`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Qm,{className:`size-3.5`}),e.members.map(e=>e.role).join(`, `)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Jp,{className:`size-3.5`}),new Date(e.created_at).toLocaleDateString(`zh-CN`)]})]}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground font-mono`,children:[`ID: `,e.id]})]})]},e.id))}),(0,G.jsx)(uJ,{open:!!d,onOpenChange:e=>!e&&f(null),children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除空间`}),(0,G.jsx)(hJ,{children:`此操作不可撤销。空间内的数据不会被删除,但空间配置将被移除。`})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{onClick:()=>f(null),children:`取消`}),(0,G.jsx)(gJ,{onClick:H,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`删除`})]})]})}),(0,G.jsx)(C9,{open:!!p,onOpenChange:e=>!e&&m(null),children:(0,G.jsxs)(w9,{style:{width:680,maxWidth:`95vw`},children:[(0,G.jsx)(T9,{children:(0,G.jsxs)(D9,{children:[`管理成员 - `,ee?.name]})}),(0,G.jsxs)(`div`,{className:`space-y-4 pt-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`当前成员`}),w&&(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`加载用户信息中...`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[ee?.members.map(e=>{let n=S[e.user_id];return(0,G.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr_80px_60px] items-center gap-3 text-sm border rounded-md px-3 py-2`,children:[(0,G.jsx)(Zm,{className:`size-3.5 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-xs truncate`,title:e.user_id,children:e.user_id}),n&&(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[n.name,` · `,new Date(n.created_at).toLocaleDateString(`zh-CN`)]})]}),(0,G.jsx)(bJ,{variant:`outline`,className:`justify-self-center`,children:e.role}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 justify-self-end`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e.user_id),ir.success(`API Key 已复制`)},className:`text-muted-foreground hover:text-foreground transition-colors`,title:`复制 API Key`,children:(0,G.jsx)(am,{className:`size-3.5`})}),ee&&B(ee)&&e.user_id!==z?.apiKey&&e.user_id!==ee?.owner_id&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>te(e.user_id),className:`text-muted-foreground hover:text-destructive transition-colors`,title:`移除成员`,children:(0,G.jsx)(Km,{className:`size-3.5`})})]})]},e.user_id)}),(!ee?.members||ee.members.length===0)&&(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`暂无成员`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`添加成员`}),(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>{D(!0),F(null),k(``),j(`member`)},children:[(0,G.jsx)(bm,{className:`size-3.5 mr-1.5`}),`创建新用户`]})]}),E&&(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/30 p-3 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`创建新用户`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{D(!1),F(null)},className:`text-xs text-muted-foreground hover:text-foreground`,children:`取消`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sb,{placeholder:`用户名(可选)`,value:O,onChange:e=>k(e.target.value),className:`flex-1`}),(0,G.jsxs)(d9,{value:A,onValueChange:e=>j(e||`member`),children:[(0,G.jsx)(p9,{className:`w-28`,children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`admin`,children:`管理员`}),(0,G.jsx)(h9,{value:`member`,children:`成员`}),(0,G.jsx)(h9,{value:`reader`,children:`只读`})]})]})]}),(0,G.jsx)(q,{size:`sm`,className:`w-full`,onClick:U,disabled:M,children:M?`生成中...`:`生成用户并添加到空间`}),P&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`新用户 API Key(请复制保存):`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`code`,{className:`flex-1 text-xs bg-background border rounded px-2 py-1.5 font-mono truncate`,children:P}),(0,G.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>{navigator.clipboard.writeText(P),L(!0),setTimeout(()=>L(!1),2e3)},children:I?(0,G.jsx)(Xp,{className:`size-3.5`}):(0,G.jsx)(am,{className:`size-3.5`})})]})]})]}),!E&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sb,{placeholder:`输入对方 API Key(UUID格式)`,value:h,onChange:e=>g(e.target.value),className:`flex-1`}),(0,G.jsxs)(d9,{value:_,onValueChange:e=>v(e||`member`),children:[(0,G.jsx)(p9,{className:`w-28`,children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`admin`,children:`管理员`}),(0,G.jsx)(h9,{value:`member`,children:`成员`}),(0,G.jsx)(h9,{value:`reader`,children:`只读`})]})]}),(0,G.jsx)(q,{size:`sm`,onClick:W,disabled:b,children:b?`添加中...`:`添加`})]})]})]})]})})]})}var k9=[`#8b5cf6`,`#ec4899`,`#06b6d4`,`#f59e0b`,`#10b981`,`#ef4444`,`#6366f1`,`#f97316`];function A9(e,n){if(!e)return[];let r=Object.entries(e).map(([e,n])=>({name:e,value:n})).sort((e,n)=>n.value-e.value);return n?r.slice(0,n):r}function Yme(){let e=et(),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)([]),[o,s]=(0,y.useState)(!0);(0,y.useEffect)(()=>{async function e(){try{s(!0);let[e,n]=await Promise.all([Vy.get(`/v1/stats`),Vy.get(`/v1/memories`)]);r(e),a(n?.memories||[])}catch(e){ir.error(`加载统计数据失败: `+e.message)}finally{s(!1)}}e()},[]);let c=(0,y.useMemo)(()=>{if(!n?.timeline?.length)return 0;let e=new Date().toISOString().split(`T`)[0];return n.timeline.find(n=>n.date===e)?.count??0},[n]),l=(0,y.useMemo)(()=>A9(n?.by_category,8),[n]),u=(0,y.useMemo)(()=>A9(n?.by_type),[n]),d=(0,y.useMemo)(()=>A9(n?.by_tier),[n]),f=(0,y.useMemo)(()=>A9(n?.by_state),[n]),p=(0,y.useMemo)(()=>A9(n?.by_visibility),[n]),m=(0,y.useMemo)(()=>A9(n?.by_agent,10),[n]),h=(0,y.useMemo)(()=>A9(n?.by_source,10),[n]),g=(0,y.useMemo)(()=>!n||!n.total||!n.total_access_count?`0%`:`${Math.min(100,Math.round(n.total_access_count/Math.max(1,n.total)*100))}%`,[n]),_=(0,y.useMemo)(()=>{let e=[];for(let n of i)if(n.tier_history)try{let r=JSON.parse(n.tier_history);for(let i of r)e.push({memoryId:n.id,...i})}catch{}return e.sort((e,n)=>n.at.localeCompare(e.at)),e.slice(0,50)},[i]),v={access_via_get:`访问触发`,access_via_search:`搜索触发`,access_via_recall:`召回触发`,access_via_cross_space_search:`跨空间搜索触发`,scheduled_evaluation:`定时评估`};return o?(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(_b,{className:`h-8 w-48`}),(0,G.jsx)(_b,{className:`h-8 w-24`})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,G.jsx)(_b,{className:`h-24`}),(0,G.jsx)(_b,{className:`h-24`}),(0,G.jsx)(_b,{className:`h-24`}),(0,G.jsx)(_b,{className:`h-24`})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsx)(_b,{className:`h-80`}),(0,G.jsx)(_b,{className:`h-80`}),(0,G.jsx)(_b,{className:`h-80`}),(0,G.jsx)(_b,{className:`h-80`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight flex items-center gap-2`,children:[(0,G.jsx)(Yp,{className:`size-5`}),`统计分析`]}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`记忆库数据洞察与可视化`})]}),(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>e(`/memories`),children:[(0,G.jsx)(Vp,{className:`size-4 mr-1.5`}),`返回记忆`]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`总记忆数`}),(0,G.jsx)(qp,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:n?.total??0})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`今日新增`}),(0,G.jsx)(qm,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:c})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`空间数`}),(0,G.jsx)(Sm,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:n?.total_spaces??Object.keys(n?.by_space??{}).length})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`活跃度`}),(0,G.jsx)(Wm,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:g})})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`平均重要性`}),(0,G.jsx)(Vm,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:n?.avg_importance?`${(n.avg_importance*100).toFixed(0)}%`:`—`})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`平均置信度`}),(0,G.jsx)(Yp,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:n?.avg_confidence?`${(n.avg_confidence*100).toFixed(0)}%`:`—`})})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`分类分布`})}),(0,G.jsxs)(gb,{children:[(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(tJ,{children:[(0,G.jsx)(TB,{data:l,cx:`50%`,cy:`50%`,innerRadius:60,outerRadius:100,paddingAngle:2,dataKey:`value`,children:l.map((e,n)=>(0,G.jsx)(OE,{fill:k9[n%k9.length]},`cell-${e.name}`))}),(0,G.jsx)(lE,{})]})}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-4 justify-center`,children:l.map((e,n)=>(0,G.jsxs)(bJ,{variant:`secondary`,style:{backgroundColor:`${k9[n%k9.length]}20`,color:k9[n%k9.length]},children:[e.name,` (`,e.value,`)`]},e.name))})]})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`记忆类型分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(eJ,{data:u,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,stroke:`#333`}),(0,G.jsx)(dK,{dataKey:`name`,tick:{fontSize:12}}),(0,G.jsx)(OK,{tick:{fontSize:12}}),(0,G.jsx)(lE,{}),(0,G.jsx)(qV,{dataKey:`value`,fill:`#8b5cf6`,radius:[4,4,0,0]})]})})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`层级分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(tJ,{children:[(0,G.jsx)(TB,{data:d,cx:`50%`,cy:`50%`,outerRadius:100,dataKey:`value`,label:({name:e,value:n})=>`${e}: ${n}`,children:d.map((e,n)=>(0,G.jsx)(OE,{fill:k9[n%k9.length]},`tier-${e.name}`))}),(0,G.jsx)(lE,{})]})})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`状态分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(eJ,{data:f,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,stroke:`#333`}),(0,G.jsx)(dK,{dataKey:`name`,tick:{fontSize:12}}),(0,G.jsx)(OK,{tick:{fontSize:12}}),(0,G.jsx)(lE,{}),(0,G.jsx)(qV,{dataKey:`value`,fill:`#10b981`,radius:[4,4,0,0]})]})})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`可见性分布`})}),(0,G.jsxs)(gb,{children:[(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(tJ,{children:[(0,G.jsx)(TB,{data:p,cx:`50%`,cy:`50%`,innerRadius:60,outerRadius:100,paddingAngle:2,dataKey:`value`,children:p.map((e,n)=>(0,G.jsx)(OE,{fill:k9[n%k9.length]},`vis-${e.name}`))}),(0,G.jsx)(lE,{})]})}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-4 justify-center`,children:p.map((e,n)=>(0,G.jsxs)(bJ,{variant:`secondary`,style:{backgroundColor:`${k9[n%k9.length]}20`,color:k9[n%k9.length]},children:[e.name,` (`,e.value,`)`]},e.name))})]})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`Agent 分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(eJ,{data:m,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,stroke:`#333`}),(0,G.jsx)(dK,{dataKey:`name`,tick:{fontSize:12}}),(0,G.jsx)(OK,{tick:{fontSize:12}}),(0,G.jsx)(lE,{}),(0,G.jsx)(qV,{dataKey:`value`,fill:`#6366f1`})]})})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`来源分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(eJ,{data:h,layout:`vertical`,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,stroke:`#333`}),(0,G.jsx)(dK,{type:`number`,tick:{fontSize:12}}),(0,G.jsx)(OK,{type:`category`,dataKey:`name`,tick:{fontSize:12},width:80}),(0,G.jsx)(lE,{}),(0,G.jsx)(qV,{dataKey:`value`,fill:`#f59e0b`,radius:[0,4,4,0]})]})})})]})]}),(0,G.jsxs)(fb,{className:`mt-4`,children:[(0,G.jsx)(pb,{children:(0,G.jsxs)(mb,{className:`flex items-center gap-1.5 text-base`,children:[(0,G.jsx)(hm,{className:`size-4 text-muted-foreground`}),`Tier 变更日志`]})}),(0,G.jsx)(gb,{children:_.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground py-4 text-center`,children:`暂无变更记录`}):(0,G.jsx)(`div`,{className:`space-y-1`,children:_.map(n=>{let r={peripheral:0,working:1,core:2};return(0,G.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 text-sm py-2 border-b last:border-b-0 hover:bg-muted/50 px-2 rounded cursor-pointer w-full text-left`,onClick:()=>e(`/memories/${n.memoryId}`),children:[(r[n.from]??0)<(r[n.to]??0)?(0,G.jsx)(Wp,{className:`size-4 text-emerald-500 shrink-0`}):(0,G.jsx)(Bp,{className:`size-4 text-red-500 shrink-0`}),(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs w-36 shrink-0`,children:new Date(n.at).toLocaleString(`zh-CN`)}),(0,G.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[n.memoryId.slice(0,8),`...`]}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(n.from),children:OJ(n.from)}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(n.to),children:OJ(n.to)}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground ml-auto`,children:[v[n.reason]||n.reason,` · #`,n.access_count]})]},n.memoryId+n.at)})})})]})]})}var Xme={access_via_get:`访问触发`,access_via_search:`搜索触发`,access_via_recall:`召回触发`,access_via_cross_space_search:`跨空间搜索触发`,scheduled_evaluation:`定时评估`},j9=20;function Zme(){let e=et(),n=Ze(),[r,i]=(0,y.useState)([]),[a,o]=(0,y.useState)(!0),[s,c]=(0,y.useState)(1),[l,u]=(0,y.useState)(`all`),[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1),[b,x]=(0,y.useState)(0);(0,y.useEffect)(()=>{n.state?.from===`tier-history`&&n.state?.page&&c(n.state.page)},[n.state]),(0,y.useEffect)(()=>{let e=setTimeout(()=>{m(d)},300);return()=>clearTimeout(e)},[d]);let S=(0,y.useCallback)(async e=>{o(!0);try{let n=(e-1)*j9,r={limit:String(j9),offset:String(n)};l===`promote`?r.filter=`promote`:l===`demote`&&(r.filter=`demote`),p.trim()&&(r.search=p.trim());let a=await Vy.get(`/v1/tier-changes`,{params:r});i(a.changes),x(a.totalCount)}catch(e){console.error(`Failed to fetch tier history:`,e)}finally{o(!1)}},[l,p]);(0,y.useEffect)(()=>{S(s)},[S,s]);let C=Math.max(1,Math.ceil(b/j9)),w=Math.min(s,C),T={peripheral:0,working:1,core:2},E=async()=>{if(!h)return;let e=h;v(!0);try{await Vy.post(`/v1/tier-changes/delete`,{memory_id:e.memoryId,from:e.from,to:e.to,at:e.at,reason:e.reason}),ir.success(`已删除该条变更记录`),i(n=>n.filter(n=>!(n.memoryId===e.memoryId&&n.from===e.from&&n.to===e.to&&n.at===e.at))),x(e=>Math.max(0,e-1))}catch(e){console.error(`Failed to delete tier history entry:`,e),ir.error(`删除失败`)}finally{v(!1),g(null)}},D=n=>{e(`/memories/${n}`,{state:{from:`tier-history`,page:w}})};return(0,G.jsxs)(`div`,{className:`space-y-6 max-w-5xl mx-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight flex items-center gap-2`,children:[(0,G.jsx)(hm,{className:`size-5`}),`等级变更历史`]}),(0,G.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`共 `,b,` 条记录`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-xs`,children:[(0,G.jsx)(Im,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground`}),(0,G.jsx)(`input`,{type:`text`,placeholder:`搜索标题、ID、原因...`,value:d,onChange:e=>{f(e.target.value),c(1)},className:`w-full h-9 pl-8 pr-3 rounded-md border border-input bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring`})]}),(0,G.jsxs)(d9,{value:l,onValueChange:e=>{e&&(u(e),c(1))},children:[(0,G.jsx)(p9,{className:`w-[130px]`,children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`all`,children:`全部`}),(0,G.jsx)(h9,{value:`promote`,children:`仅晋升`}),(0,G.jsx)(h9,{value:`demote`,children:`仅降级`})]})]})]}),!a&&r.length>0&&C>1&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`第 `,w,` / `,C,` 页`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(q,{variant:`outline`,size:`sm`,className:`h-7 px-2`,disabled:w<=1,onClick:()=>c(w-1),children:(0,G.jsx)(Qp,{className:`size-4`})}),Array.from({length:C},(e,n)=>n+1).filter(e=>e===1||e===C||Math.abs(e-w)<=2).map((e,n,r)=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[n>0&&r[n-1]!==e-1&&(0,G.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`}),(0,G.jsx)(q,{variant:e===w?`default`:`outline`,size:`sm`,className:`h-7 w-7 px-0`,onClick:()=>c(e),children:e})]},e)),(0,G.jsx)(q,{variant:`outline`,size:`sm`,className:`h-7 px-2`,disabled:w>=C,onClick:()=>c(w+1),children:(0,G.jsx)($p,{className:`size-4`})})]})]}),(0,G.jsx)(fb,{children:(0,G.jsxs)(gb,{className:`p-0`,children:[a?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground py-12 text-center`,children:`加载中...`}):r.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground py-12 text-center`,children:`暂无变更记录`}):(0,G.jsx)(`div`,{className:`divide-y`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 hover:bg-muted/30 transition-colors`,children:[(T[e.from]??0)<(T[e.to]??0)?(0,G.jsx)(Wp,{className:`size-4 text-emerald-500 shrink-0`}):(0,G.jsx)(Bp,{className:`size-4 text-red-500 shrink-0`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground w-36 shrink-0`,children:new Date(e.at).toLocaleString(`zh-CN`)}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(e.from),children:OJ(e.from)}),(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(e.to),children:OJ(e.to)}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground w-20 shrink-0`,children:Xme[e.reason]||e.reason}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground w-16 shrink-0`,children:[`#`,e.accessCount]}),(0,G.jsx)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left text-sm truncate hover:underline cursor-pointer`,onClick:()=>D(e.memoryId),title:e.memoryTitle,children:e.memoryTitle}),(0,G.jsxs)(`span`,{className:`text-xs font-mono text-muted-foreground shrink-0`,children:[e.memoryId.slice(0,8),`...`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(q,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,onClick:()=>D(e.memoryId),title:`查看详情`,children:(0,G.jsx)(cm,{className:`size-3.5`})}),(0,G.jsx)(q,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-red-500 hover:text-red-600 hover:bg-red-500/10`,onClick:()=>g(e),title:`删除此条记录`,children:(0,G.jsx)(Km,{className:`size-3.5`})})]})]},`${e.memoryId}-${e.at}-${e.from}-${e.to}`))}),C>1&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-t`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`第 `,w,` / `,C,` 页,共 `,b,` 条`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(q,{variant:`outline`,size:`sm`,className:`h-7 px-2`,disabled:w<=1,onClick:()=>c(w-1),children:(0,G.jsx)(Qp,{className:`size-4`})}),Array.from({length:C},(e,n)=>n+1).filter(e=>e===1||e===C||Math.abs(e-w)<=2).map((e,n,r)=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[n>0&&r[n-1]!==e-1&&(0,G.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`}),(0,G.jsx)(q,{variant:e===w?`default`:`outline`,size:`sm`,className:`h-7 w-7 px-0`,onClick:()=>c(e),children:e})]},e)),(0,G.jsx)(q,{variant:`outline`,size:`sm`,className:`h-7 px-2`,disabled:w>=C,onClick:()=>c(w+1),children:(0,G.jsx)($p,{className:`size-4`})})]})]})]})}),(0,G.jsx)(uJ,{open:!!h,onOpenChange:e=>{e||g(null)},children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除变更记录`}),(0,G.jsxs)(hJ,{children:[`确定要删除这条 `,h&&`${OJ(h.from)} → ${OJ(h.to)}`,` 的变更记录吗?记忆本身不会被删除。`]})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{onClick:()=>g(null),disabled:_,children:`取消`}),(0,G.jsx)(gJ,{disabled:_,onClick:e=>{e.preventDefault(),E()},className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:_?`删除中...`:`确认删除`})]})]})})]})}async function Qme(){return Vy.get(`/v1/stats/config`)}async function $me(){return Vy.get(`/v1/scheduler/status`)}async function ehe(e=50){return Vy.get(`/v1/tier-changes`,{params:{limit:e}})}async function the(){return Vy.post(`/v1/lifecycle/trigger`,{})}var M9={peripheral:0,working:1,core:2},nhe={access_via_get:`访问触发`,access_via_search:`搜索触发`,access_via_recall:`召回触发`,access_via_cross_space_search:`跨空间搜索触发`,scheduled_evaluation:`定时评估`};function N9(e){if(e<=0)return`每天 0:00`;if(e>=3600){let n=e/3600;return Number.isInteger(n)?`每 ${n} 小时`:`每 ${n.toFixed(1)} 小时`}return`每 ${Math.round(e/60)} 分钟`}function rhe(e){let{half_life_days:n,tiers:r}=e.decay,i=Math.log(2)/n,a=[];for(let e=0;e<=120;e+=2){let n={day:`D${e}`};for(let[a,o]of[[`core`,`Core`],[`working`,`Working`],[`peripheral`,`Peripheral`]]){let s=r?.[a];if(s){let r=Math.exp(-i*e**+s.beta);n[o]=Math.max(r,s.floor)}}a.push(n)}return a}function ihe(){return(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[1,2].map(e=>(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{className:`pb-2`,children:(0,G.jsx)(_b,{className:`h-4 w-28`})}),(0,G.jsxs)(gb,{className:`space-y-2`,children:[(0,G.jsx)(_b,{className:`h-4 w-full`}),(0,G.jsx)(_b,{className:`h-4 w-3/4`}),(0,G.jsx)(_b,{className:`h-4 w-1/2`})]})]},e))})}function ahe(){return(0,G.jsx)(`div`,{className:`space-y-2`,children:[1,2,3,4].map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,G.jsx)(_b,{className:`h-4 w-4`}),(0,G.jsx)(_b,{className:`h-3 w-24`}),(0,G.jsx)(_b,{className:`h-5 w-14`}),(0,G.jsx)(_b,{className:`h-3 w-4`}),(0,G.jsx)(_b,{className:`h-5 w-14`}),(0,G.jsx)(_b,{className:`h-3 flex-1`})]},e))})}function ohe(){let[e,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)([]),[s,c]=(0,y.useState)(0),[l,u]=(0,y.useState)(!0),[d,f]=(0,y.useState)(!0),[p,m]=(0,y.useState)(20),[h,g]=(0,y.useState)(!1),_=async()=>{try{u(!0);let[e,r]=await Promise.all([Qme(),$me().catch(()=>null)]);n(e),r&&i(r)}catch(e){console.error(`Failed to load lifecycle config:`,e),ir.error(`加载生命周期配置失败`)}finally{u(!1)}},v=async()=>{try{f(!0);let e=await ehe(p);o(e.changes||[]),c(e.totalCount||0)}catch(e){console.error(`Failed to load tier changes:`,e),ir.error(`加载升降级历史失败`)}finally{f(!1)}};(0,y.useEffect)(()=>{_(),v()},[]),(0,y.useEffect)(()=>{v()},[p]);let b=()=>{_(),v()},x=async()=>{try{g(!0);let e=await the();ir.success(e.message),_(),v()}catch(e){console.error(`Failed to trigger lifecycle:`,e),ir.error(`触发生命周期失败`)}finally{g(!1)}},S=e?rhe(e):[],C=a.filter(e=>(M9[e.from]??0)<(M9[e.to]??0)).length,w=a.filter(e=>(M9[e.from]??0)>=(M9[e.to]??0)).length;return(0,G.jsxs)(`div`,{className:`space-y-6 max-w-6xl mx-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight flex items-center gap-2`,children:[(0,G.jsx)(Gm,{className:`size-5`}),`生命周期管理`]}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`记忆衰减、升降级、自动遗忘的生命周期策略`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:b,disabled:l&&d,children:[(0,G.jsx)(Pm,{className:`h-4 w-4 mr-1`}),`刷新`]}),(0,G.jsxs)(q,{variant:`default`,size:`sm`,onClick:x,disabled:h,children:[h?(0,G.jsx)(Em,{className:`h-4 w-4 mr-1 animate-spin`}):(0,G.jsx)(eh,{className:`h-4 w-4 mr-1`}),`立即执行`]})]})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`pb-3`,children:[(0,G.jsxs)(mb,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(rm,{className:`size-4 text-violet-500`}),`调度器状态`]}),(0,G.jsx)(hb,{children:`自动评估与遗忘任务的运行状态`})]}),(0,G.jsxs)(gb,{children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`调度间隔`}),(0,G.jsx)(`p`,{className:`text-lg font-semibold mt-1`,children:r?N9(r.interval_secs):`—`})]}),(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`预计下次运行`}),(0,G.jsx)(`p`,{className:`text-sm font-semibold mt-1`,children:r?.next_run_eta?new Date(r.next_run_eta).toLocaleString(`zh-CN`):r?.last_run_at?`${N9(r.interval_secs)}后`:`等待首次运行`})]}),(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`启动时运行`}),(0,G.jsx)(`div`,{className:`mt-1`,children:r?r.run_on_start?(0,G.jsx)(bJ,{variant:`outline`,className:`bg-emerald-500/10 text-emerald-600 border-emerald-500/30`,children:`已启用`}):(0,G.jsx)(bJ,{variant:`outline`,className:`bg-muted text-muted-foreground border-border`,children:`已禁用`}):(0,G.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`—`})})]})]}),(0,G.jsx)(`div`,{className:`mt-4 p-3 rounded-lg border border-dashed text-xs text-muted-foreground space-y-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cm,{className:`size-3.5`}),(0,G.jsx)(`span`,{children:`调度器将自动执行:Weibull 衰减计算、Tier 评估升降级、关键词 TTL 检测、Superseded 归档清理`})]})})]})]}),l?(0,G.jsx)(ihe,{}):e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{className:`pb-3`,children:(0,G.jsxs)(mb,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(zp,{className:`size-4 text-blue-500`}),`衰减参数`]})}),(0,G.jsxs)(gb,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`默认半衰期`}),(0,G.jsxs)(`p`,{className:`font-semibold`,children:[e.decay.half_life_days,` 天`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`Stale 阈值`}),(0,G.jsx)(`p`,{className:`font-semibold`,children:e.retrieval?.default_min_score??.3})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`权重分配`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-blue-500/10 text-blue-600 border-blue-500/30 text-xs`,children:[`时效 `,e.decay.recency_weight]}),(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-emerald-500/10 text-emerald-600 border-emerald-500/30 text-xs`,children:[`频率 `,e.decay.frequency_weight]}),(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-violet-500/10 text-violet-600 border-violet-500/30 text-xs`,children:[`内在 `,e.decay.intrinsic_weight]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Tier 衰减速率 (β)`}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:Object.entries(e.decay.tiers||{}).map(([e,n])=>(0,G.jsxs)(bJ,{variant:`outline`,className:`text-xs ${AJ(e)}`,children:[OJ(e),` β=`,n.beta]},e))})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Tier 底线分数`}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:Object.entries(e.decay.tiers||{}).map(([e,n])=>(0,G.jsxs)(bJ,{variant:`outline`,className:`text-xs ${AJ(e)}`,children:[OJ(e),` ≥`,n.floor]},e))})]})]})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{className:`pb-3`,children:(0,G.jsxs)(mb,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(qm,{className:`size-4 text-emerald-500`}),`升降级规则`]})}),(0,G.jsxs)(gb,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,G.jsx)(Wp,{className:`size-4 text-emerald-500`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(`peripheral`),children:OJ(`peripheral`)}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(`working`),children:OJ(`working`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`访问 ≥`,e.promotion.peripheral_to_working.min_access_count,`次`]}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`综合 ≥`,e.promotion.peripheral_to_working.min_composite]})]})]}),(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,G.jsx)(Wp,{className:`size-4 text-emerald-500`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(`working`),children:OJ(`working`)}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(`core`),children:OJ(`core`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`访问 ≥`,e.promotion.working_to_core.min_access_count,`次`]}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`综合 ≥`,e.promotion.working_to_core.min_composite]}),e.promotion.working_to_core.min_importance!=null&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`重要性 ≥`,e.promotion.working_to_core.min_importance]})]})]})]}),(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border border-dashed space-y-2 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-muted-foreground`,children:[(0,G.jsx)(Bp,{className:`size-3.5 text-red-400`}),(0,G.jsx)(`span`,{children:`降级条件(需同时满足)`})]}),(0,G.jsxs)(`div`,{className:`ml-5 space-y-1 text-muted-foreground`,children:[(0,G.jsxs)(`div`,{children:[`• 综合分数 < `,e.demotion?.working_to_peripheral?.max_composite??.2]}),(0,G.jsx)(`div`,{children:`• 超过 90 天未访问`})]})]})]})]})]}),S.length>0&&(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`pb-2`,children:[(0,G.jsxs)(mb,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(eh,{className:`size-4 text-amber-500`}),`衰减曲线预览`]}),(0,G.jsx)(hb,{children:`基于当前配置参数生成的理论衰减趋势`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`h-64`,children:(0,G.jsx)(DE,{width:`100%`,height:`100%`,children:(0,G.jsxs)($q,{data:S,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,className:`opacity-30`}),(0,G.jsx)(dK,{dataKey:`day`,tick:{fontSize:11},interval:14,label:{value:`天数`,position:`insideBottomRight`,offset:-5,fontSize:11}}),(0,G.jsx)(OK,{domain:[0,1],tick:{fontSize:11},label:{value:`分数`,angle:-90,position:`insideLeft`,fontSize:11}}),(0,G.jsx)(lE,{contentStyle:{fontSize:12,borderRadius:8},formatter:e=>[e.toFixed(3)]}),(0,G.jsx)(ET,{iconType:`line`,wrapperStyle:{fontSize:12}}),(0,G.jsx)(TG,{type:`monotone`,dataKey:`Core`,stroke:`#f59e0b`,strokeWidth:2,dot:!1,name:`核心 (Core)`}),(0,G.jsx)(TG,{type:`monotone`,dataKey:`Working`,stroke:`#10b981`,strokeWidth:2,dot:!1,name:`工作区 (Working)`}),(0,G.jsx)(TG,{type:`monotone`,dataKey:`Peripheral`,stroke:`#94a3b8`,strokeWidth:2,dot:!1,name:`边缘 (Peripheral)`})]})})})})]})]}):(0,G.jsx)(fb,{children:(0,G.jsx)(gb,{className:`py-8 text-center`,children:(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`无法加载生命周期配置`})})}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{className:`pb-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(mb,{className:`text-sm font-medium`,children:`升降级历史`}),(0,G.jsx)(hb,{children:`最近的 Tier 变更记录`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-emerald-500/10 text-emerald-600 border-emerald-500/30 text-xs`,children:[`↑ 升级 `,C]}),(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-red-500/10 text-red-600 border-red-500/30 text-xs`,children:[`↓ 降级 `,w]}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`共 `,s,` 条`]})]})]})}),(0,G.jsx)(gb,{className:`p-0`,children:d?(0,G.jsx)(ahe,{}):a.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground py-12 text-center`,children:`暂无变更记录`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y`,children:a.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 hover:bg-muted/30 transition-colors`,children:[(M9[e.from]??0)<(M9[e.to]??0)?(0,G.jsx)(Wp,{className:`size-4 text-emerald-500 shrink-0`}):(0,G.jsx)(Bp,{className:`size-4 text-red-500 shrink-0`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground w-36 shrink-0`,children:new Date(e.at).toLocaleString(`zh-CN`)}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(e.from),children:OJ(e.from)}),(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(e.to),children:OJ(e.to)}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground w-20 shrink-0`,children:nhe[e.reason]||e.reason}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground w-12 shrink-0`,children:[`#`,e.accessCount]}),(0,G.jsx)(`span`,{className:`text-xs flex-1 min-w-0 truncate text-muted-foreground`,children:e.memoryTitle||e.memoryId?.slice(0,12)||`—`}),(0,G.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground shrink-0`,children:e.memoryId?`${e.memoryId.slice(0,8)}...`:`—`})]},`${e.memoryId}-${e.at}-${e.from}-${e.to}`))}),a.length<s&&(0,G.jsx)(`div`,{className:`flex items-center justify-center px-4 py-3 border-t`,children:(0,G.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>m(e=>e+20),children:`加载更多`})})]})})]})]})}var P9=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function F9(e){return y.useMemo(()=>({checked(n){return e.indeterminate?{}:n?{[P9.checked]:``}:{[P9.unchecked]:``}},...Ky}),[e.indeterminate])}function I9(e,n,r,i=!0,a){let[o,s]=y.useState(),c=yd(a?`${a}-label`:void 0),l=e??n??o;return Pr(()=>{let a=e||n||!i?void 0:she(r.current,c);o!==a&&s(a)}),l}function she(e,n){let r=che(e);if(r)return!r.id&&n&&(r.id=n),r.id||void 0}function che(e){if(!e)return;let n=e.parentElement;if(n&&n.tagName===`LABEL`)return n;let r=e.id;if(r){let n=e.nextElementSibling;if(n&&n.htmlFor===r)return n}let i=e.labels;return i&&i[0]}var L9=y.createContext(void 0);function lhe(){let e=y.useContext(L9);if(e===void 0)throw Error(Ir(14));return e}var uhe=`data-parent`,dhe=y.forwardRef(function(e,n){let{checked:r,className:i,defaultChecked:a=!1,"aria-labelledby":o,disabled:s=!1,form:c,id:l,indeterminate:u=!1,inputRef:d,name:f,onCheckedChange:p,parent:m=!1,readOnly:h=!1,render:g,required:_=!1,uncheckedValue:v,value:b,nativeButton:x=!1,style:S,...C}=e,{clearErrors:w}=Xy(),{disabled:T,name:E,setDirty:D,setFilled:O,setFocused:k,setTouched:A,state:j,validationMode:M,validityData:N,shouldValidateOnChange:P,validation:F}=Jy(),I=rb(),{labelId:L,controlId:R,registerControlId:z,getDescriptionProps:ee}=Qy(),B=ab(),V=B?.parent,H=V&&B.allValues,U=T||I.disabled||B?.disabled||s,te=E??f,W=b??te,ne=yd(),re=yd(),ie=R;H?ie=m?re:`${V.id}-${W}`:l&&(ie=l);let ae={};H&&(m?ae=B.parent.getParentProps():W&&(ae=B.parent.getChildProps(W)));let oe=Ca(p),{checked:se=r,indeterminate:ce=u,onCheckedChange:le,...ue}=ae,de=B?.value,fe=B?.setValue,pe=B?.defaultValue,me=y.useRef(null),he=Tr(()=>Symbol(`checkbox-control`)),ge=y.useRef(!1),{getButtonProps:_e,buttonRef:ve}=hh({disabled:U,native:x}),ye=B?.validation??F,[be,xe]=Mg({controlled:W&&de&&!m?de.includes(W):se,default:W&&pe&&!m?pe.includes(W):a,name:`Checkbox`,state:`checked`});Pr(()=>{z!==pi&&(ge.current=!0,z(he.current,ie))},[ie,B,z,m,he]),y.useEffect(()=>{let e=he.current;return()=>{!ge.current||z===pi||(ge.current=!1,z(e,void 0))}},[z,he]),$y(me,{enabled:!B,id:ne,value:be});let Se=y.useRef(null),Ce=pa(d,Se,ye.inputRef),we=I9(o,L,Se,!x,ie??void 0);Pr(()=>{Se.current&&(Se.current.indeterminate=ce,be&&O(!0))},[be,ce,O]),fg(be,()=>{B&&!m||(w(te),O(be),D(be!==N.initialValue),P()?ye.commit(be):ye.commit(be,!0))});let Te=Rs({checked:be,disabled:U,form:c,name:m?void 0:te,id:x?void 0:ie??void 0,required:_,ref:Ce,style:te?Na:Ma,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(h){e.preventDefault();return}let n=e.currentTarget.checked,r=Ii(xi,e.nativeEvent);le?.(n,r),oe(n,r),!r.isCanceled&&(xe(n),W&&de&&fe&&!m&&!H&&fe(n?[...de,W]:de.filter(e=>e!==W),r))},onFocus(){me.current?.focus()}},b===void 0?hi:{value:(B?be&&b:b)||``},ee,B?ye.getValidationProps:ye.getInputValidationProps),Ee=H?!!se:be,De=H&&ce||u;y.useEffect(()=>{if(!V||!W)return;let e=V.disabledStatesRef.current;return e.set(W,U),()=>{e.delete(W)}},[V,U,W]);let Oe=y.useMemo(()=>({...j,checked:Ee,disabled:U,readOnly:h,required:_,indeterminate:De}),[j,Ee,U,h,_,De]),ke=F9(Oe),Ae=Qs(`span`,e,{state:Oe,ref:[ve,me,n,B?.registerControlRef],props:[{id:x?ie??void 0:ne,role:`checkbox`,"aria-checked":ce?`mixed`:be,"aria-readonly":h||void 0,"aria-required":_||void 0,"aria-labelledby":we,[uhe]:m?``:void 0,onFocus(){k(!0)},onBlur(){let e=Se.current;e&&(A(!0),k(!1),M===`onBlur`&&ye.commit(B?de:e.checked))},onClick(e){h||U||(e.preventDefault(),Se.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ee,ye.getValidationProps,C,ue,_e],stateAttributesMapping:ke});return(0,G.jsxs)(L9.Provider,{value:Oe,children:[Ae,!be&&!B&&te&&!m&&v!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,form:c,name:te,value:v}),(0,G.jsx)(`input`,{...Te,suppressHydrationWarning:!0})]})}),fhe=y.forwardRef(function(e,n){let{render:r,className:i,style:a,keepMounted:o=!1,...s}=e,c=lhe(),l=c.checked||c.indeterminate,{mounted:u,transitionStatus:d,setMounted:f}=su(l),p=y.useRef(null),m={...c,transitionStatus:d};pu({open:l,ref:p,onComplete(){l||f(!1)}});let h=F9(c),g=y.useMemo(()=>({...h,...du,...Ky}),[h]),_=o||u,v=Qs(`span`,e,{ref:[n,p],state:m,stateAttributesMapping:g,props:s});return _?v:null});function phe({className:e,...n}){return(0,G.jsx)(dhe,{"data-slot":`checkbox`,className:Tp(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...n,children:(0,G.jsx)(fhe,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,G.jsx)(Xp,{})})})}var R9=2e3,z9=150,B9=`omem-import-task`,mhe={completed:`✓`,failed:`✗`,pending:`⋯`,processing:`⋯`,skipped:`–`};function V9({label:e,status:n,detail:r}){let i=mhe[n]??`·`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,G.jsx)(`span`,{className:`font-mono w-4 ${n===`completed`?`text-green-500`:n===`failed`?`text-red-500`:n===`processing`||n===`pending`?`text-blue-500 animate-pulse`:`text-muted-foreground`}`,children:i}),(0,G.jsx)(`span`,{className:`font-medium w-24 shrink-0`,children:e}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground flex-1`,children:r})]})}function hhe(e){let n=e.toLowerCase();return n.endsWith(`.json`)?`json`:n.endsWith(`.csv`)?`memory`:n.endsWith(`.md`)||n.endsWith(`.markdown`)?`markdown`:`memory`}function ghe(){let e=et(),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(null),[f,p]=(0,y.useState)(!1),m=(0,y.useRef)(null),h=(0,y.useCallback)(e=>{l(e),e?sessionStorage.setItem(B9,JSON.stringify(e)):sessionStorage.removeItem(B9)},[]),g=(0,y.useCallback)(()=>{l(null),sessionStorage.removeItem(B9)},[]);(0,y.useEffect)(()=>{let e=sessionStorage.getItem(B9);if(e)try{let n=JSON.parse(e);if(l(n),n.status===`completed`||n.status===`failed`)return;a(!0);let r=!1,i=0,o=async()=>{if(!(r||i>=z9)){i+=1;try{let e=await Vy.get(`/v1/imports/${n.id}`);if(r)return;if(l(e),sessionStorage.setItem(B9,JSON.stringify(e)),e.status===`completed`||e.status===`failed`){a(!1);return}}catch{}m.current=setTimeout(o,R9)}};return m.current=setTimeout(o,R9),()=>{r=!0,m.current&&clearTimeout(m.current)}}catch{sessionStorage.removeItem(B9)}},[]);let _=(0,y.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),e.type===`dragenter`||e.type===`dragover`?p(!0):e.type===`dragleave`&&p(!1)},[]),v=(0,y.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),p(!1),e.dataTransfer.files&&e.dataTransfer.files[0]&&(r(e.dataTransfer.files[0]),g(),d(null))},[g]),b=e=>{e.target.files&&e.target.files[0]&&(r(e.target.files[0]),g(),d(null))},x=e=>e.endsWith(`.json`)?(0,G.jsx)(lm,{className:`h-8 w-8 text-blue-500`}):e.endsWith(`.csv`)?(0,G.jsx)(um,{className:`h-8 w-8 text-green-500`}):e.endsWith(`.md`)||e.endsWith(`.markdown`)?(0,G.jsx)(dm,{className:`h-8 w-8 text-purple-500`}):(0,G.jsx)(dm,{className:`h-8 w-8 text-muted-foreground`}),S=(0,y.useCallback)(async(e,n)=>{if(n>=z9){d(`导入超时(5分钟未完成),请稍后在记忆列表查看结果`),a(!1);return}try{let r=await Vy.get(`/v1/imports/${e}`);if(h(r),r.status===`completed`||r.status===`failed`){a(!1),r.status===`completed`?ir.success(`导入完成:提取 ${r.extraction_facts} 条,合并 ${r.reconcile_merged} 条`):(d(r.errors?.join(`
|
|
164
|
+
- `).trim()}function Ime(e){return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function Lme(e){return e?e.length<=16?e:e.slice(0,8)+`...`+e.slice(-8):`—`}function Rme(e,n=80){return e?e.length<=n?e:e.slice(0,n)+`...`:`—`}function zme({type:e}){return e===`auto`?(0,G.jsxs)(bJ,{variant:`secondary`,className:`text-xs bg-blue-100 text-blue-700 hover:bg-blue-100 border-blue-200`,children:[(0,G.jsx)(eh,{className:`size-3 mr-1`}),`自动注入`]}):(0,G.jsxs)(bJ,{variant:`outline`,className:`text-xs bg-emerald-50 text-emerald-700 hover:bg-emerald-50 border-emerald-200`,children:[(0,G.jsx)(Am,{className:`size-3 mr-1`}),`手动注入`]})}function Bme({category:e}){return(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs font-normal ${DJ(e)}`,children:e||`未分类`})}function S9({label:e,value:n,max:r=1}){let i=Math.max(0,Math.min(n,r))/r*100;return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{className:`font-medium`,children:n===0?`—`:`${i.toFixed(1)}%`})]}),(0,G.jsx)(`div`,{className:`h-1.5 w-full rounded-full bg-muted overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all`,style:{width:`${i}%`}})})]})}function Vme({relevance:e,isKept:n}){return n?e?e===`high`?(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-emerald-500/10 text-emerald-600 border-emerald-500/30`,children:`🟢 高相关`}):e===`medium`?(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-yellow-500/10 text-yellow-600 border-yellow-500/30`,children:`🟡 中相关`}):(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-muted text-muted-foreground border-border`,children:e||`—`}):(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-blue-500/10 text-blue-600 border-blue-500/30`,children:`🔵 保留`}):(0,G.jsx)(bJ,{variant:`outline`,className:`text-xs bg-red-500/10 text-red-600 border-red-500/30`,children:`🔴 被精炼掉`})}function Hme({item:e,memory:n,memoryLoading:r,vaultUnlocked:i,memoryUnlocked:a,onUnlock:o,onLock:s,onVaultUnlock:c}){let l=!!e.refine_relevance,[u,d]=(0,y.useState)(`raw`),[f,p]=(0,y.useState)(!1),[m,h]=(0,y.useState)(``),[g,_]=(0,y.useState)(null),v=Uy(e=>e.unlock),b=Uy(e=>e.isUnlocked),x=n?.visibility===`private`||(n?.tags||[]).some(e=>e===`私密`||e.toLowerCase()===`private`),S=x&&!a,C=async()=>{n&&(S?i||b?o?.(n.id):p(!0):(s?.(n.id),p(!1)))},w=async()=>{if(!m.trim()){_(`请输入密码`);return}await v(m)?(p(!1),h(``),_(null),c?.(),n&&o?.(n.id)):_(`密码错误`)};return(0,G.jsxs)(`div`,{className:`rounded-md border bg-muted/50 p-3 space-y-3 ${e.is_kept?`border-border`:`border-dashed border-red-500/30 opacity-75`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(Vme,{relevance:e.refine_relevance,isKept:e.is_kept}),(0,G.jsx)(Bme,{category:n?.category}),x&&(0,G.jsxs)(bJ,{variant:`secondary`,className:`text-xs bg-amber-100 text-amber-700 hover:bg-amber-100 border-amber-200`,children:[(0,G.jsx)(Om,{className:`size-3 mr-1`}),`私密`]}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground font-mono`,children:[e.memory_id?.slice(0,8),`...`]})]}),x&&(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),C()},className:`text-xs text-amber-500 hover:text-amber-600 flex items-center gap-1 shrink-0`,children:[S?(0,G.jsx)(Om,{className:`size-3`}):(0,G.jsx)(Dm,{className:`size-3`}),S?`解锁`:`锁定`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border pb-1`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>l&&d(`refine`),className:`text-xs px-2 py-1 rounded transition-colors ${l?u===`refine`?`bg-primary/10 text-primary font-medium`:`text-muted-foreground hover:text-foreground`:`text-muted-foreground/40 cursor-not-allowed`}`,children:`精炼`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>d(`raw`),className:`text-xs px-2 py-1 rounded transition-colors ${u===`raw`?`bg-primary/10 text-primary font-medium`:`text-muted-foreground hover:text-foreground`}`,children:`原始`})]}),u===`refine`?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[e.refine_reasoning?(0,G.jsxs)(`div`,{className:`text-sm text-foreground`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`推理说明:`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e.refine_reasoning})]}):(0,G.jsx)(`div`,{className:`text-sm text-muted-foreground italic`,children:`未经精炼 · 自动保留`}),(0,G.jsx)(S9,{label:`相似度得分`,value:e.score,max:1})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:r?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(_b,{className:`h-4 w-3/4`}),(0,G.jsx)(_b,{className:`h-4 w-1/2`})]}):n?(0,G.jsx)(G.Fragment,{children:S?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,G.jsx)(Om,{className:`size-4`}),(0,G.jsx)(`span`,{children:`私密记忆内容已隐藏`})]}),f&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sb,{type:`password`,placeholder:`输入 Vault 密码...`,value:m,onChange:e=>{h(e.target.value),_(null)},onKeyDown:e=>e.key===`Enter`&&w(),className:g?`border-destructive flex-1`:`flex-1`}),(0,G.jsx)(q,{size:`sm`,onClick:w,children:`解锁`})]}),g&&(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:g})]})]}):(0,G.jsx)(`div`,{className:`prose prose-sm dark:prose-invert max-w-none`,children:(0,G.jsx)(_0,{remarkPlugins:[i3],children:Fme(n.content||n.l0_abstract||`—`)})})}):(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`记忆内容加载失败`})})]})}function Ume({event:e,initialItems:n,isLast:r,defaultExpanded:i,vaultUnlocked:a,unlockedMemories:o,manuallyLocked:s,onUnlock:c,onLock:l,onVaultUnlock:u}){let[d,f]=(0,y.useState)(i||!1),[p,m]=(0,y.useState)(!0),[h,g]=(0,y.useState)(n??null),[_,v]=(0,y.useState)(new Map),[b,x]=(0,y.useState)(new Set);(0,y.useEffect)(()=>{n&&h===null&&g(n)},[n,h]);let S=(0,y.useCallback)(async e=>{try{x(n=>new Set(n).add(e));let n=await Vy.get(`/v1/memories/${e}`);v(r=>{let i=new Map(r);return i.set(e,n),i})}catch(e){console.error(`Failed to fetch memory:`,e)}finally{x(n=>{let r=new Set(n);return r.delete(e),r})}},[]),C=(0,y.useRef)(new Set);(0,y.useEffect)(()=>{!d||!h||h.length===0||h.forEach(e=>{C.current.has(e.memory_id)||(C.current.add(e.memory_id),S(e.memory_id))})},[d,h,S]);let w=e=>a&&!s.has(e)||o.has(e);return(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,G.jsx)(`div`,{className:`w-2.5 h-2.5 rounded-full bg-primary ring-4 ring-primary/20`}),!r&&(0,G.jsx)(`div`,{className:`w-px flex-1 bg-border mt-1`})]}),(0,G.jsx)(`div`,{className:`flex-1 pb-6`,children:(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-card transition-colors hover:bg-muted/50`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>f(!d),className:`w-full text-left p-4 cursor-pointer`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(zme,{type:e.recall_type}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,G.jsx)(rm,{className:`size-3`}),Ime(e.created_at)]})]}),d?(0,G.jsx)(em,{className:`size-4 text-muted-foreground`}):(0,G.jsx)(Zp,{className:`size-4 text-muted-foreground`})]}),(0,G.jsxs)(`div`,{className:`mt-2 text-sm text-muted-foreground flex items-center gap-1.5`,children:[(0,G.jsx)(Im,{className:`size-3.5`}),(0,G.jsx)(`span`,{className:`line-clamp-1`,title:e.query_text||`—`,children:Rme(e.query_text)})]})]}),d&&(0,G.jsxs)(`div`,{className:`px-4 pb-4 space-y-4 border-t border-border pt-4`,children:[e.profile_content&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[(0,G.jsx)(Kp,{className:`size-3`}),`画像注入内容`]}),(0,G.jsx)(`div`,{className:`rounded-md border border-indigo-500/20 bg-indigo-500/5 p-3`,children:(0,G.jsx)(`div`,{className:`prose prose-sm dark:prose-invert max-w-none text-sm text-indigo-700 dark:text-indigo-300`,children:(0,G.jsx)(_0,{remarkPlugins:[i3],children:e.profile_content.replace(/<\/?cerebro-profile>/g,``).trim()})})})]}),e.injected_content&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>m(!p),className:`flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:[(0,G.jsx)(im,{className:`size-3`}),`注入内容`,p?(0,G.jsx)(em,{className:`size-3`}):(0,G.jsx)(Zp,{className:`size-3`})]}),p&&(0,G.jsx)(`div`,{className:`rounded-md border border-emerald-500/20 bg-emerald-500/5 p-3 max-h-96 overflow-y-auto`,children:(0,G.jsx)(`div`,{className:`prose prose-sm dark:prose-invert max-w-none text-sm text-emerald-700 dark:text-emerald-300`,children:(0,G.jsx)(_0,{remarkPlugins:[i3],children:e.injected_content.replace(/<\/?cerebro-context>/g,``).trim()})})})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[(0,G.jsx)(Kp,{className:`size-3`}),`关联记忆`]})}),h&&h.length>0?(0,G.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,G.jsx)(Hme,{item:e,memory:_.get(e.memory_id)||null,memoryLoading:b.has(e.memory_id),vaultUnlocked:a,memoryUnlocked:w(e.memory_id),onUnlock:c,onLock:l,onVaultUnlock:u},e.id))}):(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`暂无召回项`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1`,children:[(0,G.jsx)(Yp,{className:`size-3`}),`匹配指标`]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,G.jsx)(S9,{label:`最大相似度`,value:e.max_score}),(0,G.jsx)(S9,{label:`LLM 置信度`,value:e.llm_confidence})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:`统计:`}),(0,G.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[`保留 `,e.kept_count,` 条`]}),e.discarded_count>0&&(0,G.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`精炼掉 `,e.discarded_count,` 条`]}),e.injected_count!=null&&e.injected_count>0&&(0,G.jsxs)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:[`实际注入 `,e.injected_count,` 条`]}),e.profile_injected&&(0,G.jsx)(`span`,{className:`text-indigo-600 dark:text-indigo-400`,children:`👤 画像已注入`})]})]})]})})]})}function Wme(){let{id:e}=it(),n=et(),r=Ze(),i=()=>{let e=r.state;e?.from?n(e.from,{replace:!0}):n(-1)},a=e?decodeURIComponent(e):``,[o,s]=(0,y.useState)([]),[c,l]=(0,y.useState)(new Map),[u,d]=(0,y.useState)(!0),[f,p]=(0,y.useState)(null),[m,h]=(0,y.useState)(1),[g,_]=(0,y.useState)(!1),[v,b]=(0,y.useState)(!1),[x,S]=(0,y.useState)(``),[C,w]=(0,y.useState)(null),T=Uy(e=>e.unlock),E=Uy(e=>e.lock),[D,O]=(0,y.useState)(!1),[k,A]=(0,y.useState)(new Set),[j,M]=(0,y.useState)(new Set),[N,P]=(0,y.useState)(null),F=Math.ceil(o.length/10),I=o.slice((m-1)*10,m*10);(0,y.useEffect)(()=>{if(!a)return;async function e(){try{d(!0),p(null);let e=await Vy.get(`/v1/recall-events`,{params:{session_id:a,limit:1e4,offset:0,expand:`items`}});if(s((e?.events||[]).sort((e,n)=>new Date(n.created_at).getTime()-new Date(e.created_at).getTime())),e?.event_items){let n=new Map;e.event_items.forEach(e=>n.set(e.id,e.items||[])),l(n)}}catch(e){console.error(`Failed to fetch session detail:`,e),p(`加载 Session 详情失败`),ir.error(`加载 Session 详情失败`)}finally{d(!1)}}e()},[a]);let L=()=>{_(!0)},R=async()=>{try{await Vy.delete(`/v1/session-recalls/session/${a}`),ir.success(`Session 记录已删除`),n(-1)}catch(e){console.error(`Failed to delete session records:`,e),ir.error(`删除失败`)}finally{_(!1)}},z=async()=>{if(!x.trim()){w(`请输入密码`);return}if(!await T(x)){w(`密码错误`);return}O(!0),N&&(A(e=>new Set(e).add(N)),P(null)),w(null),b(!1),S(``)},ee=()=>{O(!1),A(new Set),M(new Set),E()},B=e=>{k.has(e)||D&&!j.has(e)?(M(n=>new Set(n).add(e)),A(n=>{let r=new Set(n);return r.delete(e),r})):D?M(n=>{let r=new Set(n);return r.delete(e),r}):(P(e),b(!0))},V={total:o.length,auto:o.filter(e=>e.recall_type===`auto`).length,manual:o.filter(e=>e.recall_type===`manual`).length,totalKept:o.reduce((e,n)=>e+n.kept_count,0),totalDiscarded:o.reduce((e,n)=>e+n.discarded_count,0)};return u?(0,G.jsxs)(`div`,{className:`space-y-6 max-w-3xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(_b,{className:`h-8 w-8`}),(0,G.jsx)(_b,{className:`h-6 w-32`})]}),(0,G.jsx)(_b,{className:`h-4 w-1/2`}),(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsxs)(`div`,{className:`flex gap-4`,children:[(0,G.jsx)(_b,{className:`h-3 w-3 rounded-full`}),(0,G.jsx)(`div`,{className:`flex-1 space-y-2`,children:(0,G.jsx)(_b,{className:`h-20 w-full`})})]},e))})]}):f?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:()=>i(),children:[(0,G.jsx)(Vp,{className:`size-4 mr-1.5`}),`返回`]}),(0,G.jsx)(`div`,{className:`rounded-lg border border-destructive/50 bg-destructive/10 p-6 text-sm text-destructive`,children:f})]}):(0,G.jsxs)(`div`,{className:`space-y-6 max-w-3xl`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:()=>i(),children:[(0,G.jsx)(Vp,{className:`size-4 mr-1.5`}),`返回`]})})}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:[`Session 详情 - `,Lme(a)]}),(0,G.jsx)(`div`,{className:`flex items-center gap-3 text-sm text-muted-foreground flex-wrap`,children:(0,G.jsx)(`code`,{className:`font-mono text-xs bg-muted px-1.5 py-0.5 rounded`,children:a})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,G.jsx)(fb,{children:(0,G.jsxs)(gb,{className:`pt-4 text-center`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold`,children:V.total}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`总召回事件`})]})}),(0,G.jsx)(fb,{children:(0,G.jsxs)(gb,{className:`pt-4 text-center`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold`,children:V.auto}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`自动注入`})]})}),(0,G.jsx)(fb,{children:(0,G.jsxs)(gb,{className:`pt-4 text-center`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold`,children:V.manual}),(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`手动注入`})]})})]}),V.totalKept>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,G.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400 font-medium`,children:[`共保留 `,V.totalKept,` 条记忆`]}),V.totalDiscarded>0&&(0,G.jsxs)(`span`,{className:`text-red-600 dark:text-red-400 font-medium`,children:[`共精炼掉 `,V.totalDiscarded,` 条记忆`]})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:`召回事件时间线`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`共 `,o.length,` 个事件`]}),F>1&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>h(e=>Math.max(1,e-1)),disabled:m===1,children:(0,G.jsx)(Qp,{className:`size-3`})}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground min-w-[3ch] text-center`,children:[m,`/`,F]}),(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>h(e=>Math.min(F,e+1)),disabled:m===F,children:(0,G.jsx)($p,{className:`size-3`})})]}),D?(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:ee,children:[(0,G.jsx)(Om,{className:`size-3.5 mr-1`}),`锁定 Vault`]}):(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>b(!v),children:[(0,G.jsx)(Dm,{className:`size-3.5 mr-1`}),`解锁 Vault`]})]})]}),v&&(0,G.jsxs)(`div`,{className:`space-y-2 max-w-md`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sb,{type:`password`,placeholder:`输入 Vault 密码...`,value:x,onChange:e=>{S(e.target.value),w(null)},onKeyDown:e=>e.key===`Enter`&&z(),className:C?`border-destructive flex-1`:`flex-1`}),(0,G.jsx)(q,{size:`sm`,onClick:z,children:`解锁`})]}),C&&(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:C})]}),o.length===0?(0,G.jsx)(`div`,{className:`rounded-lg border border-border bg-card p-8 text-center text-sm text-muted-foreground`,children:`暂无召回事件`}):(0,G.jsxs)(G.Fragment,{children:[I.map((e,n)=>(0,G.jsx)(Ume,{event:e,initialItems:c.get(e.id),isLast:n===I.length-1&&m===F,defaultExpanded:n===0&&m===1,vaultUnlocked:D,unlockedMemories:k,manuallyLocked:j,onUnlock:B,onLock:B,onVaultUnlock:()=>O(!0)},e.id)),F>1&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-4`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`共 `,o.length,` 个事件`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>h(e=>Math.max(1,e-1)),disabled:m===1,children:(0,G.jsx)(Qp,{className:`size-4`})}),(0,G.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[m,` / `,F]}),(0,G.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>h(e=>Math.min(F,e+1)),disabled:m===F,children:(0,G.jsx)($p,{className:`size-4`})})]})]})]})]}),o.length>0&&(0,G.jsx)(`div`,{className:`pt-4 border-t border-border`,children:(0,G.jsxs)(q,{variant:`outline`,size:`sm`,className:`text-destructive hover:bg-destructive/10 hover:text-destructive`,onClick:L,children:[(0,G.jsx)(Km,{className:`size-3.5 mr-1`}),`删除 Session 所有记录`]})}),(0,G.jsx)(uJ,{open:g,onOpenChange:e=>!e&&_(!1),children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除 Session 记录`}),(0,G.jsx)(hJ,{children:`此操作将删除该 Session 的所有召回记录,不可撤销。确定要继续吗?`})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{onClick:()=>_(!1),children:`取消`}),(0,G.jsx)(gJ,{onClick:R,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`删除`})]})]})})]})}function C9({...e}){return(0,G.jsx)(yg,{"data-slot":`dialog`,...e})}function Gme({...e}){return(0,G.jsx)(xg,{"data-slot":`dialog-trigger`,...e})}function Kme({...e}){return(0,G.jsx)(tg,{"data-slot":`dialog-portal`,...e})}function qme({className:e,...n}){return(0,G.jsx)(Dh,{"data-slot":`dialog-overlay`,className:Tp(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})}function w9({className:e,children:n,showCloseButton:r=!0,...i}){return(0,G.jsxs)(Kme,{children:[(0,G.jsx)(qme,{}),(0,G.jsxs)($h,{"data-slot":`dialog-content`,className:Tp(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...i,children:[n,r&&(0,G.jsxs)(Oh,{"data-slot":`dialog-close`,render:(0,G.jsx)(q,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,G.jsx)($m,{}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function T9({className:e,...n}){return(0,G.jsx)(`div`,{"data-slot":`dialog-header`,className:Tp(`flex flex-col gap-2`,e),...n})}function E9({className:e,showCloseButton:n=!1,children:r,...i}){return(0,G.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Tp(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...i,children:[r,n&&(0,G.jsx)(Oh,{render:(0,G.jsx)(q,{variant:`outline`}),children:`Close`})]})}function D9({className:e,...n}){return(0,G.jsx)(bg,{"data-slot":`dialog-title`,className:Tp(`text-base leading-none font-medium`,e),...n})}function O9({className:e,...n}){return(0,G.jsx)(kh,{"data-slot":`dialog-description`,className:Tp(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...n})}function Jme(){let[e,n]=(0,y.useState)([]),[r,i]=(0,y.useState)(!0),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(`team`),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(`member`),[b,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)({}),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)(`member`),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)(null),[I,L]=(0,y.useState)(!1),R=dh(e=>e.currentUserId),z=dh(e=>e.users.find(e=>e.id===R)),ee=e.find(e=>e.id===p),B=e=>z?e.owner_id===z.apiKey||e.members.some(e=>e.user_id===z.apiKey&&(e.role===`admin`||e.role===`Admin`)):!1;(0,y.useEffect)(()=>{async function e(){if(!ee?.members?.length)return;T(!0);let e={};await Promise.all(ee.members.map(async n=>{try{let r=await Vy.get(`/v1/tenants/${encodeURIComponent(n.user_id)}`);r&&(e[n.user_id]={name:r.name,created_at:r.created_at})}catch{}})),C(e),T(!1)}p&&e()},[p,ee?.members]),(0,y.useEffect)(()=>{async function e(){try{i(!0),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to fetch spaces:`,e),ir.error(`加载空间列表失败`)}finally{i(!1)}}e()},[]);async function V(){if(!s.trim()){ir.error(`请输入空间名称`);return}try{await Vy.post(`/v1/spaces`,{name:s.trim(),space_type:l}),ir.success(`空间创建成功`),o(!1),c(``),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to create space:`,e),ir.error(`空间创建失败`)}}async function H(){if(!d)return;let r=e.find(e=>e.id===d)?.members.map(e=>e.user_id).filter(e=>e!==z?.apiKey)||[];try{await Vy.delete(`/v1/spaces/${encodeURIComponent(d)}`),ir.success(`空间已删除`),n(e=>e.filter(e=>e.id!==d)),dh.getState().removeUsersByApiKeys(r)}catch(e){console.error(`Failed to delete space:`,e),ir.error(`空间删除失败`)}finally{f(null)}}async function U(){if(p){N(!0);try{let e=await Vy.post(`/v1/tenants`,{name:O.trim()||void 0}),r=e.id,i=e.api_key;await Vy.post(`/v1/spaces/${encodeURIComponent(p)}/members`,{user_id:r,role:A}),F(i),ir.success(`新用户创建并加入空间成功`),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to create user:`,e);let n=e.response?.data?.error||e.message||``;ir.error(`创建用户失败:${n||`请稍后重试`}`)}finally{N(!1)}}}async function te(e){if(p)try{await Vy.delete(`/v1/spaces/${encodeURIComponent(p)}/members/${encodeURIComponent(e)}`),ir.success(`成员已移除`),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to remove member:`,e);let n=e.response?.data?.error||e.message||``;ir.error(`移除成员失败:${n||`请稍后重试`}`)}}async function W(){if(!p||!h.trim()){ir.error(`请输入用户ID`);return}let e=h.trim();if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)){ir.error(`用户ID格式不正确,请输入有效的 UUID(如:123e4567-e89b-42d3-a456-426614174000)`);return}x(!0);try{await Vy.post(`/v1/spaces/${encodeURIComponent(p)}/members`,{user_id:e,role:_}),ir.success(`成员添加成功`),g(``),n(await Vy.get(`/v1/spaces`)||[])}catch(e){console.error(`Failed to add member:`,e);let n=e.response?.data?.error||e.message||``;n.includes(`not found`)||n.includes(`不存在`)?ir.error(`该用户不存在,请确认用户ID正确`):n.includes(`permission`)||n.includes(`权限`)?ir.error(`您没有权限添加成员`):ir.error(`添加成员失败:${n||`请检查用户ID是否正确`}`)}finally{x(!1)}}return r?(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`空间管理`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`管理您的记忆空间`})]}),(0,G.jsx)(_b,{className:`h-9 w-24`})]}),(0,G.jsx)(`div`,{className:`grid gap-4`,children:[1,2].map(e=>(0,G.jsx)(_b,{className:`h-32 w-full`},e))})]}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`空间管理`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`管理您的记忆空间`})]}),(0,G.jsxs)(C9,{open:a,onOpenChange:o,children:[(0,G.jsx)(Gme,{render:(0,G.jsxs)(q,{size:`sm`,children:[(0,G.jsx)(Mm,{className:`size-4 mr-1.5`}),`新建空间`]})}),(0,G.jsxs)(w9,{children:[(0,G.jsx)(T9,{children:(0,G.jsx)(D9,{children:`新建空间`})}),(0,G.jsxs)(`div`,{className:`space-y-4 pt-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`空间名称`}),(0,G.jsx)(sb,{placeholder:`输入空间名称`,value:s,onChange:e=>c(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`空间类型`}),(0,G.jsxs)(d9,{value:l,onValueChange:e=>u(e||`team`),children:[(0,G.jsx)(p9,{children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`team`,children:`团队`}),(0,G.jsx)(h9,{value:`personal`,children:`个人`}),(0,G.jsx)(h9,{value:`shared`,children:`共享`})]})]})]}),(0,G.jsx)(q,{className:`w-full`,onClick:V,children:`创建`})]})]})]})]}),e.length===0?(0,G.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground border border-dashed border-border rounded-lg`,children:[(0,G.jsx)(`p`,{children:`暂无空间`}),(0,G.jsx)(`p`,{className:`text-sm mt-1`,children:`点击右上角按钮创建新空间`})]}):(0,G.jsx)(`div`,{className:`grid gap-4`,children:e.map(e=>(0,G.jsxs)(fb,{className:`group transition-colors hover:bg-accent/50`,children:[(0,G.jsx)(pb,{className:`pb-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-semibold`,children:e.name}),(0,G.jsx)(bJ,{variant:`outline`,children:e.space_type})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,G.jsx)(Rm,{className:`size-3`}),e.members.length,` 成员`]}),(0,G.jsxs)(q,{variant:`ghost`,size:`sm`,className:`h-7 opacity-0 group-hover:opacity-100 transition-opacity`,onClick:()=>{m(e.id),g(``),v(`member`)},children:[(0,G.jsx)(Xm,{className:`size-3.5 mr-1`}),`管理成员`]}),e.space_type!==`personal`&&B(e)&&(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7 opacity-0 group-hover:opacity-100 transition-opacity`,onClick:()=>f(e.id),children:(0,G.jsx)(Km,{className:`size-3.5 text-destructive`})})]})]})}),(0,G.jsxs)(gb,{className:`pt-0 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-muted-foreground flex-wrap`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Qm,{className:`size-3.5`}),e.members.map(e=>e.role).join(`, `)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Jp,{className:`size-3.5`}),new Date(e.created_at).toLocaleDateString(`zh-CN`)]})]}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground font-mono`,children:[`ID: `,e.id]})]})]},e.id))}),(0,G.jsx)(uJ,{open:!!d,onOpenChange:e=>!e&&f(null),children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除空间`}),(0,G.jsx)(hJ,{children:`此操作不可撤销。空间内的数据不会被删除,但空间配置将被移除。`})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{onClick:()=>f(null),children:`取消`}),(0,G.jsx)(gJ,{onClick:H,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`删除`})]})]})}),(0,G.jsx)(C9,{open:!!p,onOpenChange:e=>!e&&m(null),children:(0,G.jsxs)(w9,{style:{width:680,maxWidth:`95vw`},children:[(0,G.jsx)(T9,{children:(0,G.jsxs)(D9,{children:[`管理成员 - `,ee?.name]})}),(0,G.jsxs)(`div`,{className:`space-y-4 pt-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`当前成员`}),w&&(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`加载用户信息中...`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[ee?.members.map(e=>{let n=S[e.user_id];return(0,G.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr_80px_60px] items-center gap-3 text-sm border rounded-md px-3 py-2`,children:[(0,G.jsx)(Zm,{className:`size-3.5 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-xs truncate`,title:e.user_id,children:e.user_id}),n&&(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[n.name,` · `,new Date(n.created_at).toLocaleDateString(`zh-CN`)]})]}),(0,G.jsx)(bJ,{variant:`outline`,className:`justify-self-center`,children:e.role}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 justify-self-end`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e.user_id),ir.success(`API Key 已复制`)},className:`text-muted-foreground hover:text-foreground transition-colors`,title:`复制 API Key`,children:(0,G.jsx)(am,{className:`size-3.5`})}),ee&&B(ee)&&e.user_id!==z?.apiKey&&e.user_id!==ee?.owner_id&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>te(e.user_id),className:`text-muted-foreground hover:text-destructive transition-colors`,title:`移除成员`,children:(0,G.jsx)(Km,{className:`size-3.5`})})]})]},e.user_id)}),(!ee?.members||ee.members.length===0)&&(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`暂无成员`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`添加成员`}),(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>{D(!0),F(null),k(``),j(`member`)},children:[(0,G.jsx)(bm,{className:`size-3.5 mr-1.5`}),`创建新用户`]})]}),E&&(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/30 p-3 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`创建新用户`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{D(!1),F(null)},className:`text-xs text-muted-foreground hover:text-foreground`,children:`取消`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sb,{placeholder:`用户名(可选)`,value:O,onChange:e=>k(e.target.value),className:`flex-1`}),(0,G.jsxs)(d9,{value:A,onValueChange:e=>j(e||`member`),children:[(0,G.jsx)(p9,{className:`w-28`,children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`admin`,children:`管理员`}),(0,G.jsx)(h9,{value:`member`,children:`成员`}),(0,G.jsx)(h9,{value:`reader`,children:`只读`})]})]})]}),(0,G.jsx)(q,{size:`sm`,className:`w-full`,onClick:U,disabled:M,children:M?`生成中...`:`生成用户并添加到空间`}),P&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`新用户 API Key(请复制保存):`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`code`,{className:`flex-1 text-xs bg-background border rounded px-2 py-1.5 font-mono truncate`,children:P}),(0,G.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>{navigator.clipboard.writeText(P),L(!0),setTimeout(()=>L(!1),2e3)},children:I?(0,G.jsx)(Xp,{className:`size-3.5`}):(0,G.jsx)(am,{className:`size-3.5`})})]})]})]}),!E&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sb,{placeholder:`输入对方 API Key(UUID格式)`,value:h,onChange:e=>g(e.target.value),className:`flex-1`}),(0,G.jsxs)(d9,{value:_,onValueChange:e=>v(e||`member`),children:[(0,G.jsx)(p9,{className:`w-28`,children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`admin`,children:`管理员`}),(0,G.jsx)(h9,{value:`member`,children:`成员`}),(0,G.jsx)(h9,{value:`reader`,children:`只读`})]})]}),(0,G.jsx)(q,{size:`sm`,onClick:W,disabled:b,children:b?`添加中...`:`添加`})]})]})]})]})})]})}var k9=[`#8b5cf6`,`#ec4899`,`#06b6d4`,`#f59e0b`,`#10b981`,`#ef4444`,`#6366f1`,`#f97316`];function A9(e,n){if(!e)return[];let r=Object.entries(e).map(([e,n])=>({name:e,value:n})).sort((e,n)=>n.value-e.value);return n?r.slice(0,n):r}function Yme(){let e=et(),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)([]),[o,s]=(0,y.useState)(!0);(0,y.useEffect)(()=>{async function e(){try{s(!0);let[e,n]=await Promise.all([Vy.get(`/v1/stats`),Vy.get(`/v1/memories`)]);r(e),a(n?.memories||[])}catch(e){ir.error(`加载统计数据失败: `+e.message)}finally{s(!1)}}e()},[]);let c=(0,y.useMemo)(()=>{if(!n?.timeline?.length)return 0;let e=new Date().toISOString().split(`T`)[0];return n.timeline.find(n=>n.date===e)?.count??0},[n]),l=(0,y.useMemo)(()=>A9(n?.by_category,8),[n]),u=(0,y.useMemo)(()=>A9(n?.by_type),[n]),d=(0,y.useMemo)(()=>A9(n?.by_tier),[n]),f=(0,y.useMemo)(()=>A9(n?.by_state),[n]),p=(0,y.useMemo)(()=>A9(n?.by_visibility),[n]),m=(0,y.useMemo)(()=>A9(n?.by_agent,10),[n]),h=(0,y.useMemo)(()=>A9(n?.by_source,10),[n]),g=(0,y.useMemo)(()=>!n||!n.total||!n.total_access_count?`0%`:`${Math.min(100,Math.round(n.total_access_count/Math.max(1,n.total)*100))}%`,[n]),_=(0,y.useMemo)(()=>{let e=[];for(let n of i)if(n.tier_history)try{let r=JSON.parse(n.tier_history);for(let i of r)e.push({memoryId:n.id,...i})}catch{}return e.sort((e,n)=>n.at.localeCompare(e.at)),e.slice(0,50)},[i]),v={access_via_get:`访问触发`,access_via_search:`搜索触发`,access_via_recall:`召回触发`,access_via_cross_space_search:`跨空间搜索触发`,scheduled_evaluation:`定时评估`};return o?(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(_b,{className:`h-8 w-48`}),(0,G.jsx)(_b,{className:`h-8 w-24`})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,G.jsx)(_b,{className:`h-24`}),(0,G.jsx)(_b,{className:`h-24`}),(0,G.jsx)(_b,{className:`h-24`}),(0,G.jsx)(_b,{className:`h-24`})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsx)(_b,{className:`h-80`}),(0,G.jsx)(_b,{className:`h-80`}),(0,G.jsx)(_b,{className:`h-80`}),(0,G.jsx)(_b,{className:`h-80`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight flex items-center gap-2`,children:[(0,G.jsx)(Yp,{className:`size-5`}),`统计分析`]}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`记忆库数据洞察与可视化`})]}),(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>e(`/memories`),children:[(0,G.jsx)(Vp,{className:`size-4 mr-1.5`}),`返回记忆`]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`总记忆数`}),(0,G.jsx)(qp,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:n?.total??0})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`今日新增`}),(0,G.jsx)(qm,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:c})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`空间数`}),(0,G.jsx)(Sm,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:n?.total_spaces??Object.keys(n?.by_space??{}).length})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`活跃度`}),(0,G.jsx)(Wm,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:g})})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`平均重要性`}),(0,G.jsx)(Vm,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:n?.avg_importance?`${(n.avg_importance*100).toFixed(0)}%`:`—`})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,G.jsx)(mb,{className:`text-sm font-medium text-muted-foreground`,children:`平均置信度`}),(0,G.jsx)(Yp,{className:`size-4 text-muted-foreground`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`text-2xl font-bold`,children:n?.avg_confidence?`${(n.avg_confidence*100).toFixed(0)}%`:`—`})})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`分类分布`})}),(0,G.jsxs)(gb,{children:[(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(tJ,{children:[(0,G.jsx)(TB,{data:l,cx:`50%`,cy:`50%`,innerRadius:60,outerRadius:100,paddingAngle:2,dataKey:`value`,children:l.map((e,n)=>(0,G.jsx)(OE,{fill:k9[n%k9.length]},`cell-${e.name}`))}),(0,G.jsx)(lE,{})]})}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-4 justify-center`,children:l.map((e,n)=>(0,G.jsxs)(bJ,{variant:`secondary`,style:{backgroundColor:`${k9[n%k9.length]}20`,color:k9[n%k9.length]},children:[e.name,` (`,e.value,`)`]},e.name))})]})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`记忆类型分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(eJ,{data:u,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,stroke:`#333`}),(0,G.jsx)(dK,{dataKey:`name`,tick:{fontSize:12}}),(0,G.jsx)(OK,{tick:{fontSize:12}}),(0,G.jsx)(lE,{}),(0,G.jsx)(qV,{dataKey:`value`,fill:`#8b5cf6`,radius:[4,4,0,0]})]})})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`层级分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(tJ,{children:[(0,G.jsx)(TB,{data:d,cx:`50%`,cy:`50%`,outerRadius:100,dataKey:`value`,label:({name:e,value:n})=>`${e}: ${n}`,children:d.map((e,n)=>(0,G.jsx)(OE,{fill:k9[n%k9.length]},`tier-${e.name}`))}),(0,G.jsx)(lE,{})]})})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`状态分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(eJ,{data:f,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,stroke:`#333`}),(0,G.jsx)(dK,{dataKey:`name`,tick:{fontSize:12}}),(0,G.jsx)(OK,{tick:{fontSize:12}}),(0,G.jsx)(lE,{}),(0,G.jsx)(qV,{dataKey:`value`,fill:`#10b981`,radius:[4,4,0,0]})]})})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`可见性分布`})}),(0,G.jsxs)(gb,{children:[(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(tJ,{children:[(0,G.jsx)(TB,{data:p,cx:`50%`,cy:`50%`,innerRadius:60,outerRadius:100,paddingAngle:2,dataKey:`value`,children:p.map((e,n)=>(0,G.jsx)(OE,{fill:k9[n%k9.length]},`vis-${e.name}`))}),(0,G.jsx)(lE,{})]})}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-4 justify-center`,children:p.map((e,n)=>(0,G.jsxs)(bJ,{variant:`secondary`,style:{backgroundColor:`${k9[n%k9.length]}20`,color:k9[n%k9.length]},children:[e.name,` (`,e.value,`)`]},e.name))})]})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`Agent 分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(eJ,{data:m,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,stroke:`#333`}),(0,G.jsx)(dK,{dataKey:`name`,tick:{fontSize:12}}),(0,G.jsx)(OK,{tick:{fontSize:12}}),(0,G.jsx)(lE,{}),(0,G.jsx)(qV,{dataKey:`value`,fill:`#6366f1`})]})})})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{children:(0,G.jsx)(mb,{className:`text-base`,children:`来源分布`})}),(0,G.jsx)(gb,{children:(0,G.jsx)(DE,{width:`100%`,height:280,children:(0,G.jsxs)(eJ,{data:h,layout:`vertical`,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,stroke:`#333`}),(0,G.jsx)(dK,{type:`number`,tick:{fontSize:12}}),(0,G.jsx)(OK,{type:`category`,dataKey:`name`,tick:{fontSize:12},width:80}),(0,G.jsx)(lE,{}),(0,G.jsx)(qV,{dataKey:`value`,fill:`#f59e0b`,radius:[0,4,4,0]})]})})})]})]}),(0,G.jsxs)(fb,{className:`mt-4`,children:[(0,G.jsx)(pb,{children:(0,G.jsxs)(mb,{className:`flex items-center gap-1.5 text-base`,children:[(0,G.jsx)(hm,{className:`size-4 text-muted-foreground`}),`Tier 变更日志`]})}),(0,G.jsx)(gb,{children:_.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground py-4 text-center`,children:`暂无变更记录`}):(0,G.jsx)(`div`,{className:`space-y-1`,children:_.map(n=>{let r={peripheral:0,working:1,core:2};return(0,G.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 text-sm py-2 border-b last:border-b-0 hover:bg-muted/50 px-2 rounded cursor-pointer w-full text-left`,onClick:()=>e(`/memories/${n.memoryId}`),children:[(r[n.from]??0)<(r[n.to]??0)?(0,G.jsx)(Wp,{className:`size-4 text-emerald-500 shrink-0`}):(0,G.jsx)(Bp,{className:`size-4 text-red-500 shrink-0`}),(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs w-36 shrink-0`,children:new Date(n.at).toLocaleString(`zh-CN`)}),(0,G.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[n.memoryId.slice(0,8),`...`]}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(n.from),children:OJ(n.from)}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(n.to),children:OJ(n.to)}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground ml-auto`,children:[v[n.reason]||n.reason,` · #`,n.access_count]})]},n.memoryId+n.at)})})})]})]})}var Xme={access_via_get:`访问触发`,access_via_search:`搜索触发`,access_via_recall:`召回触发`,access_via_cross_space_search:`跨空间搜索触发`,scheduled_evaluation:`定时评估`},j9=20;function Zme(){let e=et(),n=Ze(),[r,i]=(0,y.useState)([]),[a,o]=(0,y.useState)(!0),[s,c]=(0,y.useState)(1),[l,u]=(0,y.useState)(`all`),[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1),[b,x]=(0,y.useState)(0);(0,y.useEffect)(()=>{n.state?.from===`tier-history`&&n.state?.page&&c(n.state.page)},[n.state]),(0,y.useEffect)(()=>{let e=setTimeout(()=>{m(d)},300);return()=>clearTimeout(e)},[d]);let S=(0,y.useCallback)(async e=>{o(!0);try{let n=(e-1)*j9,r={limit:String(j9),offset:String(n)};l===`promote`?r.filter=`promote`:l===`demote`&&(r.filter=`demote`),p.trim()&&(r.search=p.trim());let a=await Vy.get(`/v1/tier-changes`,{params:r});i(a.changes),x(a.totalCount)}catch(e){console.error(`Failed to fetch tier history:`,e)}finally{o(!1)}},[l,p]);(0,y.useEffect)(()=>{S(s)},[S,s]);let C=Math.max(1,Math.ceil(b/j9)),w=Math.min(s,C),T={peripheral:0,working:1,core:2},E=async()=>{if(!h)return;let e=h;v(!0);try{await Vy.post(`/v1/tier-changes/delete`,{memory_id:e.memoryId,from:e.from,to:e.to,at:e.at,reason:e.reason}),ir.success(`已删除该条变更记录`),i(n=>n.filter(n=>!(n.memoryId===e.memoryId&&n.from===e.from&&n.to===e.to&&n.at===e.at))),x(e=>Math.max(0,e-1))}catch(e){console.error(`Failed to delete tier history entry:`,e),ir.error(`删除失败`)}finally{v(!1),g(null)}},D=n=>{e(`/memories/${n}`,{state:{from:`tier-history`,page:w}})};return(0,G.jsxs)(`div`,{className:`space-y-6 max-w-5xl mx-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight flex items-center gap-2`,children:[(0,G.jsx)(hm,{className:`size-5`}),`等级变更历史`]}),(0,G.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`共 `,b,` 条记录`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-xs`,children:[(0,G.jsx)(Im,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground`}),(0,G.jsx)(`input`,{type:`text`,placeholder:`搜索标题、ID、原因...`,value:d,onChange:e=>{f(e.target.value),c(1)},className:`w-full h-9 pl-8 pr-3 rounded-md border border-input bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring`})]}),(0,G.jsxs)(d9,{value:l,onValueChange:e=>{e&&(u(e),c(1))},children:[(0,G.jsx)(p9,{className:`w-[130px]`,children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`all`,children:`全部`}),(0,G.jsx)(h9,{value:`promote`,children:`仅晋升`}),(0,G.jsx)(h9,{value:`demote`,children:`仅降级`})]})]})]}),!a&&r.length>0&&C>1&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`第 `,w,` / `,C,` 页`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(q,{variant:`outline`,size:`sm`,className:`h-7 px-2`,disabled:w<=1,onClick:()=>c(w-1),children:(0,G.jsx)(Qp,{className:`size-4`})}),Array.from({length:C},(e,n)=>n+1).filter(e=>e===1||e===C||Math.abs(e-w)<=2).map((e,n,r)=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[n>0&&r[n-1]!==e-1&&(0,G.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`}),(0,G.jsx)(q,{variant:e===w?`default`:`outline`,size:`sm`,className:`h-7 w-7 px-0`,onClick:()=>c(e),children:e})]},e)),(0,G.jsx)(q,{variant:`outline`,size:`sm`,className:`h-7 px-2`,disabled:w>=C,onClick:()=>c(w+1),children:(0,G.jsx)($p,{className:`size-4`})})]})]}),(0,G.jsx)(fb,{children:(0,G.jsxs)(gb,{className:`p-0`,children:[a?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground py-12 text-center`,children:`加载中...`}):r.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground py-12 text-center`,children:`暂无变更记录`}):(0,G.jsx)(`div`,{className:`divide-y`,children:r.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 hover:bg-muted/30 transition-colors`,children:[(T[e.from]??0)<(T[e.to]??0)?(0,G.jsx)(Wp,{className:`size-4 text-emerald-500 shrink-0`}):(0,G.jsx)(Bp,{className:`size-4 text-red-500 shrink-0`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground w-36 shrink-0`,children:new Date(e.at).toLocaleString(`zh-CN`)}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(e.from),children:OJ(e.from)}),(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(e.to),children:OJ(e.to)}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground w-20 shrink-0`,children:Xme[e.reason]||e.reason}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground w-16 shrink-0`,children:[`#`,e.accessCount]}),(0,G.jsx)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left text-sm truncate hover:underline cursor-pointer`,onClick:()=>D(e.memoryId),title:e.memoryTitle,children:e.memoryTitle}),(0,G.jsxs)(`span`,{className:`text-xs font-mono text-muted-foreground shrink-0`,children:[e.memoryId.slice(0,8),`...`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(q,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,onClick:()=>D(e.memoryId),title:`查看详情`,children:(0,G.jsx)(cm,{className:`size-3.5`})}),(0,G.jsx)(q,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-red-500 hover:text-red-600 hover:bg-red-500/10`,onClick:()=>g(e),title:`删除此条记录`,children:(0,G.jsx)(Km,{className:`size-3.5`})})]})]},`${e.memoryId}-${e.at}-${e.from}-${e.to}`))}),C>1&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-t`,children:[(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`第 `,w,` / `,C,` 页,共 `,b,` 条`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(q,{variant:`outline`,size:`sm`,className:`h-7 px-2`,disabled:w<=1,onClick:()=>c(w-1),children:(0,G.jsx)(Qp,{className:`size-4`})}),Array.from({length:C},(e,n)=>n+1).filter(e=>e===1||e===C||Math.abs(e-w)<=2).map((e,n,r)=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[n>0&&r[n-1]!==e-1&&(0,G.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`}),(0,G.jsx)(q,{variant:e===w?`default`:`outline`,size:`sm`,className:`h-7 w-7 px-0`,onClick:()=>c(e),children:e})]},e)),(0,G.jsx)(q,{variant:`outline`,size:`sm`,className:`h-7 px-2`,disabled:w>=C,onClick:()=>c(w+1),children:(0,G.jsx)($p,{className:`size-4`})})]})]})]})}),(0,G.jsx)(uJ,{open:!!h,onOpenChange:e=>{e||g(null)},children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除变更记录`}),(0,G.jsxs)(hJ,{children:[`确定要删除这条 `,h&&`${OJ(h.from)} → ${OJ(h.to)}`,` 的变更记录吗?记忆本身不会被删除。`]})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{onClick:()=>g(null),disabled:_,children:`取消`}),(0,G.jsx)(gJ,{disabled:_,onClick:e=>{e.preventDefault(),E()},className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:_?`删除中...`:`确认删除`})]})]})})]})}async function Qme(){return Vy.get(`/v1/stats/config`)}async function $me(){return Vy.get(`/v1/scheduler/status`)}async function ehe(e=50){return Vy.get(`/v1/tier-changes`,{params:{limit:e}})}async function the(){return Vy.post(`/v1/lifecycle/trigger`,{})}var M9={peripheral:0,working:1,core:2},nhe={access_via_get:`访问触发`,access_via_search:`搜索触发`,access_via_recall:`召回触发`,access_via_cross_space_search:`跨空间搜索触发`,scheduled_evaluation:`定时评估`};function N9(e){if(e<=0)return`每天 0:00`;if(e>=3600){let n=e/3600;return Number.isInteger(n)?`每 ${n} 小时`:`每 ${n.toFixed(1)} 小时`}return`每 ${Math.round(e/60)} 分钟`}function rhe(e){let{half_life_days:n,tiers:r}=e.decay,i=Math.log(2)/n,a=[];for(let e=0;e<=120;e+=2){let n={day:`D${e}`};for(let[a,o]of[[`core`,`Core`],[`working`,`Working`],[`peripheral`,`Peripheral`]]){let s=r?.[a];if(s){let r=Math.exp(-i*e**+s.beta);n[o]=Math.max(r,s.floor)}}a.push(n)}return a}function ihe(){return(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[1,2].map(e=>(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{className:`pb-2`,children:(0,G.jsx)(_b,{className:`h-4 w-28`})}),(0,G.jsxs)(gb,{className:`space-y-2`,children:[(0,G.jsx)(_b,{className:`h-4 w-full`}),(0,G.jsx)(_b,{className:`h-4 w-3/4`}),(0,G.jsx)(_b,{className:`h-4 w-1/2`})]})]},e))})}function ahe(){return(0,G.jsx)(`div`,{className:`space-y-2`,children:[1,2,3,4].map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,G.jsx)(_b,{className:`h-4 w-4`}),(0,G.jsx)(_b,{className:`h-3 w-24`}),(0,G.jsx)(_b,{className:`h-5 w-14`}),(0,G.jsx)(_b,{className:`h-3 w-4`}),(0,G.jsx)(_b,{className:`h-5 w-14`}),(0,G.jsx)(_b,{className:`h-3 flex-1`})]},e))})}function ohe(){let[e,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)([]),[s,c]=(0,y.useState)(0),[l,u]=(0,y.useState)(!0),[d,f]=(0,y.useState)(!0),[p,m]=(0,y.useState)(20),[h,g]=(0,y.useState)(!1),_=async()=>{try{u(!0);let[e,r]=await Promise.all([Qme(),$me().catch(()=>null)]);n(e),r&&i(r)}catch(e){console.error(`Failed to load lifecycle config:`,e),ir.error(`加载生命周期配置失败`)}finally{u(!1)}},v=async()=>{try{f(!0);let e=await ehe(p);o(e.changes||[]),c(e.totalCount||0)}catch(e){console.error(`Failed to load tier changes:`,e),ir.error(`加载升降级历史失败`)}finally{f(!1)}};(0,y.useEffect)(()=>{_(),v()},[]),(0,y.useEffect)(()=>{v()},[p]);let b=()=>{_(),v()},x=async()=>{try{g(!0);let e=await the();ir.success(e.message),_(),v()}catch(e){console.error(`Failed to trigger lifecycle:`,e),ir.error(`触发生命周期失败`)}finally{g(!1)}},S=e?rhe(e):[],C=a.filter(e=>(M9[e.from]??0)<(M9[e.to]??0)).length,w=a.filter(e=>(M9[e.from]??0)>=(M9[e.to]??0)).length;return(0,G.jsxs)(`div`,{className:`space-y-6 max-w-6xl mx-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h1`,{className:`text-2xl font-semibold tracking-tight flex items-center gap-2`,children:[(0,G.jsx)(Gm,{className:`size-5`}),`生命周期管理`]}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`记忆衰减、升降级、自动遗忘的生命周期策略`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:b,disabled:l&&d,children:[(0,G.jsx)(Pm,{className:`h-4 w-4 mr-1`}),`刷新`]}),(0,G.jsxs)(q,{variant:`default`,size:`sm`,onClick:x,disabled:h,children:[h?(0,G.jsx)(Em,{className:`h-4 w-4 mr-1 animate-spin`}):(0,G.jsx)(eh,{className:`h-4 w-4 mr-1`}),`立即执行`]})]})]}),(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`pb-3`,children:[(0,G.jsxs)(mb,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(rm,{className:`size-4 text-violet-500`}),`调度器状态`]}),(0,G.jsx)(hb,{children:`自动评估与遗忘任务的运行状态`})]}),(0,G.jsxs)(gb,{children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`调度间隔`}),(0,G.jsx)(`p`,{className:`text-lg font-semibold mt-1`,children:r?N9(r.interval_secs):`—`})]}),(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`预计下次运行`}),(0,G.jsx)(`p`,{className:`text-sm font-semibold mt-1`,children:r?.next_run_eta?new Date(r.next_run_eta).toLocaleString(`zh-CN`):r?.last_run_at?`${N9(r.interval_secs)}后`:`等待首次运行`})]}),(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`启动时运行`}),(0,G.jsx)(`div`,{className:`mt-1`,children:r?r.run_on_start?(0,G.jsx)(bJ,{variant:`outline`,className:`bg-emerald-500/10 text-emerald-600 border-emerald-500/30`,children:`已启用`}):(0,G.jsx)(bJ,{variant:`outline`,className:`bg-muted text-muted-foreground border-border`,children:`已禁用`}):(0,G.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`—`})})]})]}),(0,G.jsx)(`div`,{className:`mt-4 p-3 rounded-lg border border-dashed text-xs text-muted-foreground space-y-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cm,{className:`size-3.5`}),(0,G.jsx)(`span`,{children:`调度器将自动执行:Weibull 衰减计算、Tier 评估升降级、关键词 TTL 检测、Superseded 归档清理`})]})})]})]}),l?(0,G.jsx)(ihe,{}):e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{className:`pb-3`,children:(0,G.jsxs)(mb,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(zp,{className:`size-4 text-blue-500`}),`衰减参数`]})}),(0,G.jsxs)(gb,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`默认半衰期`}),(0,G.jsxs)(`p`,{className:`font-semibold`,children:[e.decay.half_life_days,` 天`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`Stale 阈值`}),(0,G.jsx)(`p`,{className:`font-semibold`,children:e.retrieval?.default_min_score??.3})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`权重分配`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-blue-500/10 text-blue-600 border-blue-500/30 text-xs`,children:[`时效 `,e.decay.recency_weight]}),(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-emerald-500/10 text-emerald-600 border-emerald-500/30 text-xs`,children:[`频率 `,e.decay.frequency_weight]}),(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-violet-500/10 text-violet-600 border-violet-500/30 text-xs`,children:[`内在 `,e.decay.intrinsic_weight]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Tier 衰减速率 (β)`}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:Object.entries(e.decay.tiers||{}).map(([e,n])=>(0,G.jsxs)(bJ,{variant:`outline`,className:`text-xs ${AJ(e)}`,children:[OJ(e),` β=`,n.beta]},e))})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Tier 底线分数`}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:Object.entries(e.decay.tiers||{}).map(([e,n])=>(0,G.jsxs)(bJ,{variant:`outline`,className:`text-xs ${AJ(e)}`,children:[OJ(e),` ≥`,n.floor]},e))})]})]})]}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{className:`pb-3`,children:(0,G.jsxs)(mb,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(qm,{className:`size-4 text-emerald-500`}),`升降级规则`]})}),(0,G.jsxs)(gb,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,G.jsx)(Wp,{className:`size-4 text-emerald-500`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(`peripheral`),children:OJ(`peripheral`)}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(`working`),children:OJ(`working`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`访问 ≥`,e.promotion.peripheral_to_working.min_access_count,`次`]}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`综合 ≥`,e.promotion.peripheral_to_working.min_composite]})]})]}),(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,G.jsx)(Wp,{className:`size-4 text-emerald-500`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(`working`),children:OJ(`working`)}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(`core`),children:OJ(`core`)})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`访问 ≥`,e.promotion.working_to_core.min_access_count,`次`]}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`综合 ≥`,e.promotion.working_to_core.min_composite]}),e.promotion.working_to_core.min_importance!=null&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`重要性 ≥`,e.promotion.working_to_core.min_importance]})]})]})]}),(0,G.jsxs)(`div`,{className:`p-3 rounded-lg border border-dashed space-y-2 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-muted-foreground`,children:[(0,G.jsx)(Bp,{className:`size-3.5 text-red-400`}),(0,G.jsx)(`span`,{children:`降级条件(需同时满足)`})]}),(0,G.jsxs)(`div`,{className:`ml-5 space-y-1 text-muted-foreground`,children:[(0,G.jsxs)(`div`,{children:[`• 综合分数 < `,e.demotion?.working_to_peripheral?.max_composite??.2]}),(0,G.jsx)(`div`,{children:`• 超过 90 天未访问`})]})]})]})]})]}),S.length>0&&(0,G.jsxs)(fb,{children:[(0,G.jsxs)(pb,{className:`pb-2`,children:[(0,G.jsxs)(mb,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,G.jsx)(eh,{className:`size-4 text-amber-500`}),`衰减曲线预览`]}),(0,G.jsx)(hb,{children:`基于当前配置参数生成的理论衰减趋势`})]}),(0,G.jsx)(gb,{children:(0,G.jsx)(`div`,{className:`h-64`,children:(0,G.jsx)(DE,{width:`100%`,height:`100%`,children:(0,G.jsxs)($q,{data:S,children:[(0,G.jsx)(ZW,{strokeDasharray:`3 3`,className:`opacity-30`}),(0,G.jsx)(dK,{dataKey:`day`,tick:{fontSize:11},interval:14,label:{value:`天数`,position:`insideBottomRight`,offset:-5,fontSize:11}}),(0,G.jsx)(OK,{domain:[0,1],tick:{fontSize:11},label:{value:`分数`,angle:-90,position:`insideLeft`,fontSize:11}}),(0,G.jsx)(lE,{contentStyle:{fontSize:12,borderRadius:8},formatter:e=>[e.toFixed(3)]}),(0,G.jsx)(ET,{iconType:`line`,wrapperStyle:{fontSize:12}}),(0,G.jsx)(TG,{type:`monotone`,dataKey:`Core`,stroke:`#f59e0b`,strokeWidth:2,dot:!1,name:`核心 (Core)`}),(0,G.jsx)(TG,{type:`monotone`,dataKey:`Working`,stroke:`#10b981`,strokeWidth:2,dot:!1,name:`工作区 (Working)`}),(0,G.jsx)(TG,{type:`monotone`,dataKey:`Peripheral`,stroke:`#94a3b8`,strokeWidth:2,dot:!1,name:`边缘 (Peripheral)`})]})})})})]})]}):(0,G.jsx)(fb,{children:(0,G.jsx)(gb,{className:`py-8 text-center`,children:(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`无法加载生命周期配置`})})}),(0,G.jsxs)(fb,{children:[(0,G.jsx)(pb,{className:`pb-2`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(mb,{className:`text-sm font-medium`,children:`升降级历史`}),(0,G.jsx)(hb,{children:`最近的 Tier 变更记录`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-emerald-500/10 text-emerald-600 border-emerald-500/30 text-xs`,children:[`↑ 升级 `,C]}),(0,G.jsxs)(bJ,{variant:`outline`,className:`bg-red-500/10 text-red-600 border-red-500/30 text-xs`,children:[`↓ 降级 `,w]}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`共 `,s,` 条`]})]})]})}),(0,G.jsx)(gb,{className:`p-0`,children:d?(0,G.jsx)(ahe,{}):a.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground py-12 text-center`,children:`暂无变更记录`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y`,children:a.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 hover:bg-muted/30 transition-colors`,children:[(M9[e.from]??0)<(M9[e.to]??0)?(0,G.jsx)(Wp,{className:`size-4 text-emerald-500 shrink-0`}):(0,G.jsx)(Bp,{className:`size-4 text-red-500 shrink-0`}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground w-36 shrink-0`,children:new Date(e.at).toLocaleString(`zh-CN`)}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(e.from),children:OJ(e.from)}),(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`→`}),(0,G.jsx)(bJ,{variant:`outline`,className:AJ(e.to),children:OJ(e.to)}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground w-20 shrink-0`,children:nhe[e.reason]||e.reason}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground w-12 shrink-0`,children:[`#`,e.accessCount]}),(0,G.jsx)(`span`,{className:`text-xs flex-1 min-w-0 truncate text-muted-foreground`,children:e.memoryTitle||e.memoryId?.slice(0,12)||`—`}),(0,G.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground shrink-0`,children:e.memoryId?`${e.memoryId.slice(0,8)}...`:`—`})]},`${e.memoryId}-${e.at}-${e.from}-${e.to}`))}),a.length<s&&(0,G.jsx)(`div`,{className:`flex items-center justify-center px-4 py-3 border-t`,children:(0,G.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>m(e=>e+20),children:`加载更多`})})]})})]})]})}var P9=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function F9(e){return y.useMemo(()=>({checked(n){return e.indeterminate?{}:n?{[P9.checked]:``}:{[P9.unchecked]:``}},...Ky}),[e.indeterminate])}function I9(e,n,r,i=!0,a){let[o,s]=y.useState(),c=yd(a?`${a}-label`:void 0),l=e??n??o;return Pr(()=>{let a=e||n||!i?void 0:she(r.current,c);o!==a&&s(a)}),l}function she(e,n){let r=che(e);if(r)return!r.id&&n&&(r.id=n),r.id||void 0}function che(e){if(!e)return;let n=e.parentElement;if(n&&n.tagName===`LABEL`)return n;let r=e.id;if(r){let n=e.nextElementSibling;if(n&&n.htmlFor===r)return n}let i=e.labels;return i&&i[0]}var L9=y.createContext(void 0);function lhe(){let e=y.useContext(L9);if(e===void 0)throw Error(Ir(14));return e}var uhe=`data-parent`,dhe=y.forwardRef(function(e,n){let{checked:r,className:i,defaultChecked:a=!1,"aria-labelledby":o,disabled:s=!1,form:c,id:l,indeterminate:u=!1,inputRef:d,name:f,onCheckedChange:p,parent:m=!1,readOnly:h=!1,render:g,required:_=!1,uncheckedValue:v,value:b,nativeButton:x=!1,style:S,...C}=e,{clearErrors:w}=Xy(),{disabled:T,name:E,setDirty:D,setFilled:O,setFocused:k,setTouched:A,state:j,validationMode:M,validityData:N,shouldValidateOnChange:P,validation:F}=Jy(),I=rb(),{labelId:L,controlId:R,registerControlId:z,getDescriptionProps:ee}=Qy(),B=ab(),V=B?.parent,H=V&&B.allValues,U=T||I.disabled||B?.disabled||s,te=E??f,W=b??te,ne=yd(),re=yd(),ie=R;H?ie=m?re:`${V.id}-${W}`:l&&(ie=l);let ae={};H&&(m?ae=B.parent.getParentProps():W&&(ae=B.parent.getChildProps(W)));let oe=Ca(p),{checked:se=r,indeterminate:ce=u,onCheckedChange:le,...ue}=ae,de=B?.value,fe=B?.setValue,pe=B?.defaultValue,me=y.useRef(null),he=Tr(()=>Symbol(`checkbox-control`)),ge=y.useRef(!1),{getButtonProps:_e,buttonRef:ve}=hh({disabled:U,native:x}),ye=B?.validation??F,[be,xe]=Mg({controlled:W&&de&&!m?de.includes(W):se,default:W&&pe&&!m?pe.includes(W):a,name:`Checkbox`,state:`checked`});Pr(()=>{z!==pi&&(ge.current=!0,z(he.current,ie))},[ie,B,z,m,he]),y.useEffect(()=>{let e=he.current;return()=>{!ge.current||z===pi||(ge.current=!1,z(e,void 0))}},[z,he]),$y(me,{enabled:!B,id:ne,value:be});let Se=y.useRef(null),Ce=pa(d,Se,ye.inputRef),we=I9(o,L,Se,!x,ie??void 0);Pr(()=>{Se.current&&(Se.current.indeterminate=ce,be&&O(!0))},[be,ce,O]),fg(be,()=>{B&&!m||(w(te),O(be),D(be!==N.initialValue),P()?ye.commit(be):ye.commit(be,!0))});let Te=Rs({checked:be,disabled:U,form:c,name:m?void 0:te,id:x?void 0:ie??void 0,required:_,ref:Ce,style:te?Na:Ma,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(h){e.preventDefault();return}let n=e.currentTarget.checked,r=Ii(xi,e.nativeEvent);le?.(n,r),oe(n,r),!r.isCanceled&&(xe(n),W&&de&&fe&&!m&&!H&&fe(n?[...de,W]:de.filter(e=>e!==W),r))},onFocus(){me.current?.focus()}},b===void 0?hi:{value:(B?be&&b:b)||``},ee,B?ye.getValidationProps:ye.getInputValidationProps),Ee=H?!!se:be,De=H&&ce||u;y.useEffect(()=>{if(!V||!W)return;let e=V.disabledStatesRef.current;return e.set(W,U),()=>{e.delete(W)}},[V,U,W]);let Oe=y.useMemo(()=>({...j,checked:Ee,disabled:U,readOnly:h,required:_,indeterminate:De}),[j,Ee,U,h,_,De]),ke=F9(Oe),Ae=Qs(`span`,e,{state:Oe,ref:[ve,me,n,B?.registerControlRef],props:[{id:x?ie??void 0:ne,role:`checkbox`,"aria-checked":ce?`mixed`:be,"aria-readonly":h||void 0,"aria-required":_||void 0,"aria-labelledby":we,[uhe]:m?``:void 0,onFocus(){k(!0)},onBlur(){let e=Se.current;e&&(A(!0),k(!1),M===`onBlur`&&ye.commit(B?de:e.checked))},onClick(e){h||U||(e.preventDefault(),Se.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ee,ye.getValidationProps,C,ue,_e],stateAttributesMapping:ke});return(0,G.jsxs)(L9.Provider,{value:Oe,children:[Ae,!be&&!B&&te&&!m&&v!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,form:c,name:te,value:v}),(0,G.jsx)(`input`,{...Te,suppressHydrationWarning:!0})]})}),fhe=y.forwardRef(function(e,n){let{render:r,className:i,style:a,keepMounted:o=!1,...s}=e,c=lhe(),l=c.checked||c.indeterminate,{mounted:u,transitionStatus:d,setMounted:f}=su(l),p=y.useRef(null),m={...c,transitionStatus:d};pu({open:l,ref:p,onComplete(){l||f(!1)}});let h=F9(c),g=y.useMemo(()=>({...h,...du,...Ky}),[h]),_=o||u,v=Qs(`span`,e,{ref:[n,p],state:m,stateAttributesMapping:g,props:s});return _?v:null});function phe({className:e,...n}){return(0,G.jsx)(dhe,{"data-slot":`checkbox`,className:Tp(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...n,children:(0,G.jsx)(fhe,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,G.jsx)(Xp,{})})})}var R9=2e3,z9=150,B9=`omem-import-task`,mhe={completed:`✓`,failed:`✗`,pending:`⋯`,processing:`⋯`,skipped:`–`};function V9({label:e,status:n,detail:r}){let i=mhe[n]??`·`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,G.jsx)(`span`,{className:`font-mono w-4 ${n===`completed`?`text-green-500`:n===`failed`?`text-red-500`:n===`processing`||n===`pending`?`text-blue-500 animate-pulse`:`text-muted-foreground`}`,children:i}),(0,G.jsx)(`span`,{className:`font-medium w-24 shrink-0`,children:e}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground flex-1`,children:r})]})}function hhe(e){let n=e.toLowerCase();return n.endsWith(`.json`)?`json`:n.endsWith(`.csv`)?`memory`:n.endsWith(`.md`)||n.endsWith(`.markdown`)?`markdown`:`memory`}function ghe(){let e=et(),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(null),[f,p]=(0,y.useState)(!1),m=(0,y.useRef)(null),h=(0,y.useCallback)(e=>{l(e),e?sessionStorage.setItem(B9,JSON.stringify(e)):sessionStorage.removeItem(B9)},[]),g=(0,y.useCallback)(()=>{l(null),sessionStorage.removeItem(B9)},[]);(0,y.useEffect)(()=>{let e=sessionStorage.getItem(B9);if(e)try{let n=JSON.parse(e);if(l(n),n.status===`completed`||n.status===`failed`)return;a(!0);let r=!1,i=0,o=async()=>{if(!(r||i>=z9)){i+=1;try{let e=await Vy.get(`/v1/imports/${n.id}`);if(r)return;if(l(e),sessionStorage.setItem(B9,JSON.stringify(e)),e.status===`completed`||e.status===`failed`){a(!1);return}}catch{}m.current=setTimeout(o,R9)}};return m.current=setTimeout(o,R9),()=>{r=!0,m.current&&clearTimeout(m.current)}}catch{sessionStorage.removeItem(B9)}},[]);let _=(0,y.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),e.type===`dragenter`||e.type===`dragover`?p(!0):e.type===`dragleave`&&p(!1)},[]),v=(0,y.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),p(!1),e.dataTransfer.files&&e.dataTransfer.files[0]&&(r(e.dataTransfer.files[0]),g(),d(null))},[g]),b=e=>{e.target.files&&e.target.files[0]&&(r(e.target.files[0]),g(),d(null))},x=e=>e.endsWith(`.json`)?(0,G.jsx)(lm,{className:`h-8 w-8 text-blue-500`}):e.endsWith(`.csv`)?(0,G.jsx)(um,{className:`h-8 w-8 text-green-500`}):e.endsWith(`.md`)||e.endsWith(`.markdown`)?(0,G.jsx)(dm,{className:`h-8 w-8 text-purple-500`}):(0,G.jsx)(dm,{className:`h-8 w-8 text-muted-foreground`}),S=(0,y.useCallback)(async(e,n)=>{if(n>=z9){d(`导入超时(5分钟未完成),请稍后在记忆列表查看结果`),a(!1);return}try{let r=await Vy.get(`/v1/imports/${e}`);if(h(r),r.status===`completed`||r.status===`failed`){a(!1),r.status===`completed`?ir.success(`导入完成:提取 ${r.extraction_facts} 条,合并 ${r.reconcile_merged} 条`):(d(r.errors?.join(`
|
|
165
165
|
`)||`导入失败`),ir.error(`导入失败`));return}m.current=setTimeout(()=>S(e,n+1),R9)}catch(e){d(e.message||`查询导入状态失败`),a(!1)}},[h]);return(0,G.jsxs)(`div`,{className:`space-y-6 max-w-3xl`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>e(`/memories`),children:(0,G.jsx)(Vp,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`批量导入`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`从 JSON、CSV 或 Markdown 文件导入记忆`})]})]}),(0,G.jsx)(fb,{className:`border-2 border-dashed p-8 transition-colors ${f?`border-primary bg-primary/5`:`border-border`}`,onDragEnter:_,onDragLeave:_,onDragOver:_,onDrop:v,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 text-center`,children:[(0,G.jsx)(Ym,{className:`h-10 w-10 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:n?n.name:`拖拽文件到此处,或点击选择`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`支持 JSON、CSV、Markdown 格式`})]}),(0,G.jsx)(`input`,{type:`file`,accept:`.json,.csv,.md,.markdown`,onChange:b,className:`hidden`,id:`file-upload`}),(0,G.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>document.getElementById(`file-upload`)?.click(),children:`选择文件`})]})}),n&&(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[x(n.name),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium truncate`,children:n.name}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(n.size/1024).toFixed(1),` KB`]})]}),(0,G.jsx)(q,{onClick:async()=>{if(!n){ir.error(`请先选择文件`);return}let e=new FormData;e.append(`file`,n),e.append(`file_type`,hhe(n.name)),e.append(`force`,o?`true`:`false`),a(!0),d(null),h(null);try{let n=await Vy.post(`/v1/imports`,e,{timeout:12e4});h(n),n.status===`completed`?(a(!1),ir.success(`导入完成:提取 ${n.extraction_facts} 条,合并 ${n.reconcile_merged} 条`)):S(n.id,0)}catch(e){let n=e.response?.data,r=typeof n==`string`?n:n?.error?.message||n?.error||n?.message||e.message||`导入失败`,i=typeof r==`string`?r:JSON.stringify(r);d(i),ir.error(i),a(!1)}},disabled:i,size:`sm`,children:i?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Em,{className:`h-4 w-4 mr-1 animate-spin`}),`处理中`]}):`开始导入`})]}),(0,G.jsxs)(`label`,{htmlFor:`force-import`,className:`flex items-center gap-2 text-xs text-muted-foreground cursor-pointer`,children:[(0,G.jsx)(phe,{id:`force-import`,checked:o,onCheckedChange:e=>s(e===!0)}),(0,G.jsx)(`span`,{children:`强制导入(忽略 SHA256 重复检查)`})]})]}),u&&(0,G.jsxs)(fb,{className:`p-6 border-red-500/30`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,G.jsx)(nm,{className:`h-5 w-5 text-red-500`}),(0,G.jsx)(`h3`,{className:`font-semibold text-red-500`,children:`导入失败`})]}),(0,G.jsx)(`pre`,{className:`text-xs text-muted-foreground whitespace-pre-wrap break-all`,children:u})]}),c&&(0,G.jsxs)(fb,{className:`p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[c.status===`completed`?(0,G.jsx)(tm,{className:`h-5 w-5 text-green-500`}):c.status===`failed`?(0,G.jsx)(nm,{className:`h-5 w-5 text-red-500`}):(0,G.jsx)(Em,{className:`h-5 w-5 text-blue-500 animate-spin`}),(0,G.jsx)(`h3`,{className:`font-semibold`,children:c.status===`completed`?`导入完成`:c.status===`failed`?`导入失败`:`后台处理中`}),(0,G.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground font-mono`,children:[`task: `,c.id.slice(0,8),`…`]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(V9,{label:`存储阶段`,status:c.storage_stored>0?`completed`:`skipped`,detail:`${c.storage_stored} 已存 / ${c.storage_skipped} 跳过`}),(0,G.jsx)(V9,{label:`LLM 提取`,status:c.extraction_status,detail:`${c.extraction_facts} 条 facts(${c.extraction_progress}%)`}),(0,G.jsx)(V9,{label:`Reconcile 合并`,status:c.reconcile_status,detail:`${c.reconcile_merged} 条合并到记忆库(${c.reconcile_progress}%)`})]}),c.status===`completed`&&(0,G.jsxs)(`div`,{className:`mt-4 rounded-lg bg-blue-500/10 p-3 text-xs text-blue-600`,children:[`导入流程已完成。新记忆会在 `,(0,G.jsx)(`button`,{type:`button`,onClick:()=>e(`/memories`),className:`underline font-medium`,children:`记忆列表`}),` 中显示。`]}),c.errors.length>0&&(0,G.jsxs)(`div`,{className:`mt-4 space-y-1`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-red-500`,children:`错误:`}),c.errors.map(e=>(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e.slice(0,40)))]})]}),(0,G.jsxs)(fb,{className:`p-6`,children:[(0,G.jsx)(`h3`,{className:`font-semibold mb-3`,children:`支持格式说明`}),(0,G.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(lm,{className:`h-4 w-4 text-blue-500 mt-0.5`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium`,children:`JSON`}),(0,G.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`标准 JSON 数组格式,每条记忆包含 content, tags, category 等字段`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(um,{className:`h-4 w-4 text-green-500 mt-0.5`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium`,children:`CSV`}),(0,G.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`包含列:content, tags, category, importance, confidence`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(dm,{className:`h-4 w-4 text-purple-500 mt-0.5`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium`,children:`Markdown`}),(0,G.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`每条记忆用标题分隔,支持 frontmatter 元数据`})]})]})]})]})]})}function _he(){let{theme:e,setTheme:n}=Cr(),{hasPassword:r,setPassword:i,lock:a}=Uy(),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(!1),[f,p]=(0,y.useState)(!1);return(0,G.jsxs)(`div`,{className:`space-y-6 max-w-2xl`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`系统设置`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`管理您的偏好设置和数据`})]}),(0,G.jsxs)(fb,{className:`p-6`,children:[(0,G.jsx)(`h3`,{className:`font-semibold mb-4`,children:`外观`}),(0,G.jsx)(`div`,{className:`space-y-4`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(cb,{className:`text-sm font-medium`,children:`主题模式`}),(0,G.jsxs)(`div`,{className:`flex gap-2 mt-2`,children:[(0,G.jsxs)(q,{variant:e===`light`?`default`:`outline`,size:`sm`,onClick:()=>n(`light`),className:`gap-2`,children:[(0,G.jsx)(Hm,{className:`h-4 w-4`}),`亮色`]}),(0,G.jsxs)(q,{variant:e===`dark`?`default`:`outline`,size:`sm`,onClick:()=>n(`dark`),className:`gap-2`,children:[(0,G.jsx)(km,{className:`h-4 w-4`}),`暗黑`]}),(0,G.jsxs)(q,{variant:e===`system`?`default`:`outline`,size:`sm`,onClick:()=>n(`system`),className:`gap-2`,children:[(0,G.jsx)(ree,{className:`h-4 w-4`}),`跟随系统`]})]})]})})]}),(0,G.jsxs)(fb,{className:`p-6`,children:[(0,G.jsx)(`h3`,{className:`font-semibold mb-4`,children:`私密空间 Vault`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Vault 密码已设置。私密记忆需要输入密码才能查看。`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>l(!c),children:[(0,G.jsx)(Om,{className:`h-4 w-4 mr-2`}),`修改密码`]}),(0,G.jsxs)(q,{variant:`destructive`,size:`sm`,onClick:()=>p(!0),children:[(0,G.jsx)(Km,{className:`h-4 w-4 mr-2`}),`重置 Vault`]})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`尚未设置 Vault 密码。设置后,私密记忆将受到密码保护。`}),(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>l(!0),children:[(0,G.jsx)(Om,{className:`h-4 w-4 mr-2`}),`设置 Vault 密码`]})]}),c&&(0,G.jsxs)(`div`,{className:`flex gap-2 mt-4`,children:[(0,G.jsx)(`input`,{type:`password`,placeholder:`输入新密码`,value:o,onChange:e=>s(e.target.value),className:`flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm`}),(0,G.jsx)(q,{size:`sm`,onClick:()=>{if(!o||o.length<4){ir.error(`密码至少需要 4 位`);return}i(o),ir.success(`Vault 密码已设置`),s(``),l(!1)},children:`确认`})]})]})]}),(0,G.jsxs)(fb,{className:`p-6`,children:[(0,G.jsx)(`h3`,{className:`font-semibold mb-4`,children:`数据管理`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:`导出记忆数据`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`从服务端导出所有记忆为 JSON 文件`})]}),(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:async()=>{d(!0);try{let e=await Vy.get(`/v1/memories`,{params:{limit:1e4}}),n={memories:e.memories||[],total_count:e.total_count||0,exportedAt:new Date().toISOString()},r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`omem-memories-${new Date().toISOString().slice(0,10)}.json`,a.click(),URL.revokeObjectURL(i),ir.success(`已导出 ${n.total_count} 条记忆`)}catch(e){console.error(`Failed to export memories:`,e),ir.error(`导出记忆数据失败`)}finally{d(!1)}},disabled:u,children:[(0,G.jsx)(om,{className:`h-4 w-4 mr-2`}),u?`导出中...`:`导出`]})]}),(0,G.jsx)(S7,{}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:`导出本地配置`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`将登录信息、主题等本地设置导出备份`})]}),(0,G.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>{let e={auth:JSON.parse(sessionStorage.getItem(`omem-auth`)||`{}`),vault:`已迁移到服务端存储`,theme:localStorage.getItem(`omem-theme`)||`system`,exportedAt:new Date().toISOString()},n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`omem-config-${new Date().toISOString().slice(0,10)}.json`,i.click(),URL.revokeObjectURL(r),ir.success(`本地配置已导出`)},children:[(0,G.jsx)(eee,{className:`h-4 w-4 mr-2`}),`导出`]})]}),(0,G.jsx)(S7,{}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:`清除缓存`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`清除所有本地存储的数据(不可逆)`})]}),(0,G.jsxs)(q,{variant:`destructive`,size:`sm`,onClick:()=>{sessionStorage.clear(),ir.success(`缓存已清除`,{description:`所有本地数据已清除,刷新页面后生效`})},children:[(0,G.jsx)(Km,{className:`h-4 w-4 mr-2`}),`清除`]})]})]})]}),(0,G.jsxs)(fb,{className:`p-6`,children:[(0,G.jsx)(`h3`,{className:`font-semibold mb-4`,children:`关于`}),(0,G.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ym,{className:`h-4 w-4 text-muted-foreground`}),(0,G.jsx)(`span`,{children:`Cerebro Web v0.1.0`})]}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Cerebro 自部署版 Web 管理端`}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`备案号:`,(0,G.jsx)(`a`,{href:`https://beian.miit.gov.cn`,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`吉ICP备2026003061号`})]})]})]}),(0,G.jsx)(uJ,{open:f,onOpenChange:p,children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认重置 Vault`}),(0,G.jsx)(hJ,{children:`此操作不可恢复。重置后所有受 Vault 保护的私密记忆将无法访问。`})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{onClick:()=>p(!1),children:`取消`}),(0,G.jsx)(gJ,{onClick:async()=>{try{await Vy.delete(`/v1/vault/password`),a(),ir.success(`Vault 已重置`),l(!1),p(!1)}catch{ir.error(`重置 Vault 失败`)}},className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:`确认重置`})]})]})})]})}function H9(e){return`/v2/profile${e}`}var U9={getPreferences(e){return Vy.get(H9(`/preferences`),{params:e?{project_path:e}:void 0})},getPreference(e){return Vy.get(H9(`/preferences/${e}`))},createPreference(e){return Vy.post(H9(`/preferences`),e)},updatePreference(e,n){return Vy.put(H9(`/preferences/${e}`),n)},deletePreference(e){return Vy.delete(H9(`/preferences/${e}`))},getStats(e){return Vy.get(H9(`/stats`),{params:e?{project_path:e}:void 0})},getInjection(e){return Vy.get(H9(`/inject`),{params:e?{project_path:e}:void 0})},triggerInduction(e,n){return Vy.post(H9(`/induction/trigger`),{candidate_texts:e??[],project_path:n})},getInductionRuns(e){return Vy.get(H9(`/induction/runs`),{params:e?{project_path:e}:void 0})},getVersions(e){return Vy.get(H9(`/versions`),{params:e?{project_path:e}:void 0})},getChangelog(e){return Vy.get(H9(`/changelog`),{params:e?{project_path:e}:void 0})}};function W9(e){let n=e.toLowerCase();return n.includes(`喜欢`)||n.includes(`偏好`)||n.includes(`习惯`)?{type:`preference`,icon:wm,color:`text-amber-600 dark:text-amber-400`,bgColor:`bg-amber-50 dark:bg-amber-500/10 border-amber-200 dark:border-amber-500/30`,label:`偏好`}:n.includes(`项目`)||n.includes(`工程`)||n.includes(`开发`)?{type:`project`,icon:eh,color:`text-blue-600 dark:text-blue-400`,bgColor:`bg-blue-50 dark:bg-blue-500/10 border-blue-200 dark:border-blue-500/30`,label:`项目`}:n.includes(`技能`)||n.includes(`能力`)||n.includes(`精通`)||n.includes(`熟练`)?{type:`skill`,icon:Bm,color:`text-violet-600 dark:text-violet-400`,bgColor:`bg-violet-50 dark:bg-violet-500/10 border-violet-200 dark:border-violet-500/30`,label:`技能`}:n.includes(`笔记`)||n.includes(`记录`)||n.includes(`文档`)?{type:`note`,icon:Gp,color:`text-slate-600 dark:text-slate-400`,bgColor:`bg-slate-50 dark:bg-slate-500/10 border-slate-200 dark:border-slate-500/30`,label:`笔记`}:{type:`fact`,icon:Zm,color:`text-emerald-600 dark:text-emerald-400`,bgColor:`bg-emerald-50 dark:bg-emerald-500/10 border-emerald-200 dark:border-emerald-500/30`,label:`事实`}}function vhe(){return{type:`private`,icon:Om,color:`text-amber-600 dark:text-amber-400`,bgColor:`bg-amber-50 dark:bg-amber-500/10 border-amber-200 dark:border-amber-500/30`,label:`私密`}}function G9(e){return e.replace(/^#+\s*/,``).trim()}function yhe(e,n){return n===`private`?!0:e.some(e=>e===`私密`||e.toLowerCase()===`private`)}function bhe(e){return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function K9(e){let n=Date.now()-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return`刚刚`;if(r<60)return`${r} 分钟前`;let i=Math.floor(r/60);if(i<24)return`${i} 小时前`;let a=Math.floor(i/24);return a<30?`${a} 天前`:bhe(e)}function q9({content:e}){let[n,r]=(0,y.useState)(!1),i=(0,y.useRef)(null),[a,o]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{let e=i.current;if(!e)return;let n=new ResizeObserver(()=>o(e.scrollHeight>e.clientHeight));return n.observe(e),()=>n.disconnect()},[]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:Tp(`relative`,!n&&`max-h-60 overflow-hidden`),children:[(0,G.jsx)(`div`,{ref:i,className:`prose prose-sm dark:prose-invert max-w-none`,children:(0,G.jsx)(_0,{remarkPlugins:[i3],children:e})}),!n&&a&&(0,G.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-background to-transparent pointer-events-none`})]}),a&&(0,G.jsx)(q,{variant:`ghost`,size:`sm`,className:`mt-1 h-auto py-1 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>r(!n),children:n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(em,{className:`size-3 mr-1`}),`收起`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Zp,{className:`size-3 mr-1`}),`展开全文`]})})]})}var xhe=[{name:`communication_style`,display:`沟通风格`},{name:`tone`,display:`语气偏好`},{name:`code_style`,display:`代码风格`},{name:`error_handling`,display:`错误处理`},{name:`naming_convention`,display:`命名规范`},{name:`testing_strategy`,display:`测试策略`},{name:`workflow_preference`,display:`工作流偏好`},{name:`commit_style`,display:`提交风格`},{name:`emoji_preference`,display:`Emoji偏好`},{name:`self_reference`,display:`自称方式`},{name:`address_style`,display:`称呼方式`},{name:`language`,display:`语言`},{name:`framework_preference`,display:`框架偏好`},{name:`preferred_tools`,display:`工具偏好`}],She={communication_style:`沟通风格`,coding_preferences:`编码偏好`,project_context:`项目上下文`,tool_preferences:`工具偏好`,domain_knowledge:`领域知识`,work_style:`工作风格`,language_preference:`语言偏好`,framework_preferences:`框架偏好`},Che={communication_style:zp,coding_preferences:eh,project_context:fm,tool_preferences:Sm,domain_knowledge:Gp,work_style:Nm,language_preference:wm,framework_preferences:Bm};function whe(e){return She[e]||e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function The(e){return Che[e]||Sm}var Ehe={global:{className:`bg-blue-50 dark:bg-blue-500/10 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-500/30`,label:`全局`},project:{className:`bg-violet-50 dark:bg-violet-500/10 text-violet-700 dark:text-violet-300 border-violet-200 dark:border-violet-500/30`,label:`项目`},session:{className:`bg-emerald-50 dark:bg-emerald-500/10 text-emerald-700 dark:text-emerald-300 border-emerald-200 dark:border-emerald-500/30`,label:`会话`}};function Dhe(){let e=et(),n=Uy(e=>e.unlock),r=Uy(e=>e.hasPassword),i=Uy(e=>e.isUnlocked),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)([]),[d,f]=(0,y.useState)([]),[p,m]=(0,y.useState)(!0),[h,g]=(0,y.useState)(`preferences`),[_,v]=(0,y.useState)(``),[b,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(``),[E,D]=(0,y.useState)(null),[O,k]=(0,y.useState)(!1),[A,j]=(0,y.useState)(new Set),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)(null),[I,L]=(0,y.useState)(!1),[R,z]=(0,y.useState)(null),[ee,B]=(0,y.useState)(!1),[V,H]=(0,y.useState)(``),[U,te]=(0,y.useState)(`all`),[W,ne]=(0,y.useState)(1),[re,ie]=(0,y.useState)(1);(0,y.useEffect)(()=>{async function e(){try{m(!0);let e=_||void 0,[n,r,i,a]=await Promise.all([Vy.get(`/v1/profile`).catch(()=>null),U9.getStats(e).catch(()=>null),U9.getPreferences(e).catch(()=>[]),U9.getChangelog(e).catch(()=>[])]);n&&o(n),r&&c(r),u(Array.isArray(i)?i:[]),f(Array.isArray(a)?a:[])}catch(e){console.error(`Failed to load profile:`,e),ir.error(`加载画像数据失败`)}finally{m(!1)}}e()},[_]);let ae=async()=>{if(!w.trim()){D(`请输入密码`);return}k(!0);let e=await n(w);if(k(!1),!e){D(`密码错误`);return}S&&j(e=>new Set(e).add(S)),x(!1),C(null),T(``),D(null),ir.success(`已解锁`)},oe=e=>{if(i){j(n=>new Set(n).add(e));return}if(!r){ir.error(`请先在设置中设置密码`);return}C(e),T(``),D(null),x(!0)},se=a?.static_facts||[],ce=a?.dynamic_context||[],le=(0,y.useMemo)(()=>se.map(e=>{let n=yhe(e.tags||[],e.visibility),r=n?vhe():W9(e.content);return{fact:e.content,factObj:e,isPrivate:n,meta:r}}),[se]),ue=(0,y.useMemo)(()=>{let e=new Map;for(let n of l){if(U!==`all`&&n.scope!==U)continue;if(V.trim()){let e=V.toLowerCase();if(!n.value.toLowerCase().includes(e)&&!n.slot.toLowerCase().includes(e)&&!(n.project_path||``).toLowerCase().includes(e))continue}let r=e.get(n.slot)||[];r.push(n),e.set(n.slot,r)}return e},[l,V,U]),de=(0,y.useMemo)(()=>Array.from(ue.entries()),[ue]),fe=Math.max(1,Math.ceil(de.length/5)),pe=(0,y.useMemo)(()=>{let e=(W-1)*5;return de.slice(e,e+5)},[de,W]),me=async()=>{let e=_||void 0,[n,r]=await Promise.all([U9.getPreferences(e),U9.getStats(e).catch(()=>null)]);u(Array.isArray(n)?n:[]),r&&c(r)},he=async e=>{if(!(!(`slot`in e)||!e.slot))try{L(!0),await U9.createPreference(e),ir.success(`偏好已创建`),N(!1),await me()}catch{ir.error(`创建失败`)}finally{L(!1)}},ge=async(e,n)=>{try{L(!0),await U9.updatePreference(e,n),ir.success(`偏好已更新`),F(null);let r=_||void 0,i=await U9.getPreferences(r);u(Array.isArray(i)?i:[])}catch{ir.error(`更新失败`)}finally{L(!1)}},_e=async()=>{if(R)try{B(!0),await U9.deletePreference(R.id),ir.success(`偏好已删除`),z(null),await me()}catch{ir.error(`删除失败`)}finally{B(!1)}},ve=(0,y.useMemo)(()=>{let e=new Set;for(let n of l)n.project_path&&e.add(n.project_path);return Array.from(e).sort()},[l]),ye=l.length;return(0,G.jsxs)(`div`,{className:`min-h-screen bg-gradient-to-b from-background via-background to-muted/30`,children:[(0,G.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-6`,children:[(0,G.jsxs)(q,{variant:`ghost`,size:`sm`,className:`text-muted-foreground hover:text-foreground -ml-2`,onClick:()=>e(-1),children:[(0,G.jsx)(Vp,{className:`size-4 mr-1.5`}),`返回`]}),(0,G.jsxs)(`div`,{className:`relative overflow-hidden rounded-2xl bg-gradient-to-br from-amber-50 via-orange-50 to-rose-50 dark:from-amber-500/10 dark:via-orange-500/5 dark:to-rose-500/10 border border-amber-200/50 dark:border-amber-500/20 p-6 md:p-8`,children:[(0,G.jsx)(`div`,{className:`absolute top-0 right-0 -mt-8 -mr-8 w-48 h-48 bg-amber-400/15 dark:bg-amber-500/10 rounded-full blur-3xl`}),(0,G.jsx)(`div`,{className:`absolute bottom-0 left-0 -mb-6 -ml-6 w-36 h-36 bg-orange-400/10 dark:bg-orange-500/8 rounded-full blur-3xl`}),(0,G.jsxs)(`div`,{className:`relative z-10 flex flex-col md:flex-row md:items-center md:justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-14 rounded-2xl bg-gradient-to-br from-amber-400 to-orange-500 shadow-lg shadow-amber-500/25`,children:(0,G.jsx)(Zm,{className:`size-7 text-white`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl md:text-3xl font-bold tracking-tight text-foreground`,children:`用户画像`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`偏好 · 记忆 · 洞察`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-4 py-2.5 rounded-xl bg-white/80 dark:bg-card/80 border border-amber-200/60 dark:border-amber-500/20 shadow-sm`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-8 rounded-lg bg-amber-100 dark:bg-amber-500/15`,children:(0,G.jsx)(Sm,{className:`size-4 text-amber-600 dark:text-amber-400`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-lg font-bold leading-none text-foreground`,children:ye}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`条偏好`})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-4 py-2.5 rounded-xl bg-white/80 dark:bg-card/80 border border-orange-200/60 dark:border-orange-500/20 shadow-sm`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-8 rounded-lg bg-orange-100 dark:bg-orange-500/15`,children:(0,G.jsx)(Yp,{className:`size-4 text-orange-600 dark:text-orange-400`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-lg font-bold leading-none text-foreground`,children:s?.total??0}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`归纳总量`})]})]}),s?.last_induction_at&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-4 py-2.5 rounded-xl bg-white/80 dark:bg-card/80 border border-rose-200/60 dark:border-rose-500/20 shadow-sm`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-8 rounded-lg bg-rose-100 dark:bg-rose-500/15`,children:(0,G.jsx)(rm,{className:`size-4 text-rose-600 dark:text-rose-400`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-semibold leading-none text-foreground`,children:K9(s.last_induction_at)}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`最近归纳`})]})]})]})]})]}),(0,G.jsxs)(O7,{value:h,onValueChange:g,className:`space-y-4`,children:[(0,G.jsxs)(k7,{className:`bg-muted/60 p-1 h-auto`,children:[(0,G.jsxs)(A7,{value:`preferences`,className:`data-[state=active]:bg-background data-[state=active]:shadow-sm gap-1.5 px-4 py-2 text-sm`,children:[(0,G.jsx)(Bm,{className:`size-3.5`}),`偏好管理`]}),(0,G.jsxs)(A7,{value:`overview`,className:`data-[state=active]:bg-background data-[state=active]:shadow-sm gap-1.5 px-4 py-2 text-sm`,children:[(0,G.jsx)(Zm,{className:`size-3.5`}),`画像概览`]}),(0,G.jsxs)(A7,{value:`changelog`,className:`data-[state=active]:bg-background data-[state=active]:shadow-sm gap-1.5 px-4 py-2 text-sm`,children:[(0,G.jsx)(hm,{className:`size-3.5`}),`变更历史`]})]}),(0,G.jsxs)(j7,{value:`preferences`,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative flex-1 w-full sm:max-w-xs`,children:[(0,G.jsx)(Im,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground`}),(0,G.jsx)(sb,{placeholder:`搜索偏好...`,value:V,onChange:e=>{H(e.target.value),ne(1)},className:`pl-9 h-9 bg-muted/40`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ve.length>0&&(0,G.jsxs)(d9,{value:_,onValueChange:e=>e!=null&&v(e),children:[(0,G.jsxs)(p9,{className:`h-9 w-[180px] text-xs`,children:[(0,G.jsx)(fm,{className:`size-3.5 mr-1.5 text-muted-foreground`}),(0,G.jsx)(f9,{placeholder:`全部项目`})]}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`__all__`,children:`全部项目`}),ve.map(e=>(0,G.jsx)(h9,{value:e,children:e.split(`/`).pop()||e},e))]})]}),(0,G.jsxs)(d9,{value:U,onValueChange:e=>{e!=null&&(te(e),ne(1))},children:[(0,G.jsx)(p9,{className:`h-9 w-[100px] text-xs`,children:(0,G.jsx)(f9,{placeholder:`范围`})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`all`,children:`全部范围`}),(0,G.jsx)(h9,{value:`global`,children:`全局`}),(0,G.jsx)(h9,{value:`project`,children:`项目`}),(0,G.jsx)(h9,{value:`session`,children:`会话`})]})]})]}),(0,G.jsxs)(q,{className:`ml-auto h-9 gap-1.5 bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white shadow-sm`,onClick:()=>N(!0),children:[(0,G.jsx)(Mm,{className:`size-4`}),`新建偏好`]})]}),p?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(_b,{className:`h-5 w-24 rounded-md`}),(0,G.jsx)(_b,{className:`h-24 w-full rounded-xl`})]},e))}):ue.size===0?(0,G.jsx)(fb,{className:`border-dashed`,children:(0,G.jsxs)(gb,{className:`py-16 flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-12 rounded-2xl bg-muted`,children:(0,G.jsx)(Bm,{className:`size-6`})}),(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:`暂无偏好数据`}),(0,G.jsx)(`p`,{className:`text-xs mt-1`,children:`点击「新建偏好」开始构建你的画像`})]})]})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{id:`pref-slot-list`,className:`space-y-4`,children:pe.map(([e,n])=>(0,G.jsx)(Ohe,{slot:e,preferences:n,onEdit:e=>F(e),onDelete:e=>z(e)},e))}),fe>1&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 pt-2`,children:[(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`第 `,W,` / `,fe,` 页 · 共 `,de.length,` 个分组`]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(q,{variant:`outline`,size:`icon`,className:`size-8`,disabled:W<=1,onClick:()=>{ne(e=>Math.max(1,e-1)),document.getElementById(`pref-slot-list`)?.scrollIntoView({behavior:`smooth`,block:`start`})},children:(0,G.jsx)(Qp,{className:`size-4`})}),Array.from({length:fe},(e,n)=>n+1).filter(e=>e===1||e===fe||Math.abs(e-W)<=2).map((e,n,r)=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[n>0&&r[n-1]!==e-1&&(0,G.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`}),(0,G.jsx)(q,{variant:e===W?`default`:`outline`,size:`icon`,className:Tp(`size-8 text-xs`,e===W&&`bg-gradient-to-r from-amber-500 to-orange-500 text-white border-0`),onClick:()=>{ne(e),document.getElementById(`pref-slot-list`)?.scrollIntoView({behavior:`smooth`,block:`start`})},children:e})]},e)),(0,G.jsx)(q,{variant:`outline`,size:`icon`,className:`size-8`,disabled:W>=fe,onClick:()=>{ne(e=>Math.min(fe,e+1)),document.getElementById(`pref-slot-list`)?.scrollIntoView({behavior:`smooth`,block:`start`})},children:(0,G.jsx)($p,{className:`size-4`})})]})]})]})]}),(0,G.jsx)(j7,{value:`overview`,className:`space-y-6`,children:p?(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[1,2,3,4].map(e=>(0,G.jsx)(_b,{className:`h-48 w-full rounded-xl`},e))}):(0,G.jsxs)(G.Fragment,{children:[le.length>0&&(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Rm,{className:`size-5 text-amber-500`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:`画像特征`}),(0,G.jsxs)(bJ,{variant:`secondary`,className:`text-[10px]`,children:[le.length,` 条`]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:le.map(({fact:e,factObj:n,isPrivate:r,meta:i})=>{let a=i.icon,o=A.has(e),s=r&&o&&n?.l2_content||G9(e);return(0,G.jsx)(fb,{className:Tp(`relative overflow-hidden border transition-all duration-200 hover:shadow-md`,r&&!o&&`border-amber-200 dark:border-amber-500/30`),children:(0,G.jsxs)(gb,{className:`p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsx)(`div`,{className:Tp(`flex items-center justify-center size-8 rounded-lg border`,i.bgColor),children:(0,G.jsx)(a,{className:Tp(`size-4`,i.color)})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,G.jsxs)(bJ,{variant:`outline`,className:`text-[10px] gap-1 bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-500/30`,children:[(0,G.jsx)(Om,{className:`size-2.5`}),`私密`]}),(0,G.jsx)(bJ,{variant:`outline`,className:Tp(`text-[10px]`,i.bgColor,i.color),children:i.label})]})]}),(0,G.jsx)(`div`,{className:Tp(r&&!o&&`blur-[6px] select-none opacity-40`),children:(0,G.jsx)(q9,{content:s})}),r&&!o&&(0,G.jsx)(`button`,{type:`button`,className:`mt-3 w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg bg-amber-50 dark:bg-amber-500/10 text-amber-700 dark:text-amber-300 text-xs font-medium hover:bg-amber-100 dark:hover:bg-amber-500/20 transition-colors border border-amber-200 dark:border-amber-500/30 cursor-pointer`,onClick:()=>oe(e),children:o?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(sm,{className:`size-3.5`}),`已解锁`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Om,{className:`size-3.5`}),`点击解锁私密内容`]})})]})},`sf-${e.slice(0,40)}`)})})]}),ce.length>0&&(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(S7,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(zp,{className:`size-5 text-blue-500`}),(0,G.jsx)(`h2`,{className:`text-lg font-semibold`,children:`静态偏好`}),(0,G.jsxs)(bJ,{variant:`secondary`,className:`text-[10px]`,children:[ce.length,` 条`]})]}),(0,G.jsxs)(`div`,{className:`relative pl-6 space-y-3`,children:[(0,G.jsx)(`div`,{className:`absolute left-[11px] top-2 bottom-2 w-px bg-gradient-to-b from-blue-300 via-orange-300 to-transparent dark:from-blue-500/40 dark:via-orange-500/40 dark:to-transparent`}),ce.map((e,n)=>{let r=W9(e),i=r.icon;return(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`div`,{className:`absolute -left-6 top-2.5 size-[22px] rounded-full bg-gradient-to-br from-blue-400 to-orange-400 ring-[3px] ring-background flex items-center justify-center shadow-sm group-hover:scale-110 transition-transform`,children:(0,G.jsx)(`span`,{className:`text-[9px] font-bold text-white`,children:n+1})}),(0,G.jsx)(fb,{className:`overflow-hidden hover:shadow-sm transition-shadow`,children:(0,G.jsxs)(gb,{className:`p-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,G.jsx)(`div`,{className:Tp(`flex items-center justify-center size-5 rounded-md border`,r.bgColor),children:(0,G.jsx)(i,{className:Tp(`size-3`,r.color)})}),(0,G.jsx)(`span`,{className:Tp(`text-[10px] font-medium px-1.5 py-0.5 rounded border`,r.bgColor,r.color),children:r.label})]}),(0,G.jsx)(q9,{content:G9(e)})]})})]},`dc-${n}`)})]})]}),le.length===0&&ce.length===0&&(0,G.jsx)(fb,{className:`border-dashed`,children:(0,G.jsxs)(gb,{className:`py-16 flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-12 rounded-2xl bg-muted`,children:(0,G.jsx)(Zm,{className:`size-6`})}),(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:`暂无画像数据`}),(0,G.jsx)(`p`,{className:`text-xs mt-1`,children:`存储更多记忆后,系统将自动构建您的用户画像`})]})]})})]})}),(0,G.jsx)(j7,{value:`changelog`,className:`space-y-4`,children:p?(0,G.jsx)(`div`,{className:`space-y-3`,children:[1,2,3].map(e=>(0,G.jsx)(_b,{className:`h-20 w-full rounded-xl`},e))}):d.length===0?(0,G.jsx)(fb,{className:`border-dashed`,children:(0,G.jsxs)(gb,{className:`py-16 flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-12 rounded-2xl bg-muted`,children:(0,G.jsx)(hm,{className:`size-6`})}),(0,G.jsxs)(`div`,{className:`text-center`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium`,children:`暂无变更记录`}),(0,G.jsx)(`p`,{className:`text-xs mt-1`,children:`偏好变更时将自动记录在这里`})]})]})}):(()=>{let e=Math.ceil(d.length/10),n=d.slice((re-1)*10,re*10);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`relative pl-6 space-y-3`,children:[(0,G.jsx)(`div`,{className:`absolute left-[11px] top-2 bottom-2 w-px bg-gradient-to-b from-violet-300 via-sky-300 to-transparent dark:from-violet-500/40 dark:via-sky-500/40 dark:to-transparent`}),n.map(e=>{let n=e.action===`created`,r=e.action===`updated`,i=n?{bg:`from-emerald-400 to-teal-400`,color:`text-emerald-700 dark:text-emerald-300`,badgeClass:`bg-emerald-50 dark:bg-emerald-500/10 text-emerald-700 dark:text-emerald-300 border-emerald-200 dark:border-emerald-500/30`,symbol:`+`,label:`创建`}:r?{bg:`from-blue-400 to-sky-400`,color:`text-blue-700 dark:text-blue-300`,badgeClass:`bg-blue-50 dark:bg-blue-500/10 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-500/30`,symbol:`~`,label:`更新`}:{bg:`from-rose-400 to-red-400`,color:`text-rose-700 dark:text-rose-300`,badgeClass:`bg-rose-50 dark:bg-rose-500/10 text-rose-700 dark:text-rose-300 border-rose-200 dark:border-rose-500/30`,symbol:`−`,label:`删除`};return(0,G.jsxs)(`div`,{className:`relative group min-w-0`,children:[(0,G.jsx)(`div`,{className:Tp(`absolute -left-6 top-2.5 size-[22px] rounded-full bg-gradient-to-br ring-[3px] ring-background flex items-center justify-center shadow-sm group-hover:scale-110 transition-transform`,i.bg),children:(0,G.jsx)(`span`,{className:`text-[9px] font-bold text-white`,children:i.symbol})}),(0,G.jsx)(fb,{className:`overflow-hidden hover:shadow-sm transition-shadow min-w-0`,children:(0,G.jsxs)(gb,{className:`p-4 space-y-2 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsxs)(bJ,{variant:`outline`,className:Tp(`text-[10px] gap-1 shrink-0`,i.badgeClass),children:[n?(0,G.jsx)(Mm,{className:`size-2.5`}):r?(0,G.jsx)(jm,{className:`size-2.5`}):(0,G.jsx)(Km,{className:`size-2.5`}),i.label]}),e.source&&(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:e.source}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground ml-auto shrink-0`,children:K9(e.created_at)})]}),e.old_value&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground line-through break-all`,children:e.old_value}),e.new_value&&(0,G.jsx)(`p`,{className:`text-sm leading-relaxed break-words`,children:e.new_value})]})})]},e.id)})]}),e>1&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2 pt-2`,children:[(0,G.jsxs)(q,{variant:`outline`,size:`sm`,className:`h-7 text-xs gap-1`,disabled:re<=1,onClick:()=>ie(e=>Math.max(1,e-1)),children:[(0,G.jsx)(Qp,{className:`size-3`}),`上一页`]}),(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:Array.from({length:e},(e,n)=>n+1).filter(n=>n===1||n===e||Math.abs(n-re)<=2).map((e,n,r)=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[n>0&&r[n-1]!==e-1&&(0,G.jsx)(`span`,{className:`px-1 text-xs text-muted-foreground`,children:`...`}),(0,G.jsx)(q,{variant:re===e?`default`:`ghost`,size:`sm`,className:`h-7 w-7 text-xs p-0`,onClick:()=>ie(e),children:e})]},e))}),(0,G.jsxs)(q,{variant:`outline`,size:`sm`,className:`h-7 text-xs gap-1`,disabled:re>=e,onClick:()=>ie(n=>Math.min(e,n+1)),children:[`下一页`,(0,G.jsx)($p,{className:`size-3`})]})]})]})})()})]})]}),(0,G.jsx)(uJ,{open:!!R,onOpenChange:e=>{!e&&!ee&&z(null)},children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除偏好`}),(0,G.jsxs)(hJ,{children:[`确定要删除这条偏好吗?此操作不可撤销。`,R&&(0,G.jsx)(`span`,{className:`block mt-2 px-3 py-2 rounded-lg bg-muted text-sm text-foreground max-h-24 overflow-y-auto break-words`,children:R.value})]})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{disabled:ee,children:`取消`}),(0,G.jsx)(gJ,{disabled:ee,onClick:_e,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:ee?`删除中...`:`删除`})]})]})}),(0,G.jsx)(J9,{open:M,onOpenChange:N,saving:I,onSubmit:he,title:`新建偏好`}),(0,G.jsx)(J9,{open:!!P,onOpenChange:e=>{e||F(null)},saving:I,onSubmit:e=>{P&&ge(P.id,e)},pref:P,title:`编辑偏好`}),(0,G.jsx)(C9,{open:b,onOpenChange:e=>{e||(x(!1),T(``),D(null))},children:(0,G.jsxs)(w9,{className:`sm:max-w-sm`,children:[(0,G.jsxs)(T9,{children:[(0,G.jsxs)(D9,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Om,{className:`size-4 text-amber-500`}),`解锁私密记忆`]}),(0,G.jsx)(O9,{children:`请输入您的 Vault 密码以解锁受保护的内容。`})]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{className:`text-xs`,children:`密码`}),(0,G.jsx)(sb,{type:`password`,placeholder:`输入 Vault 密码...`,value:w,onChange:e=>{T(e.target.value),D(null)},onKeyDown:e=>e.key===`Enter`&&ae(),className:E?`border-destructive`:``,autoFocus:!0}),E&&(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:E})]})}),(0,G.jsxs)(E9,{children:[(0,G.jsx)(q,{variant:`outline`,onClick:()=>x(!1),disabled:O,children:`取消`}),(0,G.jsx)(q,{onClick:ae,disabled:O||!w.trim(),children:O?`解锁中...`:`解锁`})]})]})})]})}function Ohe({slot:e,preferences:n,onEdit:r,onDelete:i}){let[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(4),l=The(e),u=n.slice(0,s),d=s<n.length;return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2.5 w-full group cursor-pointer text-left border-none bg-transparent p-0`,onClick:()=>{o(!a),c(4)},children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-7 rounded-lg bg-gradient-to-br from-amber-100 to-orange-100 dark:from-amber-500/15 dark:to-orange-500/15 border border-amber-200/60 dark:border-amber-500/20`,children:(0,G.jsx)(l,{className:`size-3.5 text-amber-600 dark:text-amber-400`})}),(0,G.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:whe(e)}),(0,G.jsx)(bJ,{variant:`secondary`,className:`text-[10px]`,children:n.length}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsx)($p,{className:Tp(`size-4 text-muted-foreground transition-transform duration-200`,!a&&`rotate-90`)})]}),!a&&(0,G.jsxs)(`div`,{className:`space-y-2.5 pl-9`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:u.map(e=>(0,G.jsx)(khe,{pref:e,onEdit:r,onDelete:i},e.id))}),d&&(0,G.jsxs)(`button`,{type:`button`,className:`w-full flex items-center justify-center gap-1.5 py-2 text-xs text-muted-foreground hover:text-foreground transition-colors rounded-lg hover:bg-muted/50 cursor-pointer`,onClick:()=>c(e=>Math.min(e+4,n.length)),children:[(0,G.jsx)(Zp,{className:`size-3.5`}),`加载更多(剩余 `,n.length-s,` 条)`]})]})]})}function khe({pref:e,onEdit:n,onDelete:r}){let i=Ehe[e.scope]||{className:`bg-slate-50 dark:bg-slate-500/10 text-slate-700 dark:text-slate-300 border-slate-200 dark:border-slate-500/30`,label:e.scope};return(0,G.jsx)(fb,{className:`group hover:shadow-md transition-all duration-200 border-border/60`,children:(0,G.jsxs)(gb,{className:`p-3.5 space-y-2.5`,children:[(0,G.jsx)(`p`,{className:`text-sm leading-relaxed whitespace-pre-wrap break-words`,children:e.value}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,G.jsx)(bJ,{variant:`outline`,className:Tp(`text-[10px] gap-1`,i.className),children:i.label}),e.project_path&&(0,G.jsxs)(bJ,{variant:`outline`,className:`text-[10px] gap-1 bg-violet-50 dark:bg-violet-500/10 text-violet-700 dark:text-violet-300 border-violet-200 dark:border-violet-500/30`,children:[(0,G.jsx)(fm,{className:`size-2.5`}),e.project_path.split(`/`).pop()]}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground ml-auto`,children:K9(e.updated_at)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity pt-1 border-t border-border/40`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground mr-auto`,children:[`置信度 `,(e.confidence*100).toFixed(0),`%`]}),(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7 text-muted-foreground hover:text-foreground`,onClick:()=>n(e),children:(0,G.jsx)(jm,{className:`size-3.5`})}),(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7 text-muted-foreground hover:text-destructive`,onClick:()=>r(e),children:(0,G.jsx)(Km,{className:`size-3.5`})})]})]})})}function J9({open:e,onOpenChange:n,saving:r,onSubmit:i,pref:a,title:o}){let s=!!a,[c,l]=(0,y.useState)(a?.slot||``),[u,d]=(0,y.useState)(``),[f,p]=(0,y.useState)(a?.value||``),[m,h]=(0,y.useState)(String(a?.confidence??.8)),[g,_]=(0,y.useState)(a?.scope||`global`),[v,b]=(0,y.useState)(a?.project_path||``);(0,y.useEffect)(()=>{if(e){let e=a?.slot||``;l(e),d(e.startsWith(`custom:`)?e.slice(7):``),p(a?.value||``),h(String(a?.confidence??.8)),_(a?.scope||`global`),b(a?.project_path||``)}},[e,a]);let x=c===`__custom__`;return(0,G.jsx)(C9,{open:e,onOpenChange:n,children:(0,G.jsxs)(w9,{className:`sm:max-w-md`,children:[(0,G.jsxs)(T9,{children:[(0,G.jsxs)(D9,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Bm,{className:`size-4 text-amber-500`}),o]}),(0,G.jsx)(O9,{children:s?`修改偏好信息。`:`添加一条新的偏好。`})]}),(0,G.jsxs)(`div`,{className:`space-y-4 py-1`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{className:`text-xs`,children:`Slot (类别)`}),s?(0,G.jsx)(sb,{value:c,disabled:!0,className:`h-9 bg-muted/60`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(d9,{value:c||void 0,onValueChange:e=>e!=null&&l(e),children:[(0,G.jsx)(p9,{className:`h-9 w-full`,children:(0,G.jsx)(f9,{placeholder:`选择类别...`})}),(0,G.jsxs)(m9,{children:[xhe.map(e=>(0,G.jsx)(h9,{value:e.name,children:e.display},e.name)),(0,G.jsx)(h9,{value:`__custom__`,children:`自定义 (custom:...)`})]})]}),x&&(0,G.jsx)(sb,{placeholder:`自定义 slot 名 (小写字母+数字+下划线)`,value:u,onChange:e=>{d(e.target.value.replace(/[^a-z0-9_]/g,``))},className:`h-9`,maxLength:50})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{className:`text-xs`,children:`范围`}),(0,G.jsxs)(d9,{value:g,onValueChange:e=>e!=null&&_(e),children:[(0,G.jsx)(p9,{className:`h-9`,children:(0,G.jsx)(f9,{})}),(0,G.jsxs)(m9,{children:[(0,G.jsx)(h9,{value:`global`,children:`全局`}),(0,G.jsx)(h9,{value:`project`,children:`项目`}),(0,G.jsx)(h9,{value:`session`,children:`会话`})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{className:`text-xs`,children:`内容`}),(0,G.jsx)(y9,{placeholder:`偏好内容...`,value:f,onChange:e=>p(e.target.value),rows:3,className:`resize-none`,maxLength:500})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{className:`text-xs`,children:`置信度 (0-1)`}),(0,G.jsx)(sb,{type:`number`,min:`0`,max:`1`,step:`0.1`,value:m,onChange:e=>h(e.target.value),className:`h-9`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{className:`text-xs`,children:`项目路径 (可选)`}),(0,G.jsx)(sb,{placeholder:`例: /path/to/project`,value:v,onChange:e=>b(e.target.value),className:`h-9`,maxLength:200})]})]})]}),(0,G.jsxs)(E9,{children:[(0,G.jsx)(q,{variant:`outline`,onClick:()=>n(!1),disabled:r,children:`取消`}),(0,G.jsx)(q,{onClick:()=>{let e=x?`custom:${u.trim()}`:c.trim();if(!e||!f.trim()){ir.error(`请填写 Slot 和内容`);return}if(x&&!u.trim()){ir.error(`请填写自定义 Slot 名`);return}if(s){let e={};f!==(a?.value||``)&&(e.value=f.trim()),m!==String(a?.confidence??.8)&&(e.confidence=parseFloat(m)),g!==(a?.scope||`global`)&&(e.scope=g),v!==(a?.project_path||``)&&(e.project_path=v.trim()||void 0),i(e)}else i({slot:e,value:f.trim(),confidence:parseFloat(m)||.8,scope:g,project_path:v.trim()||void 0})},disabled:r||!f.trim()||(x?!u.trim():!c.trim()),className:`bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white`,children:r?s?`保存中...`:`创建中...`:s?`保存`:`创建`})]})]})})}var Y9=y.createContext(void 0);function Ahe(){let e=y.useContext(Y9);if(e===void 0)throw Error(Ir(63));return e}var X9=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Z9={...Ky,checked(e){return e?{[X9.checked]:``}:{[X9.unchecked]:``}}},jhe=y.forwardRef(function(e,n){let{checked:r,className:i,defaultChecked:a,"aria-labelledby":o,form:s,id:c,inputRef:l,name:u,nativeButton:d=!1,onCheckedChange:f,readOnly:p=!1,required:m=!1,disabled:h=!1,render:g,uncheckedValue:_,value:v,style:b,...x}=e,{clearErrors:S}=Xy(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=Jy(),{labelId:P}=Qy(),F=j||h,I=M??u,L=Ca(f),R=y.useRef(null),z=pa(R,l,N.inputRef),ee=y.useRef(null),B=yd(),V=eb({id:c,implicit:!1,controlRef:ee}),H=d?void 0:V,[U,te]=Mg({controlled:r,default:!!a,name:`Switch`,state:`checked`});$y(ee,{id:B,value:U}),Pr(()=>{R.current&&D(R.current.checked)},[R,D]),fg(U,()=>{S(I),T(U!==E.initialValue),D(U),k()?N.commit(U):N.commit(U,!0)});let{getButtonProps:W,buttonRef:ne}=hh({disabled:F,native:d}),re=I9(o,P,R,!d,H),ie={id:d?V:B,role:`switch`,"aria-checked":U,"aria-readonly":p||void 0,"aria-required":m||void 0,"aria-labelledby":re,onFocus(){F||O(!0)},onBlur(){let e=R.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){p||F||(e.preventDefault(),R.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ae=y.useMemo(()=>Rs({checked:U,disabled:F,form:s,id:H,name:I,required:m,style:I?Na:Ma,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:z,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(p){e.preventDefault();return}let n=e.currentTarget.checked,r=Ii(xi,e.nativeEvent);L?.(n,r),!r.isCanceled&&te(n)},onFocus(){ee.current?.focus()}},N.getInputValidationProps,v===void 0?hi:{value:v}),[U,F,s,z,H,I,L,p,m,te,N,v]),oe=y.useMemo(()=>({...C,checked:U,disabled:F,readOnly:p,required:m}),[C,U,F,p,m]),se=Qs(`span`,e,{state:oe,ref:[n,ee,ne],props:[ie,N.getValidationProps,x,W],stateAttributesMapping:Z9});return(0,G.jsxs)(Y9.Provider,{value:oe,children:[se,!U&&I&&_!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,form:s,name:I,value:_}),(0,G.jsx)(`input`,{...ae,suppressHydrationWarning:!0})]})}),Mhe=y.forwardRef(function(e,n){let{render:r,className:i,style:a,...o}=e,{state:s}=Jy(),c=Ahe();return Qs(`span`,e,{state:{...s,...c},ref:n,stateAttributesMapping:Z9,props:o})});function Nhe({className:e,size:n=`default`,...r}){return(0,G.jsx)(jhe,{"data-slot":`switch`,"data-size":n,className:Tp(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...r,children:(0,G.jsx)(Mhe,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var Q9={list(){return Vy.get(`/v1/categories`)},get(e){return Vy.get(`/v1/categories/${encodeURIComponent(e)}`)},create(e){return Vy.post(`/v1/categories`,e)},update(e,n){return Vy.put(`/v1/categories/${encodeURIComponent(e)}`,n)},delete(e){return Vy.delete(`/v1/categories/${encodeURIComponent(e)}`)},listAliases(){return Vy.get(`/v1/categories/aliases`)},createAlias(e,n){return Vy.post(`/v1/categories/aliases`,{alias:e,target:n})},deleteAlias(e){return Vy.delete(`/v1/categories/aliases/${encodeURIComponent(e)}`)}},$9={name:``,display_name:``,description:``,decision_rule:``,always_merge:!1,append_only:!1,temporal_versioned:!1,merge_supported:!1,admission_weight:.5,importance_base:.5,prompt_format:``,default_visibility:`global`,default_scope:`global`,default_ttl_days:0,sort_order:100,is_active:!0};function Phe(){let[e,n]=(0,y.useState)([]),[r,i]=(0,y.useState)([]),[a,o]=(0,y.useState)(!0),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)($9),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(!1),[_,v]=(0,y.useState)(``),[b,x]=(0,y.useState)(``),[S,C]=(0,y.useState)(null),w=(0,y.useCallback)(async()=>{try{let e=await Q9.list();n(Array.isArray(e)?e:[])}catch{ir.error(`加载分类失败`)}},[]),T=(0,y.useCallback)(async()=>{try{let e=await Q9.listAliases();i(Array.isArray(e)?e:[])}catch{ir.error(`加载别名失败`)}},[]);(0,y.useEffect)(()=>{Promise.all([w(),T()]).finally(()=>o(!1))},[w,T]);let E=()=>{c(null),f($9),u(!0)},D=e=>{c(e),f({name:e.name,display_name:e.display_name,description:e.description,decision_rule:e.decision_rule||``,always_merge:e.always_merge,append_only:e.append_only,temporal_versioned:e.temporal_versioned,merge_supported:e.merge_supported,admission_weight:e.admission_weight,importance_base:e.importance_base,prompt_format:e.prompt_format||``,default_visibility:e.default_visibility,default_scope:e.default_scope,default_ttl_days:e.default_ttl_days||0,sort_order:e.sort_order,is_active:e.is_active}),u(!0)};return a?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64 text-muted-foreground`,children:`加载中...`}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-bold`,children:`分类字典`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`管理记忆分类和别名映射`})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(q,{variant:`outline`,onClick:()=>g(!0),children:[(0,G.jsx)(Tm,{className:`size-4 mr-1`}),`添加别名`]}),(0,G.jsxs)(q,{onClick:E,children:[(0,G.jsx)(Mm,{className:`size-4 mr-1`}),`新建分类`]})]})]}),(0,G.jsx)(S7,{}),r.length>0&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,G.jsx)(Tm,{className:`size-4`}),`别名映射 (`,r.length,`)`]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:r.map(e=>(0,G.jsxs)(fb,{className:`p-3 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-xs`,children:e.alias}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,G.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-xs`,children:e.target})]}),(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7 text-destructive hover:text-destructive`,onClick:()=>C(e.alias),children:(0,G.jsx)($m,{className:`size-3.5`})})]},e.alias))}),(0,G.jsx)(S7,{})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,G.jsx)(Um,{className:`size-4`}),`分类列表 (`,e.length,`)`]}),(0,G.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-muted/50`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`text-left p-3 font-medium`,children:`名称`}),(0,G.jsx)(`th`,{className:`text-left p-3 font-medium`,children:`显示名`}),(0,G.jsx)(`th`,{className:`text-left p-3 font-medium hidden md:table-cell`,children:`描述`}),(0,G.jsx)(`th`,{className:`text-center p-3 font-medium`,children:`权重`}),(0,G.jsx)(`th`,{className:`text-center p-3 font-medium`,children:`状态`}),(0,G.jsx)(`th`,{className:`text-right p-3 font-medium`,children:`操作`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y`,children:e.map(e=>(0,G.jsxs)(`tr`,{className:`hover:bg-muted/30`,children:[(0,G.jsx)(`td`,{className:`p-3`,children:(0,G.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-xs`,children:e.name})}),(0,G.jsx)(`td`,{className:`p-3 font-medium`,children:e.display_name}),(0,G.jsx)(`td`,{className:`p-3 text-muted-foreground hidden md:table-cell max-w-[200px] truncate`,children:e.description}),(0,G.jsx)(`td`,{className:`p-3 text-center`,children:(0,G.jsx)(`span`,{className:`text-xs`,children:e.admission_weight.toFixed(2)})}),(0,G.jsx)(`td`,{className:`p-3 text-center`,children:(0,G.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${e.is_active?`bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400`:`bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400`}`,children:e.is_active?`启用`:`禁用`})}),(0,G.jsx)(`td`,{className:`p-3 text-right`,children:(0,G.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:()=>D(e),children:(0,G.jsx)(iee,{className:`size-3.5`})}),(0,G.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7 text-destructive hover:text-destructive`,onClick:()=>m(e.name),children:(0,G.jsx)(Km,{className:`size-3.5`})})]})})]},e.name))})]})})]}),(0,G.jsx)(C9,{open:l,onOpenChange:u,children:(0,G.jsxs)(w9,{className:`max-w-lg max-h-[80vh] overflow-y-auto`,children:[(0,G.jsx)(T9,{children:(0,G.jsx)(D9,{children:s?`编辑分类`:`新建分类`})}),(0,G.jsxs)(`div`,{className:`space-y-4 py-2`,children:[!s&&(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`名称 (name)`}),(0,G.jsx)(sb,{value:d.name,onChange:e=>f(n=>({...n,name:e.target.value.toLowerCase()})),placeholder:`e.g. preferences`,maxLength:50})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`显示名 (display_name)`}),(0,G.jsx)(sb,{value:d.display_name,onChange:e=>f(n=>({...n,display_name:e.target.value})),placeholder:`e.g. 偏好设置`,maxLength:100})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`描述`}),(0,G.jsx)(sb,{value:d.description,onChange:e=>f(n=>({...n,description:e.target.value})),placeholder:`分类描述`,maxLength:500})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`决策规则 (decision_rule)`}),(0,G.jsx)(sb,{value:d.decision_rule,onChange:e=>f(n=>({...n,decision_rule:e.target.value})),placeholder:`可选`,maxLength:200})]}),(0,G.jsx)(S7,{}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`准入权重`}),(0,G.jsx)(sb,{type:`number`,step:.05,min:0,max:1,value:d.admission_weight,onChange:e=>f(n=>({...n,admission_weight:+e.target.value}))})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`重要性基数`}),(0,G.jsx)(sb,{type:`number`,step:.05,min:0,max:1,value:d.importance_base,onChange:e=>f(n=>({...n,importance_base:+e.target.value}))})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`排序`}),(0,G.jsx)(sb,{type:`number`,value:d.sort_order,onChange:e=>f(n=>({...n,sort_order:+e.target.value}))})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`默认TTL (天)`}),(0,G.jsx)(sb,{type:`number`,value:d.default_ttl_days,onChange:e=>f(n=>({...n,default_ttl_days:+e.target.value}))})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`提示格式 (prompt_format)`}),(0,G.jsx)(sb,{value:d.prompt_format,onChange:e=>f(n=>({...n,prompt_format:e.target.value})),placeholder:`可选`,maxLength:500})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`默认可见性`}),(0,G.jsxs)(`select`,{className:`w-full h-9 rounded-md border border-input bg-background px-3 text-sm`,value:d.default_visibility,onChange:e=>f(n=>({...n,default_visibility:e.target.value})),children:[(0,G.jsx)(`option`,{value:`global`,children:`global`}),(0,G.jsx)(`option`,{value:`project`,children:`project`}),(0,G.jsx)(`option`,{value:`private`,children:`private`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`默认作用域`}),(0,G.jsxs)(`select`,{className:`w-full h-9 rounded-md border border-input bg-background px-3 text-sm`,value:d.default_scope,onChange:e=>f(n=>({...n,default_scope:e.target.value})),children:[(0,G.jsx)(`option`,{value:`global`,children:`global`}),(0,G.jsx)(`option`,{value:`project`,children:`project`})]})]})]}),(0,G.jsx)(S7,{}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:[[`always_merge`,`始终合并`],[`append_only`,`仅追加`],[`temporal_versioned`,`时序版本`],[`merge_supported`,`支持合并`],[`is_active`,`启用`]].map(([e,n])=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,G.jsx)(cb,{className:`text-sm`,children:n}),(0,G.jsx)(Nhe,{checked:d[e],onCheckedChange:n=>f(r=>({...r,[e]:n}))})]},e))})]}),(0,G.jsxs)(E9,{children:[(0,G.jsx)(q,{variant:`outline`,onClick:()=>u(!1),children:`取消`}),(0,G.jsx)(q,{onClick:async()=>{if(!d.name.trim()||!d.display_name.trim()){ir.error(`名称和显示名为必填项`);return}try{let e={...d,decision_rule:d.decision_rule||null,prompt_format:d.prompt_format||null,default_ttl_days:d.default_ttl_days||null};s?(await Q9.update(s.name,e),ir.success(`分类已更新`)):(await Q9.create(e),ir.success(`分类已创建`)),u(!1),w()}catch(e){let n=e instanceof Error?e.message:`操作失败`;ir.error(n)}},children:s?`保存`:`创建`})]})]})}),(0,G.jsx)(uJ,{open:!!p,onOpenChange:()=>m(null),children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除分类`}),(0,G.jsxs)(hJ,{children:[`确定要删除分类 "`,p,`" 吗?此操作不可撤销。`]})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{children:`取消`}),(0,G.jsx)(gJ,{onClick:async()=>{if(p)try{await Q9.delete(p),ir.success(`分类已删除`),m(null),w()}catch{ir.error(`删除失败`)}},children:`删除`})]})]})}),(0,G.jsx)(C9,{open:h,onOpenChange:g,children:(0,G.jsxs)(w9,{className:`max-w-sm`,children:[(0,G.jsx)(T9,{children:(0,G.jsx)(D9,{children:`添加别名`})}),(0,G.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`别名`}),(0,G.jsx)(sb,{value:_,onChange:e=>v(e.target.value),placeholder:`e.g. likes`,maxLength:50})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(cb,{children:`目标分类`}),(0,G.jsxs)(`select`,{className:`w-full h-9 rounded-md border border-input bg-background px-3 text-sm`,value:b,onChange:e=>x(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:`选择分类...`}),e.map(e=>(0,G.jsxs)(`option`,{value:e.name,children:[e.display_name,` (`,e.name,`)`]},e.name))]})]})]}),(0,G.jsxs)(E9,{children:[(0,G.jsx)(q,{variant:`outline`,onClick:()=>g(!1),children:`取消`}),(0,G.jsx)(q,{onClick:async()=>{if(!_.trim()||!b.trim()){ir.error(`别名和目标分类为必填项`);return}try{await Q9.createAlias(_,b),ir.success(`别名已创建`),g(!1),v(``),x(``),T()}catch(e){let n=e instanceof Error?e.message:`创建别名失败`;ir.error(n)}},children:`创建`})]})]})}),(0,G.jsx)(uJ,{open:!!S,onOpenChange:()=>C(null),children:(0,G.jsxs)(dJ,{children:[(0,G.jsxs)(fJ,{children:[(0,G.jsx)(mJ,{children:`确认删除别名`}),(0,G.jsxs)(hJ,{children:[`确定要删除别名 "`,S,`" 吗?`]})]}),(0,G.jsxs)(pJ,{children:[(0,G.jsx)(_J,{children:`取消`}),(0,G.jsx)(gJ,{onClick:async()=>{if(S)try{await Q9.deleteAlias(S),ir.success(`别名已删除`),C(null),T()}catch{ir.error(`删除别名失败`)}},children:`删除`})]})]})})]})}function Fhe(){let e=et();return(0,G.jsx)(`div`,{className:`flex h-screen w-full flex-col items-center justify-center bg-background text-foreground`,children:(0,G.jsxs)(`div`,{className:`text-center space-y-6`,children:[(0,G.jsx)(`div`,{className:`text-8xl font-bold text-muted-foreground/30`,children:`404`}),(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`页面不存在`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-sm`,children:`您访问的页面可能已经删除、移动,或者从未存在过。`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[(0,G.jsxs)(q,{variant:`outline`,onClick:()=>e(-1),children:[(0,G.jsx)(Vp,{className:`h-4 w-4 mr-2`}),`返回上一页`]}),(0,G.jsxs)(q,{onClick:()=>e(`/dashboard`),children:[(0,G.jsx)(gm,{className:`h-4 w-4 mr-2`}),`返回首页`]})]})]})})}var Ihe=class extends y.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error(`ErrorBoundary caught an error:`,e,n)}handleRefresh=()=>{window.location.reload()};handleGoHome=()=>{window.location.href=`/`};render(){return this.state.hasError?(0,G.jsx)(`div`,{className:`flex h-screen w-full flex-col items-center justify-center bg-background text-foreground`,children:(0,G.jsxs)(`div`,{className:`text-center space-y-6 max-w-md px-4`,children:[(0,G.jsx)(`div`,{className:`text-6xl font-bold text-destructive/30`,children:`⚠️`}),(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`出错了`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`应用遇到了意外错误。请尝试刷新页面,或返回首页。`}),this.state.error&&(0,G.jsx)(`div`,{className:`rounded-lg bg-muted p-4 text-left`,children:(0,G.jsx)(`p`,{className:`text-xs font-mono text-muted-foreground break-all`,children:this.state.error.message})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[(0,G.jsxs)(q,{variant:`outline`,onClick:this.handleRefresh,children:[(0,G.jsx)(Nm,{className:`h-4 w-4 mr-2`}),`刷新页面`]}),(0,G.jsxs)(q,{onClick:this.handleGoHome,children:[(0,G.jsx)(gm,{className:`h-4 w-4 mr-2`}),`返回首页`]})]})]})}):this.props.children}};function Lhe({children:e}){let n=dh(e=>e.isAuthenticated),r=typeof window<`u`&&window.localStorage.getItem(`e2e_bypass_auth`)===`true`;return n||r?e:(0,G.jsx)(Ot,{to:`/login`,replace:!0})}function Rhe(){return(0,G.jsx)(Ihe,{children:(0,G.jsxs)(Mt,{children:[(0,G.jsx)(At,{path:`/login`,element:(0,G.jsx)(db,{})}),(0,G.jsxs)(At,{path:`/*`,element:(0,G.jsx)(Lhe,{children:(0,G.jsx)(tte,{})}),children:[(0,G.jsx)(At,{index:!0,element:(0,G.jsx)(Ot,{to:`/dashboard`,replace:!0})}),(0,G.jsx)(At,{path:`dashboard`,element:(0,G.jsx)(lJ,{})}),(0,G.jsx)(At,{path:`memories`,element:(0,G.jsx)(FJ,{})}),(0,G.jsx)(At,{path:`memories/:id`,element:(0,G.jsx)(Cme,{})}),(0,G.jsx)(At,{path:`memories/:id/edit`,element:(0,G.jsx)(Eme,{})}),(0,G.jsx)(At,{path:`memories/:id/edit-insight`,element:(0,G.jsx)(kme,{})}),(0,G.jsx)(At,{path:`vault`,element:(0,G.jsx)(Mme,{})}),(0,G.jsx)(At,{path:`spaces`,element:(0,G.jsx)(Jme,{})}),(0,G.jsx)(At,{path:`sessions`,element:(0,G.jsx)(Pme,{})}),(0,G.jsx)(At,{path:`sessions/:id`,element:(0,G.jsx)(Wme,{})}),(0,G.jsx)(At,{path:`analytics`,element:(0,G.jsx)(Yme,{})}),(0,G.jsx)(At,{path:`tier-history`,element:(0,G.jsx)(Zme,{})}),(0,G.jsx)(At,{path:`lifecycle`,element:(0,G.jsx)(ohe,{})}),(0,G.jsx)(At,{path:`import`,element:(0,G.jsx)(ghe,{})}),(0,G.jsx)(At,{path:`profile`,element:(0,G.jsx)(Dhe,{})}),(0,G.jsx)(At,{path:`settings`,element:(0,G.jsx)(_he,{})}),(0,G.jsx)(At,{path:`categories`,element:(0,G.jsx)(Phe,{})}),(0,G.jsx)(At,{path:`*`,element:(0,G.jsx)(Fhe,{})})]})]})})}(0,x.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(y.StrictMode,{children:(0,G.jsx)(Sn,{children:(0,G.jsx)(Sr,{defaultTheme:`dark`,storageKey:`omem-theme`,children:(0,G.jsxs)(Dp,{children:[(0,G.jsx)(jp,{children:(0,G.jsx)(Rhe,{})}),(0,G.jsx)(yr,{position:`top-right`,richColors:!0,closeButton:!0})]})})})}));
|
package/web/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<script>window.__OMEM_API_URL__ = "__OMEM_API_URL__";</script>
|
|
8
8
|
<title>Cerebro - 记忆管理</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-zOJZZn-i.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-DVguCuEA.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|