@winspan/claude-forge 3.6.26 → 3.6.27

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.
Files changed (40) hide show
  1. package/dist/daemon/index.d.ts.map +1 -1
  2. package/dist/daemon/index.js +1 -0
  3. package/dist/daemon/index.js.map +1 -1
  4. package/dist/storage/repositories/dynamic-pipeline-repository.d.ts +10 -3
  5. package/dist/storage/repositories/dynamic-pipeline-repository.d.ts.map +1 -1
  6. package/dist/storage/repositories/dynamic-pipeline-repository.js +13 -11
  7. package/dist/storage/repositories/dynamic-pipeline-repository.js.map +1 -1
  8. package/dist/storage/repositories/event-repository.js +2 -2
  9. package/dist/storage/repositories/event-repository.js.map +1 -1
  10. package/dist/storage/repositories/maintenance-repository.d.ts.map +1 -1
  11. package/dist/storage/repositories/maintenance-repository.js +1 -0
  12. package/dist/storage/repositories/maintenance-repository.js.map +1 -1
  13. package/dist/web/routes/events.d.ts.map +1 -1
  14. package/dist/web/routes/events.js +4 -5
  15. package/dist/web/routes/events.js.map +1 -1
  16. package/dist/web/routes/knowledge.d.ts.map +1 -1
  17. package/dist/web/routes/knowledge.js +20 -5
  18. package/dist/web/routes/knowledge.js.map +1 -1
  19. package/dist/web/routes/pipelines.d.ts.map +1 -1
  20. package/dist/web/routes/pipelines.js +7 -5
  21. package/dist/web/routes/pipelines.js.map +1 -1
  22. package/dist/web/routes/projects.d.ts.map +1 -1
  23. package/dist/web/routes/projects.js +1 -2
  24. package/dist/web/routes/projects.js.map +1 -1
  25. package/dist/web/routes/quality.d.ts.map +1 -1
  26. package/dist/web/routes/quality.js +46 -11
  27. package/dist/web/routes/quality.js.map +1 -1
  28. package/dist/web/routes/sessions.d.ts.map +1 -1
  29. package/dist/web/routes/sessions.js +23 -12
  30. package/dist/web/routes/sessions.js.map +1 -1
  31. package/dist/web/routes/skills.d.ts.map +1 -1
  32. package/dist/web/routes/skills.js +3 -4
  33. package/dist/web/routes/skills.js.map +1 -1
  34. package/dist/web/utils/validation.d.ts +46 -3
  35. package/dist/web/utils/validation.d.ts.map +1 -1
  36. package/dist/web/utils/validation.js +73 -4
  37. package/dist/web/utils/validation.js.map +1 -1
  38. package/dist/web-static/assets/{index-DL3sxp0u.js → index-BCgOtcuH.js} +7 -3
  39. package/dist/web-static/index.html +1 -1
  40. package/package.json +1 -1
@@ -16,7 +16,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
16
16
  `);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(`
17
17
  `),r=t===-1?-1:n.indexOf(`
18
18
  `,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=`
19
- `+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=Fo(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&ls.assertOptions(n,{silentJSONParsing:us.transitional(us.boolean),forcedJSONParsing:us.transitional(us.boolean),clarifyTimeoutError:us.transitional(us.boolean),legacyInterceptorReqResOrdering:us.transitional(us.boolean)},!1),r!=null&&(B.isFunction(r)?t.paramsSerializer={serialize:r}:ls.assertOptions(r,{encode:us.function,serialize:us.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),ls.assertOptions(t,{baseUrl:us.spelling(`baseURL`),withXsrfToken:us.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&B.merge(i.common,i[t.method]);i&&B.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=vo.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||Ha;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[is.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=is.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=Fo(this.defaults,e),Ba(No(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};B.forEach([`delete`,`get`,`head`,`options`],function(e){ds.prototype[e]=function(t,n){return this.request(Fo(n||{},{method:e,url:t,data:(n||{}).data}))}}),B.forEach([`post`,`put`,`patch`],function(e){function t(t){return function(n,r,i){return this.request(Fo(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}ds.prototype[e]=t(),ds.prototype[e+`Form`]=t(!0)});var fs=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new xo(e,r,i),t(n.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 t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function ps(e){return function(t){return e.apply(null,t)}}function ms(e){return B.isObject(e)&&e.isAxiosError===!0}var hs={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(hs).forEach(([e,t])=>{hs[t]=e});function gs(e){let t=new ds(e),n=vi(ds.prototype.request,t);return B.extend(n,ds.prototype,t,{allOwnKeys:!0}),B.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return gs(Fo(e,t))},n}var _s=gs(ro);_s.Axios=ds,_s.CanceledError=xo,_s.CancelToken=fs,_s.isCancel=bo,_s.VERSION=as,_s.toFormData=Fa,_s.AxiosError=ka,_s.Cancel=_s.CanceledError,_s.all=function(e){return Promise.all(e)},_s.spread=ps,_s.isAxiosError=ms,_s.mergeConfig=Fo,_s.AxiosHeaders=vo,_s.formToJSON=e=>eo(B.isHTMLForm(e)?new FormData(e):e),_s.getAdapter=ns.getAdapter,_s.HttpStatusCode=hs,_s.default=_s;var vs=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ys=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),bs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),xs=e=>{let t=bs(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ss={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Cs=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ws=(0,L.createContext)({}),Ts=()=>(0,L.useContext)(ws),Es=(0,L.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ts()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,L.createElement)(`svg`,{ref:c,...Ss,width:t??l??Ss.width,height:t??l??Ss.height,stroke:e??f,strokeWidth:m,className:vs(`lucide`,p,i),...!a&&!Cs(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,L.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),V=(e,t)=>{let n=(0,L.forwardRef)(({className:n,...r},i)=>(0,L.createElement)(Es,{ref:i,iconNode:t,className:vs(`lucide-${ys(xs(e))}`,`lucide-${e}`,n),...r}));return n.displayName=xs(e),n},Ds=V(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Os=V(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ks=V(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),As=V(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),js=V(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),Ms=V(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ns=V(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ps=V(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Fs=V(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Is=V(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Ls=V(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Rs=V(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),zs=V(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Bs=V(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Vs=V(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Hs=V(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Us=V(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ws=V(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Gs=V(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Ks=V(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qs=V(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Js=V(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ys=V(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Xs=V(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Zs=V(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Qs=V(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),$s=V(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ec=V(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),tc=V(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),nc=V(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),rc=V(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ic=V(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ac=V(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),oc=V(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),sc=V(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),cc=V(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),lc=V(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),uc=V(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),dc=V(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),fc=V(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),pc=V(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),mc=V(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),hc=V(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),gc=V(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),_c=V(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),vc=V(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),yc=V(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),bc=V(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),xc=V(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Sc=V(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Cc=V(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),wc=V(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Tc=V(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ec=V(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Dc=V(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Oc=V(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),kc=V(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Ac=V(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),jc=V(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Mc=V(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Nc=V(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Pc=V(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Fc=V(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ic=V(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Lc=V(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Rc=V(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),zc=V(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Bc=V(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Vc=V(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Hc=V(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Uc=V(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Wc=V(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Gc=V(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Kc=V(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),qc=V(`test-tube`,[[`path`,{d:`M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2`,key:`125lnx`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}],[`path`,{d:`M14.5 16h-5`,key:`1ox875`}]]),Jc=V(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Yc=V(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Xc=V(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Zc=V(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Qc=V(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),$c=V(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),el=V(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),tl=V(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),nl=u(y(),1),rl=u(_(),1),il=(0,L.createContext)({toast:()=>{}}),al=()=>{};function H(e,t=`error`){al(e,t)}function ol({children:e}){let[t,n]=(0,L.useState)([]),r={current:0},i=(0,L.useCallback)((e,t=`error`)=>{let i=++r.current;n(n=>[...n,{id:i,type:t,message:e}]),setTimeout(()=>n(e=>e.filter(e=>e.id!==i)),4e3)},[]);(0,L.useEffect)(()=>{al=i},[i]);let a={success:Gs,error:qs,warning:Xc},o={success:`bg-green-50 border-green-200 text-green-800`,error:`bg-red-50 border-red-200 text-red-800`,warning:`bg-yellow-50 border-yellow-200 text-yellow-800`},s={success:`text-green-500`,error:`text-red-500`,warning:`text-yellow-500`};return(0,R.jsxs)(il.Provider,{value:{toast:i},children:[e,(0,rl.createPortal)((0,R.jsx)(`div`,{className:`fixed bottom-4 right-4 z-[9999] flex flex-col gap-2 max-w-sm`,children:t.map(e=>{let t=a[e.type];return(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3 rounded-lg border shadow-lg text-sm ${o[e.type]}`,children:[(0,R.jsx)(t,{className:`h-4 w-4 mt-0.5 flex-shrink-0 ${s[e.type]}`}),(0,R.jsx)(`span`,{className:`flex-1`,children:e.message}),(0,R.jsx)(`button`,{onClick:()=>n(t=>t.filter(t=>t.id!==e.id)),children:(0,R.jsx)(el,{className:`h-3.5 w-3.5 opacity-60 hover:opacity-100`})})]},e.id)})}),document.body)]})}var U=_s.create({baseURL:`/api`,timeout:3e4});U.interceptors.request.use(e=>{let t=window.__AUTH_TOKEN__;return t&&(e.headers.Authorization=`Bearer ${t}`),e}),U.interceptors.response.use(e=>e,e=>(H(e.response?.data?.error||e.response?.data?.message||e.message||`请求失败`,`error`),Promise.reject(e)));var sl=()=>U.get(`/health`),cl=()=>U.get(`/config`),ll=e=>U.put(`/config`,e),ul=()=>U.get(`/config/history`),dl=e=>U.get(`/sessions`,{params:e}),fl=e=>U.get(`/sessions/${e}`),pl=e=>U.delete(`/sessions/${e}`),ml=e=>U.delete(`/sessions`,{data:{ids:e}}),hl=e=>U.get(`/events`,{params:e}),gl=e=>U.get(`/events/stats`,{params:{project_path:e}}),_l=e=>U.get(`/pipelines`,{params:e}),vl=e=>U.get(`/pipelines/${e}`),yl=e=>U.get(`/quality/history`,{params:e}),bl=e=>U.get(`/quality/unresolved`,{params:{project_path:e}}),xl=()=>U.get(`/stats/roi`),Sl=()=>U.get(`/stats/overview`),Cl=(e,t,n,r)=>U.get(`/knowledge/search`,{params:{q:e,project_path:t,node_type:n,limit:r}}),wl=e=>U.get(`/knowledge/overview`,{params:{project_path:e}}),Tl=(e,t)=>U.get(`/knowledge/neighbors`,{params:{node_id:e,project_path:t}}),El=(e,t)=>U.get(`/knowledge/graph`,{params:{project_path:e,node_type:t}}),Dl=e=>U.post(`/knowledge/nodes`,e),Ol=(e,t)=>U.put(`/knowledge/nodes/${e}`,t),kl=e=>U.delete(`/knowledge/nodes/${e}`),Al=e=>U.delete(`/knowledge/batch`,{data:{ids:e}}),jl=e=>U.post(`/knowledge/import`,{nodes:e}),Ml=e=>U.post(`/knowledge/edges`,e),Nl=e=>U.post(`/pipelines/${e}/close`),Pl=e=>U.post(`/pipelines/${e}/reactivate`),Fl=e=>U.post(`/pipelines/batch-close`,{ids:e}),Il=()=>U.post(`/pipelines/close-expired`),Ll=()=>U.get(`/pipelines/active`),Rl=e=>U.post(`/pipelines/${e}/resume`),zl=e=>U.post(`/pipelines/${e}/advance`),Bl=e=>U.get(`/projects`,{params:e}),Vl=e=>U.get(`/projects/${e}`),Hl=e=>U.delete(`/projects/${e}`),Ul=e=>U.post(`/convention/init`,{path:e},{timeout:18e4}),Wl=e=>U.get(`/projects/${e}/conventions`),Gl=(e,t)=>U.post(`/projects/${e}/conventions/bind`,{conventionId:t}),Kl=(e,t)=>U.delete(`/projects/${e}/conventions/${encodeURIComponent(t)}`),ql=e=>U.get(`/projects/${e}/conventions/custom/yaml`),Jl=(e,t)=>U.put(`/projects/${e}/conventions/custom`,{yaml:t}),Yl=e=>U.post(`/projects/${e}/conventions/distill`,{},{timeout:12e4}),Xl=e=>U.get(`/claudemd/${e}`),Zl=(e,t)=>U.put(`/claudemd/${e}`,{content:t}),Ql=e=>U.get(`/claudemd/${e}/profile`),$l=e=>U.get(`/claudemd/${e}/modules`),eu=e=>U.post(`/claudemd/${e}/distill`,void 0,{timeout:18e4}),tu=e=>U.post(`/claudemd/${e}/init`,void 0,{timeout:18e4}),nu=e=>U.post(`/quality/${e}/resolve`),ru=e=>U.post(`/quality/${e}/dismiss`),iu=e=>U.post(`/quality/batch-dismiss`,{ids:e}),au=e=>U.post(`/quality/batch-resolve`,{ids:e}),ou=()=>U.post(`/quality/resolve-all`),su=e=>U.get(`/quality/${e}/context`),cu=()=>U.get(`/daemon/status`),lu=()=>U.post(`/daemon/restart`),uu=()=>U.get(`/daemon/diagnose`),du=()=>U.post(`/daemon/repair`),fu=e=>U.post(`/config/backup`,e||{}),pu=()=>U.get(`/config/backups`),mu=e=>`/api/config/backups/${encodeURIComponent(e)}`,hu=(e,t)=>U.post(`/config/restore`,{filename:e,password:t}),gu=e=>U.post(`/events/purge`,{retentionDays:e}),_u=()=>U.get(`/memory/caches`),vu=()=>U.get(`/memory/process`),yu=e=>U.post(`/memory/caches/${encodeURIComponent(e)}/clear`),bu=()=>U.post(`/memory/caches/clear-all`),xu=()=>U.post(`/memory/gc`),Su=e=>U.get(`/stats/api-usage`,{params:{days:e}}),Cu=e=>U.get(`/skills`,{params:e}),wu=()=>U.get(`/skills/status`),Tu=e=>U.get(`/skills/${encodeURIComponent(e)}`),Eu=(e,t)=>U.put(`/skills/${encodeURIComponent(e)}/content`,{content:t}),Du=(e,t)=>U.post(`/skills/search`,{query:e,...t},{timeout:3e4}),Ou=e=>U.post(`/skills/install`,{url:e},{timeout:6e4}),ku=e=>U.delete(`/skills/${encodeURIComponent(e)}`),Au=e=>U.post(`/skills/batch-delete`,{names:e}),ju=()=>U.post(`/skills/evolve`,{},{timeout:12e4}),Mu=()=>U.post(`/skills/distill`,{},{timeout:12e4}),Nu=()=>U.post(`/skills/repair`,{},{timeout:6e4}),Pu=()=>U.get(`/skills/orchestration`),Fu=(e,t)=>U.put(`/skills/orchestration`,{skill:e,keywords:t}),Iu=e=>U.delete(`/skills/orchestration/${encodeURIComponent(e)}`),Lu=()=>U.get(`/conventions`),Ru=e=>U.get(`/conventions/${encodeURIComponent(e)}`),zu=()=>U.post(`/conventions/sync-official`),Bu=e=>U.post(`/conventions/install`,{url:e},{timeout:3e4}),Vu=e=>U.delete(`/conventions/${encodeURIComponent(e)}`),Hu=()=>U.get(`/conventions/usage-stats`),Uu=e=>U.get(`/conventions/${encodeURIComponent(e)}/evolution-history`),Wu=e=>U.post(`/conventions/batch-evolve`,{conventionIds:e},{timeout:12e4}),Gu=e=>U.get(`/conventions/${encodeURIComponent(e)}/yaml`),Ku=(e,t)=>U.put(`/conventions/${encodeURIComponent(e)}/yaml`,{yaml:t}),qu=e=>U.get(`/node-types`,{params:e?{projectPath:e}:void 0}),Ju=e=>U.get(`/node-types/${encodeURIComponent(e)}`),Yu=e=>U.post(`/node-types`,e),Xu=(e,t)=>U.put(`/node-types/${encodeURIComponent(e)}`,t),Zu=e=>U.delete(`/node-types/${encodeURIComponent(e)}`);function Qu(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Qu(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function $u(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Qu(e))&&(r&&(r+=` `),r+=t);return r}var ed=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},td=(e,t)=>({classGroupId:e,validator:t}),nd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rd=`-`,id=[],ad=`arbitrary..`,od=e=>{let t=ld(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return cd(e);let n=e.split(rd);return sd(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ed(i,t):t:i||id}return n[e]||id}}},sd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=sd(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(rd):e.slice(t).join(rd),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},cd=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ad+r:void 0})(),ld=e=>{let{theme:t,classGroups:n}=e;return ud(n,t)},ud=(e,t)=>{let n=nd();for(let r in e){let i=e[r];dd(i,n,r,t)}return n},dd=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];fd(i,t,n,r)}},fd=(e,t,n,r)=>{if(typeof e==`string`){pd(e,t,n);return}if(typeof e==`function`){md(e,t,n,r);return}hd(e,t,n,r)},pd=(e,t,n)=>{let r=e===``?t:gd(t,e);r.classGroupId=n},md=(e,t,n,r)=>{if(_d(e)){dd(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(td(n,e))},hd=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];dd(o,gd(t,a),n,r)}},gd=(e,t)=>{let n=e,r=t.split(rd),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=nd(),n.nextPart.set(t,i)),n=i}return n},_d=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,vd=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},yd=`!`,bd=`:`,xd=[],Sd=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Cd=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===bd){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(yd)?(c=s.slice(0,-1),l=!0):s.startsWith(yd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Sd(t,l,c,u)};if(t){let e=t+bd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Sd(xd,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},wd=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Td=e=>({cache:vd(e.cacheSize),parseClassName:Cd(e),sortModifiers:wd(e),...od(e)}),Ed=/\s+/,Dd=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Ed),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+yd:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Od=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=kd(n))&&(i&&(i+=` `),i+=r);return i},kd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=kd(e[r]))&&(n&&(n+=` `),n+=t);return n},Ad=(e,...t)=>{let n,r,i,a,o=o=>(n=Td(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Dd(e,n);return i(e,a),a};return a=o,(...e)=>a(Od(...e))},jd=[],Md=e=>{let t=t=>t[e]||jd;return t.isThemeGetter=!0,t},Nd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Id=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ld=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Rd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vd=e=>Fd.test(e),W=e=>!!e&&!Number.isNaN(Number(e)),Hd=e=>!!e&&Number.isInteger(Number(e)),Ud=e=>e.endsWith(`%`)&&W(e.slice(0,-1)),Wd=e=>Id.test(e),Gd=()=>!0,Kd=e=>Ld.test(e)&&!Rd.test(e),qd=()=>!1,Jd=e=>zd.test(e),Yd=e=>Bd.test(e),Xd=e=>!G(e)&&!K(e),Zd=e=>pf(e,_f,qd),G=e=>Nd.test(e),Qd=e=>pf(e,vf,Kd),$d=e=>pf(e,yf,W),ef=e=>pf(e,xf,Gd),tf=e=>pf(e,bf,qd),nf=e=>pf(e,hf,qd),rf=e=>pf(e,gf,Yd),af=e=>pf(e,Sf,Jd),K=e=>Pd.test(e),of=e=>mf(e,vf),sf=e=>mf(e,bf),cf=e=>mf(e,hf),lf=e=>mf(e,_f),uf=e=>mf(e,gf),df=e=>mf(e,Sf,!0),ff=e=>mf(e,xf,!0),pf=(e,t,n)=>{let r=Nd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},mf=(e,t,n=!1)=>{let r=Pd.exec(e);return r?r[1]?t(r[1]):n:!1},hf=e=>e===`position`||e===`percentage`,gf=e=>e===`image`||e===`url`,_f=e=>e===`length`||e===`size`||e===`bg-size`,vf=e=>e===`length`,yf=e=>e===`number`,bf=e=>e===`family-name`,xf=e=>e===`number`||e===`weight`,Sf=e=>e===`shadow`,Cf=Ad(()=>{let e=Md(`color`),t=Md(`font`),n=Md(`text`),r=Md(`font-weight`),i=Md(`tracking`),a=Md(`leading`),o=Md(`breakpoint`),s=Md(`container`),c=Md(`spacing`),l=Md(`radius`),u=Md(`shadow`),d=Md(`inset-shadow`),f=Md(`text-shadow`),p=Md(`drop-shadow`),m=Md(`blur`),h=Md(`perspective`),g=Md(`aspect`),_=Md(`ease`),v=Md(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),K,G],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[K,G,c],T=()=>[Vd,`full`,`auto`,...w()],E=()=>[Hd,`none`,`subgrid`,K,G],D=()=>[`auto`,{span:[`full`,Hd,K,G]},Hd,K,G],O=()=>[Hd,`auto`,K,G],k=()=>[`auto`,`min`,`max`,`fr`,K,G],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Vd,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[Vd,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],te=()=>[Vd,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,K,G],ne=()=>[...b(),cf,nf,{position:[K,G]}],re=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,lf,Zd,{size:[K,G]}],ae=()=>[Ud,of,Qd],F=()=>[``,`none`,`full`,l,K,G],I=()=>[``,W,of,Qd],oe=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[W,Ud,cf,nf],le=()=>[``,`none`,m,K,G],ue=()=>[`none`,W,K,G],de=()=>[`none`,W,K,G],fe=()=>[W,K,G],pe=()=>[Vd,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Wd],breakpoint:[Wd],color:[Gd],container:[Wd],"drop-shadow":[Wd],ease:[`in`,`out`,`in-out`],font:[Xd],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Wd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Wd],shadow:[Wd],spacing:[`px`,W],text:[Wd],"text-shadow":[Wd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Vd,G,K,g]}],container:[`container`],columns:[{columns:[W,G,K,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Hd,`auto`,K,G]}],basis:[{basis:[Vd,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[W,Vd,`auto`,`initial`,`none`,G]}],grow:[{grow:[``,W,K,G]}],shrink:[{shrink:[``,W,K,G]}],order:[{order:[Hd,`first`,`last`,`none`,K,G]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...ee()]}],"min-inline-size":[{"min-inline":[`auto`,...ee()]}],"max-inline-size":[{"max-inline":[`none`,...ee()]}],"block-size":[{block:[`auto`,...te()]}],"min-block-size":[{"min-block":[`auto`,...te()]}],"max-block-size":[{"max-block":[`none`,...te()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,of,Qd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ff,ef]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Ud,G]}],"font-family":[{font:[sf,tf,t]}],"font-features":[{"font-features":[G]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,K,G]}],"line-clamp":[{"line-clamp":[W,`none`,K,$d]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,K,G]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,K,G]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[W,`from-font`,`auto`,K,Qd]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[W,`auto`,K,G]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,K,G]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,K,G]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:re()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Hd,K,G],radial:[``,K,G],conic:[Hd,K,G]},uf,rf]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":I()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[W,K,G]}],"outline-w":[{outline:[``,W,of,Qd]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,df,af]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,df,af]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:I()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[W,Qd]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,df,af]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[W,K,G]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[W]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[K,G]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[W]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:re()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,K,G]}],filter:[{filter:[``,`none`,K,G]}],blur:[{blur:le()}],brightness:[{brightness:[W,K,G]}],contrast:[{contrast:[W,K,G]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,df,af]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,W,K,G]}],"hue-rotate":[{"hue-rotate":[W,K,G]}],invert:[{invert:[``,W,K,G]}],saturate:[{saturate:[W,K,G]}],sepia:[{sepia:[``,W,K,G]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,K,G]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[W,K,G]}],"backdrop-contrast":[{"backdrop-contrast":[W,K,G]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,W,K,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[W,K,G]}],"backdrop-invert":[{"backdrop-invert":[``,W,K,G]}],"backdrop-opacity":[{"backdrop-opacity":[W,K,G]}],"backdrop-saturate":[{"backdrop-saturate":[W,K,G]}],"backdrop-sepia":[{"backdrop-sepia":[``,W,K,G]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,K,G]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[W,`initial`,K,G]}],ease:[{ease:[`linear`,`initial`,_,K,G]}],delay:[{delay:[W,K,G]}],animate:[{animate:[`none`,v,K,G]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,K,G]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[K,G,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,K,G]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,K,G]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[W,of,Qd,$d]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function q(...e){return Cf($u(e))}function wf(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60),i=Math.floor(r/24);return i>0?`${i}天${r%24}小时`:r>0?`${r}小时${n%60}分钟`:n>0?`${n}分钟${t%60}秒`:`${t}秒`}function Tf(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Ef(e){let t={active:`text-green-600 bg-green-50`,completed:`text-blue-600 bg-blue-50`,failed:`text-red-600 bg-red-50`,interrupted:`text-yellow-600 bg-yellow-50`,pending:`text-gray-600 bg-gray-50`};return t[e]||t.pending}function Df(e){return e?e.endsWith(`Z`)||/[+-]\d{2}:\d{2}$/.test(e)?new Date(e):new Date(e+`Z`):new Date}var Of=[{path:`/dashboard`,label:`仪表盘`,icon:vc},{path:`/projects`,label:`项目管理`,icon:dc},{path:`/sessions`,label:`会话管理`,icon:Ds},{path:`/events`,label:`事件流`,icon:Is},{path:`/pipelines`,label:`流水线`,icon:pc},{path:`/quality`,label:`质量门禁`,icon:zc},{path:`/knowledge`,label:`知识图谱`,icon:Fs},{path:`/skills`,label:`技能管理`,icon:Dc},{path:`/conventions`,label:`规范管理`,icon:Ms},{path:`/node-types`,label:`节点类型`,icon:Ps},{path:`/analytics`,label:`数据分析`,icon:Ls},{path:`/config`,label:`系统配置`,icon:Rc}];function kf({children:e}){let[t,n]=(0,L.useState)(()=>localStorage.getItem(`sidebar-collapsed`)===`true`),r=Mn();(0,L.useEffect)(()=>{localStorage.setItem(`sidebar-collapsed`,String(t))},[t]);let{data:i}=ut({queryKey:[`health`],queryFn:()=>sl().then(e=>e.data),refetchInterval:15e3}),a=Of.find(e=>r.pathname.startsWith(e.path));return(0,R.jsxs)(`div`,{className:`flex min-h-screen bg-gray-50`,children:[(0,R.jsxs)(`aside`,{className:q(`fixed top-0 left-0 bottom-0 z-50 flex flex-col transition-all duration-300`,`bg-gradient-to-b from-slate-900 to-slate-800`,t?`w-16`:`w-60`),children:[(0,R.jsxs)(`div`,{className:q(`flex items-center border-b border-white/10 h-16`,t?`justify-center px-2`:`justify-between px-5`),children:[!t&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-gradient-to-br from-blue-500 to-purple-600`,children:(0,R.jsx)(tl,{className:`h-5 w-5 text-white`})}),(0,R.jsx)(`span`,{className:`text-white font-bold text-lg tracking-tight`,children:`Forge`})]}),(0,R.jsx)(`button`,{onClick:()=>n(!t),className:`p-1.5 rounded-lg text-white/60 hover:text-white hover:bg-white/10 transition-colors`,children:t?(0,R.jsx)(wc,{className:`h-5 w-5`}):(0,R.jsx)(Vs,{className:`h-5 w-5`})})]}),(0,R.jsx)(`nav`,{className:`flex-1 py-4 space-y-1 px-2`,children:Of.map(e=>(0,R.jsxs)(ti,{to:e.path,className:({isActive:e})=>q(`flex items-center gap-3 rounded-lg transition-all duration-200`,t?`justify-center p-3`:`px-3 py-2.5`,e?`bg-blue-600/20 text-blue-400`:`text-white/60 hover:text-white hover:bg-white/5`),children:[(0,R.jsx)(e.icon,{className:`h-5 w-5 flex-shrink-0`}),!t&&(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:e.label})]},e.path))}),(0,R.jsx)(`div`,{className:q(`border-t border-white/10 py-4`,t?`px-2`:`px-5`),children:(0,R.jsxs)(`div`,{className:q(`flex items-center gap-2`,t?`justify-center`:``),children:[(0,R.jsx)(`div`,{className:q(`w-2 h-2 rounded-full`,i?.status===`ok`?`bg-green-400 animate-pulse`:`bg-red-400`)}),!t&&(0,R.jsx)(`span`,{className:`text-xs text-white/40`,children:i?.status===`ok`?`Daemon 运行中`:`连接断开`})]})})]}),(0,R.jsxs)(`main`,{className:q(`flex-1 transition-all duration-300`,t?`ml-16`:`ml-60`),children:[(0,R.jsxs)(`header`,{className:`sticky top-0 z-40 bg-white/80 backdrop-blur-md border-b border-gray-200/50 h-16 flex items-center justify-between px-8`,children:[(0,R.jsx)(`h1`,{className:`text-xl font-semibold text-gray-900`,children:a?.label||`Claude Forge`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsxs)(`button`,{className:`hidden sm:flex items-center gap-2 px-3 py-1.5 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors`,onClick:()=>{let e=new KeyboardEvent(`keydown`,{key:`k`,metaKey:!0});window.dispatchEvent(e)},children:[(0,R.jsx)(Zs,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:`命令面板`}),(0,R.jsx)(`kbd`,{className:`px-2 py-0.5 text-xs bg-gray-100 rounded border border-gray-200`,children:`⌘K`})]}),(0,R.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[`v`,`3.6.26`]}),(0,R.jsxs)(`div`,{className:q(`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold`,i?.status===`ok`?`bg-green-50 text-green-700 border border-green-200`:`bg-red-50 text-red-700 border border-red-200`),children:[(0,R.jsx)(`div`,{className:q(`w-1.5 h-1.5 rounded-full`,i?.status===`ok`?`bg-green-500`:`bg-red-500`)}),i?.status===`ok`?`在线`:`离线`]})]})]}),(0,R.jsx)(`div`,{className:`p-8 overflow-x-hidden`,children:e})]})]})}var Af=(0,L.createContext)({});function jf(e){let t=(0,L.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Mf=typeof window<`u`?L.useLayoutEffect:L.useEffect,Nf=(0,L.createContext)(null);function Pf(e,t){e.indexOf(t)===-1&&e.push(t)}function Ff(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var If=(e,t,n)=>n>t?t:n<e?e:n,Lf={},Rf=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function zf(e){return typeof e==`object`&&!!e}var Bf=e=>/^0[^.\s]+$/u.test(e);function Vf(e){let t;return()=>(t===void 0&&(t=e()),t)}var Hf=e=>e,Uf=(e,t)=>n=>t(e(n)),Wf=(...e)=>e.reduce(Uf),Gf=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Kf=class{constructor(){this.subscriptions=[]}add(e){return Pf(this.subscriptions,e),()=>Ff(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},qf=e=>e*1e3,Jf=e=>e/1e3;function Yf(e,t){return t?1e3/t*e:0}var Xf=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Zf=1e-7,Qf=12;function $f(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Xf(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Zf&&++s<Qf);return o}function ep(e,t,n,r){if(e===t&&n===r)return Hf;let i=t=>$f(t,0,1,e,n);return e=>e===0||e===1?e:Xf(i(e),t,r)}var tp=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,np=e=>t=>1-e(1-t),rp=ep(.33,1.53,.69,.99),ip=np(rp),ap=tp(ip),op=e=>e>=1?1:(e*=2)<1?.5*ip(e):.5*(2-2**(-10*(e-1))),sp=e=>1-Math.sin(Math.acos(e)),cp=np(sp),lp=tp(sp),up=ep(.42,0,1,1),dp=ep(0,0,.58,1),fp=ep(.42,0,.58,1),pp=e=>Array.isArray(e)&&typeof e[0]!=`number`,mp=e=>Array.isArray(e)&&typeof e[0]==`number`,hp={linear:Hf,easeIn:up,easeInOut:fp,easeOut:dp,circIn:sp,circInOut:lp,circOut:cp,backIn:ip,backInOut:ap,backOut:rp,anticipate:op},gp=e=>typeof e==`string`,_p=e=>{if(mp(e)){e.length;let[t,n,r,i]=e;return ep(t,n,r,i)}else if(gp(e))return hp[e],`${e}`,hp[e];return e},vp=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],yp={value:null,addProjectionMetrics:null};function bp(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&yp.value&&yp.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var xp=40;function Sp(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=vp.reduce((e,n)=>(e[n]=bp(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Lf.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,xp),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:vp.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<vp.length;t++)o[vp[t]].cancel(e)},state:i,steps:o}}var{schedule:Cp,cancel:wp,state:Tp,steps:Ep}=Sp(typeof requestAnimationFrame<`u`?requestAnimationFrame:Hf,!0),Dp;function Op(){Dp=void 0}var kp={now:()=>(Dp===void 0&&kp.set(Tp.isProcessing||Lf.useManualTiming?Tp.timestamp:performance.now()),Dp),set:e=>{Dp=e,queueMicrotask(Op)}},Ap={layout:0,mainThread:0,waapi:0},jp=e=>t=>typeof t==`string`&&t.startsWith(e),Mp=jp(`--`),Np=jp(`var(--`),Pp=e=>Np(e)?Fp.test(e.split(`/*`)[0].trim()):!1,Fp=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ip(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Lp={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Rp={...Lp,transform:e=>If(0,1,e)},zp={...Lp,default:1},Bp=e=>Math.round(e*1e5)/1e5,Vp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Hp(e){return e==null}var Up=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Wp=(e,t)=>n=>!!(typeof n==`string`&&Up.test(n)&&n.startsWith(e)||t&&!Hp(n)&&Object.prototype.hasOwnProperty.call(n,t)),Gp=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Vp);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},eee=e=>If(0,255,e),Kp={...Lp,transform:e=>Math.round(eee(e))},qp={test:Wp(`rgb`,`red`),parse:Gp(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Kp.transform(e)+`, `+Kp.transform(t)+`, `+Kp.transform(n)+`, `+Bp(Rp.transform(r))+`)`};function Jp(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Yp={test:Wp(`#`),parse:Jp,transform:qp.transform},Xp=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Zp=Xp(`deg`),Qp=Xp(`%`),J=Xp(`px`),tee=Xp(`vh`),$p=Xp(`vw`),em={...Qp,parse:e=>Qp.parse(e)/100,transform:e=>Qp.transform(e*100)},tm={test:Wp(`hsl`,`hue`),parse:Gp(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Qp.transform(Bp(t))+`, `+Qp.transform(Bp(n))+`, `+Bp(Rp.transform(r))+`)`},nm={test:e=>qp.test(e)||Yp.test(e)||tm.test(e),parse:e=>qp.test(e)?qp.parse(e):tm.test(e)?tm.parse(e):Yp.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?qp.transform(e):tm.transform(e),getAnimatableNone:e=>{let t=nm.parse(e);return t.alpha=0,nm.transform(t)}},rm=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function im(e){return isNaN(e)&&typeof e==`string`&&(e.match(Vp)?.length||0)+(e.match(rm)?.length||0)>0}var am=`number`,om=`color`,sm=`var`,cm=`var(`,lm="${}",um=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function dm(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(um,e=>(nm.test(e)?(r.color.push(a),i.push(om),n.push(nm.parse(e))):e.startsWith(cm)?(r.var.push(a),i.push(sm),n.push(e)):(r.number.push(a),i.push(am),n.push(parseFloat(e))),++a,lm)).split(lm),indexes:r,types:i}}function fm(e){return dm(e).values}function pm({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===am?i+=Bp(r[a]):e===om?i+=nm.transform(r[a]):i+=r[a]}return i}}function mm(e){return pm(dm(e))}var hm=e=>typeof e==`number`?0:nm.test(e)?nm.getAnimatableNone(e):e,nee=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:hm(e);function ree(e){let t=dm(e);return pm(t)(t.values.map((e,n)=>nee(e,t.split[n])))}var gm={test:im,parse:fm,createTransformer:mm,getAnimatableNone:ree};function _m(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function iee({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=_m(s,r,e+1/3),a=_m(s,r,e),o=_m(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function vm(e,t){return n=>n>0?t:e}var ym=(e,t,n)=>e+(t-e)*n,bm=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},xm=[Yp,qp,tm],Sm=e=>xm.find(t=>t.test(e));function Cm(e){let t=Sm(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===tm&&(n=iee(n)),n}var wm=(e,t)=>{let n=Cm(e),r=Cm(t);if(!n||!r)return vm(e,t);let i={...n};return e=>(i.red=bm(n.red,r.red,e),i.green=bm(n.green,r.green,e),i.blue=bm(n.blue,r.blue,e),i.alpha=ym(n.alpha,r.alpha,e),qp.transform(i))},Tm=new Set([`none`,`hidden`]);function Em(e,t){return Tm.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Dm(e,t){return n=>ym(e,t,n)}function Om(e){return typeof e==`number`?Dm:typeof e==`string`?Pp(e)?vm:nm.test(e)?wm:Mm:Array.isArray(e)?km:typeof e==`object`?nm.test(e)?wm:Am:vm}function km(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Om(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Am(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Om(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function jm(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Mm=(e,t)=>{let n=gm.createTransformer(t),r=dm(e),i=dm(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Tm.has(e)&&!i.values.length||Tm.has(t)&&!r.values.length?Em(e,t):Wf(km(jm(r,i),i.values),n):(`${e}${t}`,vm(e,t))};function Nm(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?ym(e,t,n):Om(e)(e,t)}var Pm=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Cp.update(t,e),stop:()=>wp(t),now:()=>Tp.isProcessing?Tp.timestamp:kp.now()}},Fm=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Im=2e4;function Lm(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function aee(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Lm(r),Im);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Jf(i)}}var Rm={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function zm(e,t){return e*Math.sqrt(1-t*t)}var oee=12;function see(e,t,n){let r=n;for(let n=1;n<oee;n++)r-=e(r)/t(r);return r}var Bm=.001;function Vm({duration:e=Rm.duration,bounce:t=Rm.bounce,velocity:n=Rm.velocity,mass:r=Rm.mass}){let i,a;Rm.maxDuration;let o=1-t;o=If(Rm.minDamping,Rm.maxDamping,o),e=If(Rm.minDuration,Rm.maxDuration,Jf(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=zm(t,o),c=Math.exp(-i);return Bm-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=zm(t**2,o);return(-i(t)+Bm>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Bm+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=see(i,a,s);if(e=qf(e),isNaN(c))return{stiffness:Rm.stiffness,damping:Rm.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Hm=[`duration`,`bounce`],Um=[`stiffness`,`damping`,`mass`];function Wm(e,t){return t.some(t=>e[t]!==void 0)}function Gm(e){let t={velocity:Rm.velocity,stiffness:Rm.stiffness,damping:Rm.damping,mass:Rm.mass,isResolvedFromDuration:!1,...e};if(!Wm(e,Um)&&Wm(e,Hm))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*If(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Rm.mass,stiffness:i,damping:a}}else{let n=Vm({...e,velocity:0});t={...t,...n,mass:Rm.mass},t.isResolvedFromDuration=!0}return t}function Km(e=Rm.visualDuration,t=Rm.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Gm({...n,velocity:-Jf(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Jf(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Rm.restSpeed.granular:Rm.restSpeed.default,i||=v?Rm.restDelta.granular:Rm.restDelta.default;let y,b,x,S,C,w;if(h<1)x=zm(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>qf(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=qf(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=qf(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Lm(T),Im),t=Fm(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Km.applyToOptions=e=>{let t=aee(e,100,Km);return e.ease=t.ease,e.duration=qf(t.duration),e.type=`keyframes`,e};var qm=5;function Jm(e,t,n){let r=Math.max(t-qm,0);return Yf(n-e(r),t-r)}function Ym({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Km({keyframes:[f.value,m(f.value)],velocity:Jm(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Xm(e,t,n){let r=[],i=n||Lf.mix||Nm,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Wf(Array.isArray(t)?t[n]||Hf:t,a)),r.push(a)}return r}function Zm(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Xm(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Gf(e[r],e[r+1],n);return s[r](i)};return n?t=>l(If(e[0],e[a-1],t)):l}function Qm(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Gf(0,t,r);e.push(ym(n,1,i))}}function $m(e){let t=[0];return Qm(t,e.length-1),t}function eh(e,t){return e.map(e=>e*t)}function th(e,t){return e.map(()=>t||fp).splice(0,e.length-1)}function nh({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=pp(r)?r.map(_p):_p(r),a={done:!1,value:t[0]},o=Zm(eh(n&&n.length===t.length?n:$m(t),e),t,{ease:Array.isArray(i)?i:th(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var rh=e=>e!==null;function ih(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(rh),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ah={decay:Ym,inertia:Ym,tween:nh,keyframes:nh,spring:Km};function oh(e){typeof e.type==`string`&&(e.type=ah[e.type])}var sh=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},ch=e=>e/100,lh=class extends sh{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==kp.now()&&this.tick(kp.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Ap.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;oh(e);let{type:t=nh,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||nh;s!==nh&&typeof o[0]!=`number`&&(this.mixKeyframes=Wf(ch,Nm(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Lm(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=If(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Ym&&(b.value=ih(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Jf(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Jf(e)}get time(){return Jf(this.currentTime)}set time(e){e=qf(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Jm(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(kp.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Jf(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Pm,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(kp.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Ap.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function uh(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var dh=e=>e*180/Math.PI,fh=e=>mh(dh(Math.atan2(e[1],e[0]))),ph={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:fh,rotateZ:fh,skewX:e=>dh(Math.atan(e[1])),skewY:e=>dh(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},mh=e=>(e%=360,e<0&&(e+=360),e),hh=fh,gh=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),_h=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),vh={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:gh,scaleY:_h,scale:e=>(gh(e)+_h(e))/2,rotateX:e=>mh(dh(Math.atan2(e[6],e[5]))),rotateY:e=>mh(dh(Math.atan2(-e[2],e[0]))),rotateZ:hh,rotate:hh,skewX:e=>dh(Math.atan(e[4])),skewY:e=>dh(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function yh(e){return+!!e.includes(`scale`)}function bh(e,t){if(!e||e===`none`)return yh(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=vh,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=ph,i=t}if(!i)return yh(t);let a=r[t],o=i[1].split(`,`).map(Sh);return typeof a==`function`?a(o):o[a]}var xh=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return bh(n,t)};function Sh(e){return parseFloat(e.trim())}var Ch=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],wh=new Set(Ch),Th=e=>e===Lp||e===J,Eh=new Set([`x`,`y`,`z`]),Dh=Ch.filter(e=>!Eh.has(e));function Oh(e){let t=[];return Dh.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var kh={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>bh(t,`x`),y:(e,{transform:t})=>bh(t,`y`)};kh.translateX=kh.x,kh.translateY=kh.y;var Ah=new Set,jh=!1,Mh=!1,Nh=!1;function Ph(){if(Mh){let e=Array.from(Ah).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Oh(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Mh=!1,jh=!1,Ah.forEach(e=>e.complete(Nh)),Ah.clear()}function Fh(){Ah.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Mh=!0)})}function Ih(){Nh=!0,Fh(),Ph(),Nh=!1}var Lh=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Ah.add(this),jh||(jh=!0,Cp.read(Fh),Cp.resolveKeyframes(Ph))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}uh(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Ah.delete(this)}cancel(){this.state===`scheduled`&&(Ah.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Rh=e=>e.startsWith(`--`);function zh(e,t,n){Rh(t)?e.style.setProperty(t,n):e.style[t]=n}var Bh={};function Vh(e,t){let n=Vf(e);return()=>Bh[t]??n()}var Hh=Vh(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Uh=Vh(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Wh=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Gh={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Wh([0,.65,.55,1]),circOut:Wh([.55,0,1,.45]),backIn:Wh([.31,.01,.66,-.59]),backOut:Wh([.33,1.53,.69,.99])};function Kh(e,t){if(e)return typeof e==`function`?Uh()?Fm(e,t):`ease-out`:mp(e)?Wh(e):Array.isArray(e)?e.map(e=>Kh(e,t)||Gh.easeOut):Gh[e]}function qh(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Kh(s,i);Array.isArray(d)&&(u.easing=d),yp.value&&Ap.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return yp.value&&p.finished.finally(()=>{Ap.waapi--}),p}function Jh(e){return typeof e==`function`&&`applyToOptions`in e}function Yh({type:e,...t}){return Jh(e)&&Uh()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Xh=class extends sh{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Yh(e);this.animation=qh(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=ih(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),zh(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Jf(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Jf(e)}get time(){return Jf(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=qf(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Hh()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Hf):r(this)}},Zh={anticipate:op,backInOut:ap,circInOut:lp};function Qh(e){return e in Zh}function $h(e){typeof e.ease==`string`&&Qh(e.ease)&&(e.ease=Zh[e.ease])}var eg=10,tg=class extends Xh{constructor(e){$h(e),oh(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new lh({...a,autoplay:!1}),s=Math.max(eg,kp.now()-this.startTime),c=If(0,eg,s-eg),l=o.sample(s).value,{name:u}=this.options;i&&u&&zh(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},ng=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(gm.test(e)||e===`0`)&&!e.startsWith(`url(`));function cee(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function lee(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=ng(i,t),s=ng(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:cee(e)||(n===`spring`||Jh(n))&&r}function rg(e){e.duration=0,e.type=`keyframes`}var ig=new Set([`opacity`,`clipPath`,`filter`,`transform`]),uee=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function dee(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&uee.test(e[t]))return!0;return!1}var fee=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),pee=Vf(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function mee(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return pee()&&n&&(ig.has(n)||fee.has(n)&&dee(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var hee=40,gee=class extends sh{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=kp.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Lh)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=kp.now();let u=!0;lee(e,i,a,o)||(u=!1,(Lf.instantAnimations||!s)&&l?.(ih(e,n,t)),e[0]=e[e.length-1],rg(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>hee?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&mee(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new tg({...d,element:p})}catch{m=new lh(d)}else m=new lh(d);m.finished.then(()=>{this.notifyFinished()}).catch(Hf),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Ih()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function ag(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var _ee=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vee(e){let t=_ee.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function og(e,t,n=1){`${e}`;let[r,i]=vee(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Rf(e)?parseFloat(e):e}return Pp(i)?og(i,t,n+1):i}var yee={type:`spring`,stiffness:500,damping:25,restSpeed:10},bee=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),xee={type:`keyframes`,duration:.8},See={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Cee=(e,{keyframes:t})=>t.length>2?xee:wh.has(e)?e.startsWith(`scale`)?bee(t[1]):yee:See;function sg(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function cg(e,t){let n=e?.[t]??e?.default??e;return n===e?n:sg(n,e)}var wee=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Tee(e){for(let t in e)if(!wee.has(t))return!0;return!1}var lg=(e,t,n,r={},i,a)=>o=>{let s=cg(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=qf(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Tee(s)||Object.assign(u,Cee(e,u)),u.duration&&=qf(u.duration),u.repeatDelay&&=qf(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(rg(u),u.delay===0&&(d=!0)),(Lf.instantAnimations||Lf.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,rg(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=ih(u.keyframes,s);if(e!==void 0){Cp.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new lh(u):new gee(u)};function ug(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function dg(e,t,n,r){if(typeof t==`function`){let[i,a]=ug(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=ug(r);t=t(n===void 0?e.custom:n,i,a)}return t}function fg(e,t,n){let r=e.getProps();return dg(r,t,n===void 0?r.custom:n,e)}var pg=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Ch]),mg=30,hg=e=>!isNaN(parseFloat(e)),gg={current:void 0},_g=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=kp.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=kp.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=hg(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Kf);let n=this.events[e].add(t);return e===`change`?()=>{n(),Cp.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return gg.current&&gg.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=kp.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>mg)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,mg);return Yf(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function vg(e,t){return new _g(e,t)}var yg=e=>Array.isArray(e);function bg(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,vg(n))}function xg(e){return yg(e)?e[e.length-1]||0:e}function Eee(e,t){let{transitionEnd:n={},transition:r={},...i}=fg(e,t)||{};i={...i,...n};for(let t in i)bg(e,t,xg(i[t]))}var Sg=e=>!!(e&&e.getVelocity);function Dee(e){return!!(Sg(e)&&e.add)}function Cg(e,t){let n=e.getValue(`willChange`);if(Dee(n))return n.add(t);if(!n&&Lf.WillChange){let n=new Lf.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function wg(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Tg=`data-`+wg(`framerAppearId`);function Eg(e){return e.props[Tg]}function Dg({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Og(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?sg(a,c):c;let l=a?.reduceMotion;r&&(a=r);let u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||d&&Dg(d,t))continue;let o={delay:n,...cg(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){Cp.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=Eg(e);if(n){let e=window.MotionHandoffAnimation(n,t,Cp);e!==null&&(o.startTime=e,f=!0)}}Cg(e,t);let p=l??e.shouldReduceMotion;r.start(lg(t,r,i,p&&pg.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>Cp.update(()=>{o&&Eee(e,o)});u.length?Promise.all(u).then(t):t()}return u}function kg(e,t,n={}){let r=fg(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Og(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Oee(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function Oee(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(kg(c,t,{...o,delay:n+(typeof r==`function`?0:r)+ag(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function kee(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>kg(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=kg(e,t,n);else{let i=typeof t==`function`?fg(e,t,n.custom):t;r=Promise.all(Og(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Aee={test:e=>e===`auto`,parse:e=>e},Ag=e=>t=>t.test(e),jg=[Lp,J,Qp,Zp,$p,tee,Aee],Mg=e=>jg.find(Ag(e));function Ng(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Bf(e)}var Pg=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Fg(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Vp)||[];if(!r)return e;let i=n.replace(r,``),a=+!!Pg.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Ig=/\b([a-z-]*)\(.*?\)/gu,Lg={...gm,getAnimatableNone:e=>{let t=e.match(Ig);return t?t.map(Fg).join(` `):e}},Rg={...gm,getAnimatableNone:e=>{let t=gm.parse(e);return gm.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},zg={...Lp,transform:Math.round},Bg={borderWidth:J,borderTopWidth:J,borderRightWidth:J,borderBottomWidth:J,borderLeftWidth:J,borderRadius:J,borderTopLeftRadius:J,borderTopRightRadius:J,borderBottomRightRadius:J,borderBottomLeftRadius:J,width:J,maxWidth:J,height:J,maxHeight:J,top:J,right:J,bottom:J,left:J,inset:J,insetBlock:J,insetBlockStart:J,insetBlockEnd:J,insetInline:J,insetInlineStart:J,insetInlineEnd:J,padding:J,paddingTop:J,paddingRight:J,paddingBottom:J,paddingLeft:J,paddingBlock:J,paddingBlockStart:J,paddingBlockEnd:J,paddingInline:J,paddingInlineStart:J,paddingInlineEnd:J,margin:J,marginTop:J,marginRight:J,marginBottom:J,marginLeft:J,marginBlock:J,marginBlockStart:J,marginBlockEnd:J,marginInline:J,marginInlineStart:J,marginInlineEnd:J,fontSize:J,backgroundPositionX:J,backgroundPositionY:J,rotate:Zp,rotateX:Zp,rotateY:Zp,rotateZ:Zp,scale:zp,scaleX:zp,scaleY:zp,scaleZ:zp,skew:Zp,skewX:Zp,skewY:Zp,distance:J,translateX:J,translateY:J,translateZ:J,x:J,y:J,z:J,perspective:J,transformPerspective:J,opacity:Rp,originX:em,originY:em,originZ:J,zIndex:zg,fillOpacity:Rp,strokeOpacity:Rp,numOctaves:zg},jee={...Bg,color:nm,backgroundColor:nm,outlineColor:nm,fill:nm,stroke:nm,borderColor:nm,borderTopColor:nm,borderRightColor:nm,borderBottomColor:nm,borderLeftColor:nm,filter:Lg,WebkitFilter:Lg,mask:Rg,WebkitMask:Rg},Vg=e=>jee[e],Hg=new Set([Lg,Rg]);function Ug(e,t){let n=Vg(e);return Hg.has(n)||(n=gm),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Wg=new Set([`auto`,`none`,`0`]);function Gg(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Wg.has(t)&&dm(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Ug(n,i)}var Kg=class extends Lh{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Pp(r))){let i=og(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!pg.has(n)||e.length!==2)return;let[r,i]=e,a=Mg(r),o=Mg(i);if(Ip(r)!==Ip(i)&&kh[n]){this.needsMeasurement=!0;return}if(a!==o)if(Th(a)&&Th(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else kh[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Ng(e[t]))&&n.push(t);n.length&&Gg(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=kh[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=kh[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function qg(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var Jg=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Yg(e){return zf(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Xg,cancel:Mee}=Sp(queueMicrotask,!1),Zg={x:!1,y:!1};function Qg(){return Zg.x||Zg.y}function Nee(e){return e===`x`||e===`y`?Zg[e]?null:(Zg[e]=!0,()=>{Zg[e]=!1}):Zg.x||Zg.y?null:(Zg.x=Zg.y=!0,()=>{Zg.x=Zg.y=!1})}function $g(e,t){let n=qg(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Pee(e){return!(e.pointerType===`touch`||Qg())}function Fee(e,t,n={}){let[r,i,a]=$g(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Pee(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var e_=(e,t)=>t?e===t?!0:e_(e,t.parentElement):!1,t_=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,n_=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function r_(e){return n_.has(e.tagName)||e.isContentEditable===!0}var i_=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function a_(e){return i_.has(e.tagName)||e.isContentEditable===!0}var o_=new WeakSet;function s_(e){return t=>{t.key===`Enter`&&e(t)}}function c_(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var l_=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=s_(()=>{if(o_.has(n))return;c_(n,`down`);let e=s_(()=>{c_(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>c_(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function u_(e){return t_(e)&&!Qg()}var d_=new WeakSet;function f_(e,t,n={}){let[r,i,a]=$g(e,n),o=e=>{let r=e.currentTarget;if(!u_(e)||d_.has(e))return;o_.add(r),n.stopPropagation&&d_.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),o_.has(r)&&o_.delete(r),u_(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||e_(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Yg(e)&&(e.addEventListener(`focus`,e=>l_(e,i)),!r_(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function p_(e){return zf(e)&&`ownerSVGElement`in e}var m_=new WeakMap,h_,g_=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:p_(r)&&`getBBox`in r?r.getBBox()[t]:r[n],__=g_(`inline`,`width`,`offsetWidth`),v_=g_(`block`,`height`,`offsetHeight`);function y_({target:e,borderBoxSize:t}){m_.get(e)?.forEach(n=>{n(e,{get width(){return __(e,t)},get height(){return v_(e,t)}})})}function b_(e){e.forEach(y_)}function x_(){typeof ResizeObserver>`u`||(h_=new ResizeObserver(b_))}function S_(e,t){h_||x_();let n=qg(e);return n.forEach(e=>{let n=m_.get(e);n||(n=new Set,m_.set(e,n)),n.add(t),h_?.observe(e)}),()=>{n.forEach(e=>{let n=m_.get(e);n?.delete(t),n?.size||h_?.unobserve(e)})}}var C_=new Set,w_;function T_(){w_=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};C_.forEach(t=>t(e))},window.addEventListener(`resize`,w_)}function E_(e){return C_.add(e),w_||T_(),()=>{C_.delete(e),!C_.size&&typeof w_==`function`&&(window.removeEventListener(`resize`,w_),w_=void 0)}}function D_(e,t){return typeof e==`function`?E_(e):S_(e,t)}function O_(e){return p_(e)&&e.tagName===`svg`}var k_=[...jg,nm,gm],A_=e=>k_.find(Ag(e)),j_=()=>({translate:0,scale:1,origin:0,originPoint:0}),M_=()=>({x:j_(),y:j_()}),N_=()=>({min:0,max:0}),P_=()=>({x:N_(),y:N_()}),F_=new WeakMap;function I_(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function L_(e){return typeof e==`string`||Array.isArray(e)}var R_=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],z_=[`initial`,...R_];function B_(e){return I_(e.animate)||z_.some(t=>L_(e[t]))}function V_(e){return!!(B_(e)||e.variants)}function H_(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Sg(i))e.addValue(r,i);else if(Sg(a))e.addValue(r,vg(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,vg(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var U_={current:null},W_={current:!1},G_=typeof window<`u`;function K_(){if(W_.current=!0,G_)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>U_.current=e.matches;e.addEventListener(`change`,t),t()}else U_.current=!1}var q_=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],J_={};function Y_(e){J_=e}function X_(){return J_}var Iee=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Lh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=kp.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Cp.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=B_(t),this.isVariantNode=V_(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&Sg(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,F_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(W_.current||K_(),this.shouldReduceMotion=U_.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),wp(this.notifyUpdate),wp(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&ig.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Xh({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:qf(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=wh.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Cp.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in J_){let t=J_[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):P_()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<q_.length;t++){let n=q_[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=H_(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=vg(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(Rf(n)||Bf(n))?n=parseFloat(n):!A_(n)&&gm.test(t)&&(n=Ug(e,t)),this.setBaseTarget(e,Sg(n)?n.get():n)),Sg(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=dg(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Sg(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new Kf),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Xg.render(this.render)}},Z_=class extends Iee{constructor(){super(...arguments),this.KeyframeResolver=Kg}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Sg(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Q_=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function $_({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Lee({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ree(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function ev(e){return e===void 0||e===1}function tv({scale:e,scaleX:t,scaleY:n}){return!ev(e)||!ev(t)||!ev(n)}function nv(e){return tv(e)||rv(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function rv(e){return iv(e.x)||iv(e.y)}function iv(e){return e&&e!==`0%`}function av(e,t,n){return n+t*(e-n)}function ov(e,t,n,r,i){return i!==void 0&&(e=av(e,i,r)),av(e,n,r)+t}function sv(e,t=0,n=1,r,i){e.min=ov(e.min,t,n,r,i),e.max=ov(e.max,t,n,r,i)}function cv(e,{x:t,y:n}){sv(e.x,t.translate,t.scale,t.originPoint),sv(e.y,n.translate,n.scale,n.originPoint)}var lv=.999999999999,uv=1.0000000000001;function dv(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(fv(e.x,-a.scroll.offset.x),fv(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,cv(e,o)),r&&nv(a.latestValues)&&hv(e,a.latestValues,a.layout?.layoutBox))}t.x<uv&&t.x>lv&&(t.x=1),t.y<uv&&t.y>lv&&(t.y=1)}function fv(e,t){e.min+=t,e.max+=t}function pv(e,t,n,r,i=.5){sv(e,t,n,ym(e.min,e.max,i),r)}function mv(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function hv(e,t,n){let r=n??e;pv(e.x,mv(t.x,r.x),t.scaleX,t.scale,t.originX),pv(e.y,mv(t.y,r.y),t.scaleY,t.scale,t.originY)}function gv(e,t){return $_(Ree(e.getBoundingClientRect(),t))}function _v(e,t,n){let r=gv(e,n),{scroll:i}=t;return i&&(fv(r.x,i.offset.x),fv(r.y,i.offset.y)),r}var vv={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},yv=Ch.length;function bv(e,t,n){let r=``,i=!0;for(let a=0;a<yv;a++){let o=Ch[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=Jg(s,Bg[o]);if(!c){i=!1;let t=vv[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function xv(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(wh.has(e)){o=!0;continue}else if(Mp(e)){i[e]=n;continue}else{let t=Jg(n,Bg[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=bv(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function Sv(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Cv(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var wv={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(J.test(e))e=parseFloat(e);else return e;return`${Cv(e,t.target.x)}% ${Cv(e,t.target.y)}%`}},Tv={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=gm.parse(e);if(i.length>5)return r;let a=gm.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=ym(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Ev={borderRadius:{...wv,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:wv,borderTopRightRadius:wv,borderBottomLeftRadius:wv,borderBottomRightRadius:wv,boxShadow:Tv};function Dv(e,{layout:t,layoutId:n}){return wh.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ev[e]||e===`opacity`)}function Ov(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Sg(r[t])||i&&Sg(i[t])||Dv(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function kv(e){return window.getComputedStyle(e)}var Av=class extends Z_{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Sv}readValueFromInstance(e,t){if(wh.has(t))return this.projection?.isProjecting?yh(t):xh(e,t);{let n=kv(e),r=(Mp(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return gv(e,t)}build(e,t,n){xv(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Ov(e,t,n)}},jv={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Mv={offset:`strokeDashoffset`,array:`strokeDasharray`};function Nv(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?jv:Mv;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Pv=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Fv(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(xv(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Pv)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Nv(d,i,a,o,!1)}var Iv=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Lv=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Rv(e,t,n,r){Sv(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Iv.has(n)?n:wg(n),t.attrs[n])}function zv(e,t,n){let r=Ov(e,t,n);for(let n in e)if(Sg(e[n])||Sg(t[n])){let t=Ch.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Bv=class extends Z_{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=P_}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(wh.has(t)){let e=Vg(t);return e&&e.default||0}return t=Iv.has(t)?t:wg(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return zv(e,t,n)}build(e,t,n){Fv(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Rv(e,t,n,r)}mount(e){this.isSVGTag=Lv(e.tagName),super.mount(e)}},Vv=z_.length;function Hv(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Hv(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Vv;n++){let r=z_[n],i=e.props[r];(L_(i)||i===!1)&&(t[r]=i)}return t}function Uv(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var Wv=[...R_].reverse(),Gv=R_.length;function Kv(e){return t=>Promise.all(t.map(({animation:t,options:n})=>kee(e,t,n)))}function qv(e){let t=Kv(e),n=Xv(),r=!0,i=!1,a=t=>(n,r)=>{let i=fg(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=Hv(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<Gv;t++){let p=Wv[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=L_(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||I_(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Jv(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=yg(t)&&yg(n)?!Uv(t,n):t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=fg(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=ag(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=fg(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Xv(),i=!0}}}function Jv(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Uv(t,e):!1}function Yv(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Xv(){return{animate:Yv(!0),whileInView:Yv(),whileHover:Yv(),whileTap:Yv(),whileDrag:Yv(),whileFocus:Yv(),exit:Yv()}}function Zv(e,t){e.min=t.min,e.max=t.max}function Qv(e,t){Zv(e.x,t.x),Zv(e.y,t.y)}function $v(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var ey=1e-4,ty=1-ey,ny=1+ey,ry=.01,iy=0-ry,ay=0+ry;function oy(e){return e.max-e.min}function sy(e,t,n){return Math.abs(e-t)<=n}function cy(e,t,n,r=.5){e.origin=r,e.originPoint=ym(t.min,t.max,e.origin),e.scale=oy(n)/oy(t),e.translate=ym(n.min,n.max,e.origin)-e.originPoint,(e.scale>=ty&&e.scale<=ny||isNaN(e.scale))&&(e.scale=1),(e.translate>=iy&&e.translate<=ay||isNaN(e.translate))&&(e.translate=0)}function ly(e,t,n,r){cy(e.x,t.x,n.x,r?r.originX:void 0),cy(e.y,t.y,n.y,r?r.originY:void 0)}function uy(e,t,n,r=0){e.min=(r?ym(n.min,n.max,r):n.min)+t.min,e.max=e.min+oy(t)}function dy(e,t,n,r){uy(e.x,t.x,n.x,r?.x),uy(e.y,t.y,n.y,r?.y)}function fy(e,t,n,r=0){let i=r?ym(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+oy(t)}function py(e,t,n,r){fy(e.x,t.x,n.x,r?.x),fy(e.y,t.y,n.y,r?.y)}function my(e,t,n,r,i){return e-=t,e=av(e,1/n,r),i!==void 0&&(e=av(e,1/i,r)),e}function hy(e,t=0,n=1,r=.5,i,a=e,o=e){if(Qp.test(t)&&(t=parseFloat(t),t=ym(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=ym(a.min,a.max,r);e===a&&(s-=t),e.min=my(e.min,t,n,s,i),e.max=my(e.max,t,n,s,i)}function gy(e,t,[n,r,i],a,o){hy(e,t[n],t[r],t[i],t.scale,a,o)}var _y=[`x`,`scaleX`,`originX`],vy=[`y`,`scaleY`,`originY`];function yy(e,t,n,r){gy(e.x,t,_y,n?n.x:void 0,r?r.x:void 0),gy(e.y,t,vy,n?n.y:void 0,r?r.y:void 0)}function by(e){return e.translate===0&&e.scale===1}function xy(e){return by(e.x)&&by(e.y)}function Sy(e,t){return e.min===t.min&&e.max===t.max}function Cy(e,t){return Sy(e.x,t.x)&&Sy(e.y,t.y)}function wy(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Ty(e,t){return wy(e.x,t.x)&&wy(e.y,t.y)}function Ey(e){return oy(e.x)/oy(e.y)}function Dy(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Oy(e){return[e(`x`),e(`y`)]}function ky(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Ay=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],jy=Ay.length,My=e=>typeof e==`string`?parseFloat(e):e,Ny=e=>typeof e==`number`||J.test(e);function Py(e,t,n,r,i,a){i?(e.opacity=ym(0,n.opacity??1,Iy(r)),e.opacityExit=ym(t.opacity??1,0,Ly(r))):a&&(e.opacity=ym(t.opacity??1,n.opacity??1,r));for(let i=0;i<jy;i++){let a=Ay[i],o=Fy(t,a),s=Fy(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Ny(o)===Ny(s)?(e[a]=Math.max(ym(My(o),My(s),r),0),(Qp.test(s)||Qp.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=ym(t.rotate||0,n.rotate||0,r))}function Fy(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Iy=Ry(0,.5,cp),Ly=Ry(.5,.95,Hf);function Ry(e,t,n){return r=>r<e?0:r>t?1:n(Gf(e,t,r))}function zy(e,t,n){let r=Sg(e)?e:vg(e);return r.start(lg(``,r,t,n)),r.animation}function By(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Vy=(e,t)=>e.depth-t.depth,Hy=class{constructor(){this.children=[],this.isDirty=!1}add(e){Pf(this.children,e),this.isDirty=!0}remove(e){Ff(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Vy),this.isDirty=!1,this.children.forEach(e)}};function Uy(e,t){let n=kp.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(wp(r),e(a-t))};return Cp.setup(r,!0),()=>wp(r)}function Wy(e){return Sg(e)?e.get():e}var Gy=class{constructor(){this.members=[]}add(e){Pf(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Ff(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Ff(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Ky={hasAnimatedSinceResize:!0,hasEverUpdated:!1},qy={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Jy=[``,`X`,`Y`,`Z`],Yy=1e3,Xy=0;function Zy(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Qy(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Eg(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Cp,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Qy(r)}function $y({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=Xy++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,yp.value&&(qy.nodes=qy.calculatedTargetDeltas=qy.calculatedProjections=0),this.nodes.forEach(Vee),this.nodes.forEach(qee),this.nodes.forEach(Jee),this.nodes.forEach(Hee),yp.addProjectionMetrics&&yp.addProjectionMetrics(qy)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Hy)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Kf),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=p_(t)&&!O_(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;Cp.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Uy(i,250),Ky.hasAnimatedSinceResize&&(Ky.hasAnimatedSinceResize=!1,this.nodes.forEach(nb)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||$ee,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Ty(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...cg(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||nb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wp(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Yee),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Qy(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(Wee),this.nodes.forEach(eb);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(tb);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Gee),this.nodes.forEach(Kee),this.nodes.forEach(zee),this.nodes.forEach(Bee)):this.nodes.forEach(tb),this.clearAllSnapshots();let e=kp.now();Tp.delta=If(0,1e3/60,e-Tp.timestamp),Tp.timestamp=e,Tp.isProcessing=!0,Ep.update.process(Tp),Ep.preRender.process(Tp),Ep.render.process(Tp),Tp.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Xg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Uee),this.sharedNodes.forEach(Xee)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Cp.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Cp.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!oy(this.snapshot.measuredBox.x)&&!oy(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=P_(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!xy(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||nv(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),ete(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return P_();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(tte))){let{scroll:e}=this.root;e&&(fv(t.x,e.offset.x),fv(t.y,e.offset.y))}return t}removeElementScroll(e){let t=P_();if(Qv(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Qv(t,e),fv(t.x,i.offset.x),fv(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||P_();Qv(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(fv(r.x,-n.scroll.offset.x),fv(r.y,-n.scroll.offset.y)),nv(n.latestValues)&&hv(r,n.latestValues,n.layout?.layoutBox)}return nv(this.latestValues)&&hv(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=P_();Qv(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!nv(n.latestValues))continue;let r;n.instance&&(tv(n.latestValues)&&n.updateSnapshot(),r=P_(),Qv(r,n.measurePageBox())),yy(t,n.latestValues,n.snapshot?.layoutBox,r)}return nv(this.latestValues)&&yy(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Tp.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=Tp.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=P_(),this.targetWithTransforms=P_()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),dy(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Qv(this.target,this.layout.layoutBox),cv(this.target,this.targetDelta)):Qv(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),yp.value&&qy.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||tv(this.parent.latestValues)||rv(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=P_(),this.relativeTargetOrigin=P_(),py(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),Qv(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===Tp.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Qv(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;dv(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=P_());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():($v(this.prevProjectionDelta.x,this.projectionDelta.x),$v(this.prevProjectionDelta.y,this.projectionDelta.y)),ly(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Dy(this.projectionDelta.x,this.prevProjectionDelta.x)||!Dy(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),yp.value&&qy.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=M_(),this.projectionDelta=M_(),this.projectionDeltaWithTransform=M_()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=M_();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=P_(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(Qee));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;rb(a.x,e.x,n),rb(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(py(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Zee(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&Cy(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=P_(),Qv(d,this.relativeTarget)),s&&(this.animationValues=i,Py(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(wp(this.pendingAnimation),void 0),this.pendingAnimation=Cp.update(()=>{Ky.hasAnimatedSinceResize=!0,Ap.layout++,this.motionValue||=vg(0),this.motionValue.jump(0,!1),this.currentAnimation=zy(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{Ap.layout--},onComplete:()=>{Ap.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Yy),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&cb(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||P_();let t=oy(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=oy(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Qv(t,n),hv(t,i),ly(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Gy),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&Zy(`z`,e,r,this.animationValues);for(let t=0;t<Jy.length;t++)Zy(`rotate${Jy[t]}`,e,r,this.animationValues),Zy(`skew${Jy[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=Wy(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=Wy(t?.pointerEvents)||``),this.hasProjected&&!nv(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=ky(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Ev){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Ev[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?Wy(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(eb),this.root.sharedNodes.clear()}}}function zee(e){e.updateLayout()}function Bee(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)Oy(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=oy(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Zv(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else cb(i,t.layoutBox,n)&&Oy(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=oy(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=M_();ly(o,n,t.layoutBox);let s=M_();a?ly(s,e.applyTransform(r,!0),t.measuredBox):ly(s,n,t.layoutBox);let c=!xy(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=P_();py(s,t.layoutBox,i.layoutBox,o);let c=P_();py(c,n,a.layoutBox,o),Ty(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Vee(e){yp.value&&qy.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Hee(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Uee(e){e.clearSnapshot()}function eb(e){e.clearMeasurements()}function Wee(e){e.isLayoutDirty=!0,e.updateLayout()}function tb(e){e.isLayoutDirty=!1}function Gee(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Kee(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function nb(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function qee(e){e.resolveTargetDelta()}function Jee(e){e.calcProjection()}function Yee(e){e.resetSkewAndRotation()}function Xee(e){e.removeLeadSnapshot()}function rb(e,t,n){e.translate=ym(t.translate,0,n),e.scale=ym(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function ib(e,t,n,r){e.min=ym(t.min,n.min,r),e.max=ym(t.max,n.max,r)}function Zee(e,t,n,r){ib(e.x,t.x,n.x,r),ib(e.y,t.y,n.y,r)}function Qee(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var $ee={duration:.45,ease:[.4,0,.1,1]},ab=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),ob=ab(`applewebkit/`)&&!ab(`chrome/`)?Math.round:Hf;function sb(e){e.min=ob(e.min),e.max=ob(e.max)}function ete(e){sb(e.x),sb(e.y)}function cb(e,t,n){return e===`position`||e===`preserve-aspect`&&!sy(Ey(t),Ey(n),.2)}function tte(e){return e!==e.root&&e.scroll?.wasRoot}var nte=$y({attachResizeListener:(e,t)=>By(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),lb={current:void 0},ub=$y({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!lb.current){let e=new nte({});e.mount(window),e.setOptions({layoutScroll:!0}),lb.current=e}return lb.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),db=(0,L.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function fb(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function rte(...e){return t=>{let n=!1,r=e.map(e=>{let r=fb(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():fb(e[t],null)}}}}function ite(...e){return L.useCallback(rte(...e),e)}var ate=class extends L.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Yg(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Yg(e)&&e.offsetWidth||0,r=Yg(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}};function ote({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,L.useId)(),s=(0,L.useRef)(null),c=(0,L.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:l}=(0,L.useContext)(db),u=ite(s,e.props?.ref??e?.ref);return(0,L.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m}=c.current;if(t||a===!1||!s.current||!e||!u)return;let h=n===`left`?`left: ${f}`:`right: ${p}`,g=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let _=document.createElement(`style`);l&&(_.nonce=l);let v=i??document.head;return v.appendChild(_),_.sheet&&_.sheet.insertRule(`
19
+ `+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=Fo(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&ls.assertOptions(n,{silentJSONParsing:us.transitional(us.boolean),forcedJSONParsing:us.transitional(us.boolean),clarifyTimeoutError:us.transitional(us.boolean),legacyInterceptorReqResOrdering:us.transitional(us.boolean)},!1),r!=null&&(B.isFunction(r)?t.paramsSerializer={serialize:r}:ls.assertOptions(r,{encode:us.function,serialize:us.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),ls.assertOptions(t,{baseUrl:us.spelling(`baseURL`),withXsrfToken:us.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&B.merge(i.common,i[t.method]);i&&B.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=vo.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||Ha;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[is.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=is.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=Fo(this.defaults,e),Ba(No(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};B.forEach([`delete`,`get`,`head`,`options`],function(e){ds.prototype[e]=function(t,n){return this.request(Fo(n||{},{method:e,url:t,data:(n||{}).data}))}}),B.forEach([`post`,`put`,`patch`],function(e){function t(t){return function(n,r,i){return this.request(Fo(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}ds.prototype[e]=t(),ds.prototype[e+`Form`]=t(!0)});var fs=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new xo(e,r,i),t(n.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 t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}};function ps(e){return function(t){return e.apply(null,t)}}function ms(e){return B.isObject(e)&&e.isAxiosError===!0}var hs={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(hs).forEach(([e,t])=>{hs[t]=e});function gs(e){let t=new ds(e),n=vi(ds.prototype.request,t);return B.extend(n,ds.prototype,t,{allOwnKeys:!0}),B.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return gs(Fo(e,t))},n}var _s=gs(ro);_s.Axios=ds,_s.CanceledError=xo,_s.CancelToken=fs,_s.isCancel=bo,_s.VERSION=as,_s.toFormData=Fa,_s.AxiosError=ka,_s.Cancel=_s.CanceledError,_s.all=function(e){return Promise.all(e)},_s.spread=ps,_s.isAxiosError=ms,_s.mergeConfig=Fo,_s.AxiosHeaders=vo,_s.formToJSON=e=>eo(B.isHTMLForm(e)?new FormData(e):e),_s.getAdapter=ns.getAdapter,_s.HttpStatusCode=hs,_s.default=_s;var vs=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ys=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),bs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),xs=e=>{let t=bs(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ss={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Cs=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ws=(0,L.createContext)({}),Ts=()=>(0,L.useContext)(ws),Es=(0,L.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ts()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,L.createElement)(`svg`,{ref:c,...Ss,width:t??l??Ss.width,height:t??l??Ss.height,stroke:e??f,strokeWidth:m,className:vs(`lucide`,p,i),...!a&&!Cs(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,L.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),V=(e,t)=>{let n=(0,L.forwardRef)(({className:n,...r},i)=>(0,L.createElement)(Es,{ref:i,iconNode:t,className:vs(`lucide-${ys(xs(e))}`,`lucide-${e}`,n),...r}));return n.displayName=xs(e),n},Ds=V(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Os=V(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ks=V(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),As=V(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),js=V(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),Ms=V(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ns=V(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ps=V(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Fs=V(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Is=V(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Ls=V(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Rs=V(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),zs=V(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Bs=V(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Vs=V(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Hs=V(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Us=V(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ws=V(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Gs=V(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Ks=V(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qs=V(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Js=V(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ys=V(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Xs=V(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Zs=V(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Qs=V(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),$s=V(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ec=V(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),tc=V(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),nc=V(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),rc=V(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),ic=V(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ac=V(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),oc=V(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),sc=V(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),cc=V(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),lc=V(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),uc=V(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),dc=V(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),fc=V(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),pc=V(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),mc=V(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),hc=V(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),gc=V(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),_c=V(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),vc=V(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),yc=V(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),bc=V(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),xc=V(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Sc=V(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Cc=V(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),wc=V(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Tc=V(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ec=V(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Dc=V(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Oc=V(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),kc=V(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Ac=V(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),jc=V(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Mc=V(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Nc=V(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Pc=V(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Fc=V(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ic=V(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Lc=V(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Rc=V(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),zc=V(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Bc=V(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Vc=V(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Hc=V(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Uc=V(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Wc=V(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Gc=V(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Kc=V(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),qc=V(`test-tube`,[[`path`,{d:`M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2`,key:`125lnx`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}],[`path`,{d:`M14.5 16h-5`,key:`1ox875`}]]),Jc=V(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Yc=V(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Xc=V(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Zc=V(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Qc=V(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),$c=V(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),el=V(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),tl=V(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),nl=u(y(),1),rl=u(_(),1),il=(0,L.createContext)({toast:()=>{}}),al=()=>{};function H(e,t=`error`){al(e,t)}function ol({children:e}){let[t,n]=(0,L.useState)([]),r={current:0},i=(0,L.useCallback)((e,t=`error`)=>{let i=++r.current;n(n=>[...n,{id:i,type:t,message:e}]),setTimeout(()=>n(e=>e.filter(e=>e.id!==i)),4e3)},[]);(0,L.useEffect)(()=>{al=i},[i]);let a={success:Gs,error:qs,warning:Xc},o={success:`bg-green-50 border-green-200 text-green-800`,error:`bg-red-50 border-red-200 text-red-800`,warning:`bg-yellow-50 border-yellow-200 text-yellow-800`},s={success:`text-green-500`,error:`text-red-500`,warning:`text-yellow-500`};return(0,R.jsxs)(il.Provider,{value:{toast:i},children:[e,(0,rl.createPortal)((0,R.jsx)(`div`,{className:`fixed bottom-4 right-4 z-[9999] flex flex-col gap-2 max-w-sm`,children:t.map(e=>{let t=a[e.type];return(0,R.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3 rounded-lg border shadow-lg text-sm ${o[e.type]}`,children:[(0,R.jsx)(t,{className:`h-4 w-4 mt-0.5 flex-shrink-0 ${s[e.type]}`}),(0,R.jsx)(`span`,{className:`flex-1`,children:e.message}),(0,R.jsx)(`button`,{onClick:()=>n(t=>t.filter(t=>t.id!==e.id)),children:(0,R.jsx)(el,{className:`h-3.5 w-3.5 opacity-60 hover:opacity-100`})})]},e.id)})}),document.body)]})}var U=_s.create({baseURL:`/api`,timeout:3e4});U.interceptors.request.use(e=>{let t=window.__AUTH_TOKEN__;return t&&(e.headers.Authorization=`Bearer ${t}`),e}),U.interceptors.response.use(e=>e,e=>(H(e.response?.data?.error||e.response?.data?.message||e.message||`请求失败`,`error`),Promise.reject(e)));var sl=()=>U.get(`/health`),cl=()=>U.get(`/config`),ll=e=>U.put(`/config`,e),ul=()=>U.get(`/config/history`),dl=e=>U.get(`/sessions`,{params:e}),fl=e=>U.get(`/sessions/${e}`),pl=e=>U.delete(`/sessions/${e}`),ml=e=>U.delete(`/sessions`,{data:{ids:e}}),hl=e=>U.get(`/events`,{params:e}),gl=e=>U.get(`/events/stats`,{params:{project_path:e}}),_l=e=>U.get(`/pipelines`,{params:e}),vl=e=>U.get(`/pipelines/${e}`),yl=e=>U.get(`/quality/history`,{params:e}),bl=e=>U.get(`/quality/unresolved`,{params:{project_path:e}}),xl=()=>U.get(`/stats/roi`),Sl=()=>U.get(`/stats/overview`),Cl=(e,t,n,r)=>U.get(`/knowledge/search`,{params:{q:e,project_path:t,node_type:n,limit:r}}),wl=e=>U.get(`/knowledge/overview`,{params:{project_path:e}}),Tl=(e,t)=>U.get(`/knowledge/neighbors`,{params:{node_id:e,project_path:t}}),El=(e,t)=>U.get(`/knowledge/graph`,{params:{project_path:e,node_type:t}}),Dl=e=>U.post(`/knowledge/nodes`,e),Ol=(e,t)=>U.put(`/knowledge/nodes/${e}`,t),kl=e=>U.delete(`/knowledge/nodes/${e}`),Al=e=>U.delete(`/knowledge/batch`,{data:{ids:e}}),jl=e=>U.post(`/knowledge/import`,{nodes:e}),Ml=e=>U.post(`/knowledge/edges`,e),Nl=e=>U.post(`/pipelines/${e}/close`),Pl=e=>U.post(`/pipelines/${e}/reactivate`),Fl=e=>U.post(`/pipelines/batch-close`,{ids:e}),Il=()=>U.post(`/pipelines/close-expired`),Ll=()=>U.get(`/pipelines/active`),Rl=e=>U.post(`/pipelines/${e}/resume`),zl=e=>U.post(`/pipelines/${e}/advance`),Bl=e=>U.get(`/projects`,{params:e}),Vl=e=>U.get(`/projects/${e}`),Hl=e=>U.delete(`/projects/${e}`),Ul=e=>U.post(`/convention/init`,{path:e},{timeout:18e4}),Wl=e=>U.get(`/projects/${e}/conventions`),Gl=(e,t)=>U.post(`/projects/${e}/conventions/bind`,{conventionId:t}),Kl=(e,t)=>U.delete(`/projects/${e}/conventions/${encodeURIComponent(t)}`),ql=e=>U.get(`/projects/${e}/conventions/custom/yaml`),Jl=(e,t)=>U.put(`/projects/${e}/conventions/custom`,{yaml:t}),Yl=e=>U.post(`/projects/${e}/conventions/distill`,{},{timeout:12e4}),Xl=e=>U.get(`/claudemd/${e}`),Zl=(e,t)=>U.put(`/claudemd/${e}`,{content:t}),Ql=e=>U.get(`/claudemd/${e}/profile`),$l=e=>U.get(`/claudemd/${e}/modules`),eu=e=>U.post(`/claudemd/${e}/distill`,void 0,{timeout:18e4}),tu=e=>U.post(`/claudemd/${e}/init`,void 0,{timeout:18e4}),nu=e=>U.post(`/quality/${e}/resolve`),ru=e=>U.post(`/quality/${e}/dismiss`),iu=e=>U.post(`/quality/batch-dismiss`,{ids:e}),au=e=>U.post(`/quality/batch-resolve`,{ids:e}),ou=()=>U.post(`/quality/resolve-all`),su=e=>U.get(`/quality/${e}/context`),cu=()=>U.get(`/daemon/status`),lu=()=>U.post(`/daemon/restart`),uu=()=>U.get(`/daemon/diagnose`),du=()=>U.post(`/daemon/repair`),fu=e=>U.post(`/config/backup`,e||{}),pu=()=>U.get(`/config/backups`),mu=e=>`/api/config/backups/${encodeURIComponent(e)}`,hu=(e,t)=>U.post(`/config/restore`,{filename:e,password:t}),gu=e=>U.post(`/events/purge`,{retentionDays:e}),_u=()=>U.get(`/memory/caches`),vu=()=>U.get(`/memory/process`),yu=e=>U.post(`/memory/caches/${encodeURIComponent(e)}/clear`),bu=()=>U.post(`/memory/caches/clear-all`),xu=()=>U.post(`/memory/gc`),Su=e=>U.get(`/stats/api-usage`,{params:{days:e}}),Cu=e=>U.get(`/skills`,{params:e}),wu=()=>U.get(`/skills/status`),Tu=e=>U.get(`/skills/${encodeURIComponent(e)}`),Eu=(e,t)=>U.put(`/skills/${encodeURIComponent(e)}/content`,{content:t}),Du=(e,t)=>U.post(`/skills/search`,{query:e,...t},{timeout:3e4}),Ou=e=>U.post(`/skills/install`,{url:e},{timeout:6e4}),ku=e=>U.delete(`/skills/${encodeURIComponent(e)}`),Au=e=>U.post(`/skills/batch-delete`,{names:e}),ju=()=>U.post(`/skills/evolve`,{},{timeout:12e4}),Mu=()=>U.post(`/skills/distill`,{},{timeout:12e4}),Nu=()=>U.post(`/skills/repair`,{},{timeout:6e4}),Pu=()=>U.get(`/skills/orchestration`),Fu=(e,t)=>U.put(`/skills/orchestration`,{skill:e,keywords:t}),Iu=e=>U.delete(`/skills/orchestration/${encodeURIComponent(e)}`),Lu=()=>U.get(`/conventions`),Ru=e=>U.get(`/conventions/${encodeURIComponent(e)}`),zu=()=>U.post(`/conventions/sync-official`),Bu=e=>U.post(`/conventions/install`,{url:e},{timeout:3e4}),Vu=e=>U.delete(`/conventions/${encodeURIComponent(e)}`),Hu=()=>U.get(`/conventions/usage-stats`),Uu=e=>U.get(`/conventions/${encodeURIComponent(e)}/evolution-history`),Wu=e=>U.post(`/conventions/batch-evolve`,{conventionIds:e},{timeout:12e4}),Gu=e=>U.get(`/conventions/${encodeURIComponent(e)}/yaml`),Ku=(e,t)=>U.put(`/conventions/${encodeURIComponent(e)}/yaml`,{yaml:t}),qu=e=>U.get(`/node-types`,{params:e?{projectPath:e}:void 0}),Ju=e=>U.get(`/node-types/${encodeURIComponent(e)}`),Yu=e=>U.post(`/node-types`,e),Xu=(e,t)=>U.put(`/node-types/${encodeURIComponent(e)}`,t),Zu=e=>U.delete(`/node-types/${encodeURIComponent(e)}`);function Qu(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Qu(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function $u(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Qu(e))&&(r&&(r+=` `),r+=t);return r}var ed=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},td=(e,t)=>({classGroupId:e,validator:t}),nd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),rd=`-`,id=[],ad=`arbitrary..`,od=e=>{let t=ld(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return cd(e);let n=e.split(rd);return sd(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ed(i,t):t:i||id}return n[e]||id}}},sd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=sd(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(rd):e.slice(t).join(rd),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},cd=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ad+r:void 0})(),ld=e=>{let{theme:t,classGroups:n}=e;return ud(n,t)},ud=(e,t)=>{let n=nd();for(let r in e){let i=e[r];dd(i,n,r,t)}return n},dd=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];fd(i,t,n,r)}},fd=(e,t,n,r)=>{if(typeof e==`string`){pd(e,t,n);return}if(typeof e==`function`){md(e,t,n,r);return}hd(e,t,n,r)},pd=(e,t,n)=>{let r=e===``?t:gd(t,e);r.classGroupId=n},md=(e,t,n,r)=>{if(_d(e)){dd(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(td(n,e))},hd=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];dd(o,gd(t,a),n,r)}},gd=(e,t)=>{let n=e,r=t.split(rd),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=nd(),n.nextPart.set(t,i)),n=i}return n},_d=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,vd=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},yd=`!`,bd=`:`,xd=[],Sd=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Cd=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===bd){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(yd)?(c=s.slice(0,-1),l=!0):s.startsWith(yd)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Sd(t,l,c,u)};if(t){let e=t+bd,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Sd(xd,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},wd=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Td=e=>({cache:vd(e.cacheSize),parseClassName:Cd(e),sortModifiers:wd(e),...od(e)}),Ed=/\s+/,Dd=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Ed),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+yd:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Od=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=kd(n))&&(i&&(i+=` `),i+=r);return i},kd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=kd(e[r]))&&(n&&(n+=` `),n+=t);return n},Ad=(e,...t)=>{let n,r,i,a,o=o=>(n=Td(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Dd(e,n);return i(e,a),a};return a=o,(...e)=>a(Od(...e))},jd=[],Md=e=>{let t=t=>t[e]||jd;return t.isThemeGetter=!0,t},Nd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Id=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ld=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Rd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vd=e=>Fd.test(e),W=e=>!!e&&!Number.isNaN(Number(e)),Hd=e=>!!e&&Number.isInteger(Number(e)),Ud=e=>e.endsWith(`%`)&&W(e.slice(0,-1)),Wd=e=>Id.test(e),Gd=()=>!0,Kd=e=>Ld.test(e)&&!Rd.test(e),qd=()=>!1,Jd=e=>zd.test(e),Yd=e=>Bd.test(e),Xd=e=>!G(e)&&!K(e),Zd=e=>pf(e,_f,qd),G=e=>Nd.test(e),Qd=e=>pf(e,vf,Kd),$d=e=>pf(e,yf,W),ef=e=>pf(e,xf,Gd),tf=e=>pf(e,bf,qd),nf=e=>pf(e,hf,qd),rf=e=>pf(e,gf,Yd),af=e=>pf(e,Sf,Jd),K=e=>Pd.test(e),of=e=>mf(e,vf),sf=e=>mf(e,bf),cf=e=>mf(e,hf),lf=e=>mf(e,_f),uf=e=>mf(e,gf),df=e=>mf(e,Sf,!0),ff=e=>mf(e,xf,!0),pf=(e,t,n)=>{let r=Nd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},mf=(e,t,n=!1)=>{let r=Pd.exec(e);return r?r[1]?t(r[1]):n:!1},hf=e=>e===`position`||e===`percentage`,gf=e=>e===`image`||e===`url`,_f=e=>e===`length`||e===`size`||e===`bg-size`,vf=e=>e===`length`,yf=e=>e===`number`,bf=e=>e===`family-name`,xf=e=>e===`number`||e===`weight`,Sf=e=>e===`shadow`,Cf=Ad(()=>{let e=Md(`color`),t=Md(`font`),n=Md(`text`),r=Md(`font-weight`),i=Md(`tracking`),a=Md(`leading`),o=Md(`breakpoint`),s=Md(`container`),c=Md(`spacing`),l=Md(`radius`),u=Md(`shadow`),d=Md(`inset-shadow`),f=Md(`text-shadow`),p=Md(`drop-shadow`),m=Md(`blur`),h=Md(`perspective`),g=Md(`aspect`),_=Md(`ease`),v=Md(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),K,G],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[K,G,c],T=()=>[Vd,`full`,`auto`,...w()],E=()=>[Hd,`none`,`subgrid`,K,G],D=()=>[`auto`,{span:[`full`,Hd,K,G]},Hd,K,G],O=()=>[Hd,`auto`,K,G],k=()=>[`auto`,`min`,`max`,`fr`,K,G],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Vd,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[Vd,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],te=()=>[Vd,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,K,G],ne=()=>[...b(),cf,nf,{position:[K,G]}],re=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,lf,Zd,{size:[K,G]}],ae=()=>[Ud,of,Qd],F=()=>[``,`none`,`full`,l,K,G],I=()=>[``,W,of,Qd],oe=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[W,Ud,cf,nf],le=()=>[``,`none`,m,K,G],ue=()=>[`none`,W,K,G],de=()=>[`none`,W,K,G],fe=()=>[W,K,G],pe=()=>[Vd,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Wd],breakpoint:[Wd],color:[Gd],container:[Wd],"drop-shadow":[Wd],ease:[`in`,`out`,`in-out`],font:[Xd],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Wd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Wd],shadow:[Wd],spacing:[`px`,W],text:[Wd],"text-shadow":[Wd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Vd,G,K,g]}],container:[`container`],columns:[{columns:[W,G,K,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Hd,`auto`,K,G]}],basis:[{basis:[Vd,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[W,Vd,`auto`,`initial`,`none`,G]}],grow:[{grow:[``,W,K,G]}],shrink:[{shrink:[``,W,K,G]}],order:[{order:[Hd,`first`,`last`,`none`,K,G]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...ee()]}],"min-inline-size":[{"min-inline":[`auto`,...ee()]}],"max-inline-size":[{"max-inline":[`none`,...ee()]}],"block-size":[{block:[`auto`,...te()]}],"min-block-size":[{"min-block":[`auto`,...te()]}],"max-block-size":[{"max-block":[`none`,...te()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,of,Qd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ff,ef]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Ud,G]}],"font-family":[{font:[sf,tf,t]}],"font-features":[{"font-features":[G]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,K,G]}],"line-clamp":[{"line-clamp":[W,`none`,K,$d]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,K,G]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,K,G]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[W,`from-font`,`auto`,K,Qd]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[W,`auto`,K,G]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,K,G]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,K,G]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:re()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Hd,K,G],radial:[``,K,G],conic:[Hd,K,G]},uf,rf]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":I()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[W,K,G]}],"outline-w":[{outline:[``,W,of,Qd]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,df,af]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,df,af]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:I()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[W,Qd]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,df,af]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[W,K,G]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[W]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[K,G]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[W]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:re()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,K,G]}],filter:[{filter:[``,`none`,K,G]}],blur:[{blur:le()}],brightness:[{brightness:[W,K,G]}],contrast:[{contrast:[W,K,G]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,df,af]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,W,K,G]}],"hue-rotate":[{"hue-rotate":[W,K,G]}],invert:[{invert:[``,W,K,G]}],saturate:[{saturate:[W,K,G]}],sepia:[{sepia:[``,W,K,G]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,K,G]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[W,K,G]}],"backdrop-contrast":[{"backdrop-contrast":[W,K,G]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,W,K,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[W,K,G]}],"backdrop-invert":[{"backdrop-invert":[``,W,K,G]}],"backdrop-opacity":[{"backdrop-opacity":[W,K,G]}],"backdrop-saturate":[{"backdrop-saturate":[W,K,G]}],"backdrop-sepia":[{"backdrop-sepia":[``,W,K,G]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,K,G]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[W,`initial`,K,G]}],ease:[{ease:[`linear`,`initial`,_,K,G]}],delay:[{delay:[W,K,G]}],animate:[{animate:[`none`,v,K,G]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,K,G]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[K,G,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,K,G]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,K,G]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[W,of,Qd,$d]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function q(...e){return Cf($u(e))}function wf(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60),i=Math.floor(r/24);return i>0?`${i}天${r%24}小时`:r>0?`${r}小时${n%60}分钟`:n>0?`${n}分钟${t%60}秒`:`${t}秒`}function Tf(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Ef(e){let t={active:`text-green-600 bg-green-50`,completed:`text-blue-600 bg-blue-50`,failed:`text-red-600 bg-red-50`,interrupted:`text-yellow-600 bg-yellow-50`,pending:`text-gray-600 bg-gray-50`};return t[e]||t.pending}function Df(e){return e?e.endsWith(`Z`)||/[+-]\d{2}:\d{2}$/.test(e)?new Date(e):new Date(e+`Z`):new Date}var Of=[{path:`/dashboard`,label:`仪表盘`,icon:vc},{path:`/projects`,label:`项目管理`,icon:dc},{path:`/sessions`,label:`会话管理`,icon:Ds},{path:`/events`,label:`事件流`,icon:Is},{path:`/pipelines`,label:`流水线`,icon:pc},{path:`/quality`,label:`质量门禁`,icon:zc},{path:`/knowledge`,label:`知识图谱`,icon:Fs},{path:`/skills`,label:`技能管理`,icon:Dc},{path:`/conventions`,label:`规范管理`,icon:Ms},{path:`/node-types`,label:`节点类型`,icon:Ps},{path:`/analytics`,label:`数据分析`,icon:Ls},{path:`/config`,label:`系统配置`,icon:Rc}];function kf({children:e}){let[t,n]=(0,L.useState)(()=>localStorage.getItem(`sidebar-collapsed`)===`true`),r=Mn();(0,L.useEffect)(()=>{localStorage.setItem(`sidebar-collapsed`,String(t))},[t]);let{data:i}=ut({queryKey:[`health`],queryFn:()=>sl().then(e=>e.data),refetchInterval:15e3}),a=Of.find(e=>r.pathname.startsWith(e.path));return(0,R.jsxs)(`div`,{className:`flex min-h-screen bg-gray-50`,children:[(0,R.jsxs)(`aside`,{className:q(`fixed top-0 left-0 bottom-0 z-50 flex flex-col transition-all duration-300`,`bg-gradient-to-b from-slate-900 to-slate-800`,t?`w-16`:`w-60`),children:[(0,R.jsxs)(`div`,{className:q(`flex items-center border-b border-white/10 h-16`,t?`justify-center px-2`:`justify-between px-5`),children:[!t&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-gradient-to-br from-blue-500 to-purple-600`,children:(0,R.jsx)(tl,{className:`h-5 w-5 text-white`})}),(0,R.jsx)(`span`,{className:`text-white font-bold text-lg tracking-tight`,children:`Forge`})]}),(0,R.jsx)(`button`,{onClick:()=>n(!t),className:`p-1.5 rounded-lg text-white/60 hover:text-white hover:bg-white/10 transition-colors`,children:t?(0,R.jsx)(wc,{className:`h-5 w-5`}):(0,R.jsx)(Vs,{className:`h-5 w-5`})})]}),(0,R.jsx)(`nav`,{className:`flex-1 py-4 space-y-1 px-2`,children:Of.map(e=>(0,R.jsxs)(ti,{to:e.path,className:({isActive:e})=>q(`flex items-center gap-3 rounded-lg transition-all duration-200`,t?`justify-center p-3`:`px-3 py-2.5`,e?`bg-blue-600/20 text-blue-400`:`text-white/60 hover:text-white hover:bg-white/5`),children:[(0,R.jsx)(e.icon,{className:`h-5 w-5 flex-shrink-0`}),!t&&(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:e.label})]},e.path))}),(0,R.jsx)(`div`,{className:q(`border-t border-white/10 py-4`,t?`px-2`:`px-5`),children:(0,R.jsxs)(`div`,{className:q(`flex items-center gap-2`,t?`justify-center`:``),children:[(0,R.jsx)(`div`,{className:q(`w-2 h-2 rounded-full`,i?.status===`ok`?`bg-green-400 animate-pulse`:`bg-red-400`)}),!t&&(0,R.jsx)(`span`,{className:`text-xs text-white/40`,children:i?.status===`ok`?`Daemon 运行中`:`连接断开`})]})})]}),(0,R.jsxs)(`main`,{className:q(`flex-1 transition-all duration-300`,t?`ml-16`:`ml-60`),children:[(0,R.jsxs)(`header`,{className:`sticky top-0 z-40 bg-white/80 backdrop-blur-md border-b border-gray-200/50 h-16 flex items-center justify-between px-8`,children:[(0,R.jsx)(`h1`,{className:`text-xl font-semibold text-gray-900`,children:a?.label||`Claude Forge`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsxs)(`button`,{className:`hidden sm:flex items-center gap-2 px-3 py-1.5 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors`,onClick:()=>{let e=new KeyboardEvent(`keydown`,{key:`k`,metaKey:!0});window.dispatchEvent(e)},children:[(0,R.jsx)(Zs,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:`命令面板`}),(0,R.jsx)(`kbd`,{className:`px-2 py-0.5 text-xs bg-gray-100 rounded border border-gray-200`,children:`⌘K`})]}),(0,R.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[`v`,`3.6.27`]}),(0,R.jsxs)(`div`,{className:q(`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold`,i?.status===`ok`?`bg-green-50 text-green-700 border border-green-200`:`bg-red-50 text-red-700 border border-red-200`),children:[(0,R.jsx)(`div`,{className:q(`w-1.5 h-1.5 rounded-full`,i?.status===`ok`?`bg-green-500`:`bg-red-500`)}),i?.status===`ok`?`在线`:`离线`]})]})]}),(0,R.jsx)(`div`,{className:`p-8 overflow-x-hidden`,children:e})]})]})}var Af=(0,L.createContext)({});function jf(e){let t=(0,L.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Mf=typeof window<`u`?L.useLayoutEffect:L.useEffect,Nf=(0,L.createContext)(null);function Pf(e,t){e.indexOf(t)===-1&&e.push(t)}function Ff(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var If=(e,t,n)=>n>t?t:n<e?e:n,Lf={},Rf=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function zf(e){return typeof e==`object`&&!!e}var Bf=e=>/^0[^.\s]+$/u.test(e);function Vf(e){let t;return()=>(t===void 0&&(t=e()),t)}var Hf=e=>e,Uf=(e,t)=>n=>t(e(n)),Wf=(...e)=>e.reduce(Uf),Gf=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Kf=class{constructor(){this.subscriptions=[]}add(e){return Pf(this.subscriptions,e),()=>Ff(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},qf=e=>e*1e3,Jf=e=>e/1e3;function Yf(e,t){return t?1e3/t*e:0}var Xf=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Zf=1e-7,Qf=12;function $f(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Xf(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Zf&&++s<Qf);return o}function ep(e,t,n,r){if(e===t&&n===r)return Hf;let i=t=>$f(t,0,1,e,n);return e=>e===0||e===1?e:Xf(i(e),t,r)}var tp=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,np=e=>t=>1-e(1-t),rp=ep(.33,1.53,.69,.99),ip=np(rp),ap=tp(ip),op=e=>e>=1?1:(e*=2)<1?.5*ip(e):.5*(2-2**(-10*(e-1))),sp=e=>1-Math.sin(Math.acos(e)),cp=np(sp),lp=tp(sp),up=ep(.42,0,1,1),dp=ep(0,0,.58,1),fp=ep(.42,0,.58,1),pp=e=>Array.isArray(e)&&typeof e[0]!=`number`,mp=e=>Array.isArray(e)&&typeof e[0]==`number`,hp={linear:Hf,easeIn:up,easeInOut:fp,easeOut:dp,circIn:sp,circInOut:lp,circOut:cp,backIn:ip,backInOut:ap,backOut:rp,anticipate:op},gp=e=>typeof e==`string`,_p=e=>{if(mp(e)){e.length;let[t,n,r,i]=e;return ep(t,n,r,i)}else if(gp(e))return hp[e],`${e}`,hp[e];return e},vp=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],yp={value:null,addProjectionMetrics:null};function bp(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&yp.value&&yp.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var xp=40;function Sp(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=vp.reduce((e,n)=>(e[n]=bp(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Lf.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,xp),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:vp.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<vp.length;t++)o[vp[t]].cancel(e)},state:i,steps:o}}var{schedule:Cp,cancel:wp,state:Tp,steps:Ep}=Sp(typeof requestAnimationFrame<`u`?requestAnimationFrame:Hf,!0),Dp;function Op(){Dp=void 0}var kp={now:()=>(Dp===void 0&&kp.set(Tp.isProcessing||Lf.useManualTiming?Tp.timestamp:performance.now()),Dp),set:e=>{Dp=e,queueMicrotask(Op)}},Ap={layout:0,mainThread:0,waapi:0},jp=e=>t=>typeof t==`string`&&t.startsWith(e),Mp=jp(`--`),Np=jp(`var(--`),Pp=e=>Np(e)?Fp.test(e.split(`/*`)[0].trim()):!1,Fp=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ip(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Lp={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Rp={...Lp,transform:e=>If(0,1,e)},zp={...Lp,default:1},Bp=e=>Math.round(e*1e5)/1e5,Vp=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Hp(e){return e==null}var Up=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Wp=(e,t)=>n=>!!(typeof n==`string`&&Up.test(n)&&n.startsWith(e)||t&&!Hp(n)&&Object.prototype.hasOwnProperty.call(n,t)),Gp=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Vp);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},eee=e=>If(0,255,e),Kp={...Lp,transform:e=>Math.round(eee(e))},qp={test:Wp(`rgb`,`red`),parse:Gp(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Kp.transform(e)+`, `+Kp.transform(t)+`, `+Kp.transform(n)+`, `+Bp(Rp.transform(r))+`)`};function Jp(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Yp={test:Wp(`#`),parse:Jp,transform:qp.transform},Xp=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Zp=Xp(`deg`),Qp=Xp(`%`),J=Xp(`px`),tee=Xp(`vh`),$p=Xp(`vw`),em={...Qp,parse:e=>Qp.parse(e)/100,transform:e=>Qp.transform(e*100)},tm={test:Wp(`hsl`,`hue`),parse:Gp(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Qp.transform(Bp(t))+`, `+Qp.transform(Bp(n))+`, `+Bp(Rp.transform(r))+`)`},nm={test:e=>qp.test(e)||Yp.test(e)||tm.test(e),parse:e=>qp.test(e)?qp.parse(e):tm.test(e)?tm.parse(e):Yp.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?qp.transform(e):tm.transform(e),getAnimatableNone:e=>{let t=nm.parse(e);return t.alpha=0,nm.transform(t)}},rm=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function im(e){return isNaN(e)&&typeof e==`string`&&(e.match(Vp)?.length||0)+(e.match(rm)?.length||0)>0}var am=`number`,om=`color`,sm=`var`,cm=`var(`,lm="${}",um=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function dm(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(um,e=>(nm.test(e)?(r.color.push(a),i.push(om),n.push(nm.parse(e))):e.startsWith(cm)?(r.var.push(a),i.push(sm),n.push(e)):(r.number.push(a),i.push(am),n.push(parseFloat(e))),++a,lm)).split(lm),indexes:r,types:i}}function fm(e){return dm(e).values}function pm({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===am?i+=Bp(r[a]):e===om?i+=nm.transform(r[a]):i+=r[a]}return i}}function mm(e){return pm(dm(e))}var hm=e=>typeof e==`number`?0:nm.test(e)?nm.getAnimatableNone(e):e,nee=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:hm(e);function ree(e){let t=dm(e);return pm(t)(t.values.map((e,n)=>nee(e,t.split[n])))}var gm={test:im,parse:fm,createTransformer:mm,getAnimatableNone:ree};function _m(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function iee({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=_m(s,r,e+1/3),a=_m(s,r,e),o=_m(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function vm(e,t){return n=>n>0?t:e}var ym=(e,t,n)=>e+(t-e)*n,bm=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},xm=[Yp,qp,tm],Sm=e=>xm.find(t=>t.test(e));function Cm(e){let t=Sm(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===tm&&(n=iee(n)),n}var wm=(e,t)=>{let n=Cm(e),r=Cm(t);if(!n||!r)return vm(e,t);let i={...n};return e=>(i.red=bm(n.red,r.red,e),i.green=bm(n.green,r.green,e),i.blue=bm(n.blue,r.blue,e),i.alpha=ym(n.alpha,r.alpha,e),qp.transform(i))},Tm=new Set([`none`,`hidden`]);function Em(e,t){return Tm.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Dm(e,t){return n=>ym(e,t,n)}function Om(e){return typeof e==`number`?Dm:typeof e==`string`?Pp(e)?vm:nm.test(e)?wm:Mm:Array.isArray(e)?km:typeof e==`object`?nm.test(e)?wm:Am:vm}function km(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Om(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Am(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Om(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function jm(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Mm=(e,t)=>{let n=gm.createTransformer(t),r=dm(e),i=dm(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Tm.has(e)&&!i.values.length||Tm.has(t)&&!r.values.length?Em(e,t):Wf(km(jm(r,i),i.values),n):(`${e}${t}`,vm(e,t))};function Nm(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?ym(e,t,n):Om(e)(e,t)}var Pm=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Cp.update(t,e),stop:()=>wp(t),now:()=>Tp.isProcessing?Tp.timestamp:kp.now()}},Fm=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Im=2e4;function Lm(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function aee(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Lm(r),Im);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Jf(i)}}var Rm={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function zm(e,t){return e*Math.sqrt(1-t*t)}var oee=12;function see(e,t,n){let r=n;for(let n=1;n<oee;n++)r-=e(r)/t(r);return r}var Bm=.001;function Vm({duration:e=Rm.duration,bounce:t=Rm.bounce,velocity:n=Rm.velocity,mass:r=Rm.mass}){let i,a;Rm.maxDuration;let o=1-t;o=If(Rm.minDamping,Rm.maxDamping,o),e=If(Rm.minDuration,Rm.maxDuration,Jf(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=zm(t,o),c=Math.exp(-i);return Bm-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=zm(t**2,o);return(-i(t)+Bm>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Bm+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=see(i,a,s);if(e=qf(e),isNaN(c))return{stiffness:Rm.stiffness,damping:Rm.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Hm=[`duration`,`bounce`],Um=[`stiffness`,`damping`,`mass`];function Wm(e,t){return t.some(t=>e[t]!==void 0)}function Gm(e){let t={velocity:Rm.velocity,stiffness:Rm.stiffness,damping:Rm.damping,mass:Rm.mass,isResolvedFromDuration:!1,...e};if(!Wm(e,Um)&&Wm(e,Hm))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*If(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Rm.mass,stiffness:i,damping:a}}else{let n=Vm({...e,velocity:0});t={...t,...n,mass:Rm.mass},t.isResolvedFromDuration=!0}return t}function Km(e=Rm.visualDuration,t=Rm.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Gm({...n,velocity:-Jf(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Jf(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Rm.restSpeed.granular:Rm.restSpeed.default,i||=v?Rm.restDelta.granular:Rm.restDelta.default;let y,b,x,S,C,w;if(h<1)x=zm(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>qf(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=qf(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=qf(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Lm(T),Im),t=Fm(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Km.applyToOptions=e=>{let t=aee(e,100,Km);return e.ease=t.ease,e.duration=qf(t.duration),e.type=`keyframes`,e};var qm=5;function Jm(e,t,n){let r=Math.max(t-qm,0);return Yf(n-e(r),t-r)}function Ym({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Km({keyframes:[f.value,m(f.value)],velocity:Jm(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Xm(e,t,n){let r=[],i=n||Lf.mix||Nm,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Wf(Array.isArray(t)?t[n]||Hf:t,a)),r.push(a)}return r}function Zm(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Xm(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Gf(e[r],e[r+1],n);return s[r](i)};return n?t=>l(If(e[0],e[a-1],t)):l}function Qm(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Gf(0,t,r);e.push(ym(n,1,i))}}function $m(e){let t=[0];return Qm(t,e.length-1),t}function eh(e,t){return e.map(e=>e*t)}function th(e,t){return e.map(()=>t||fp).splice(0,e.length-1)}function nh({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=pp(r)?r.map(_p):_p(r),a={done:!1,value:t[0]},o=Zm(eh(n&&n.length===t.length?n:$m(t),e),t,{ease:Array.isArray(i)?i:th(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var rh=e=>e!==null;function ih(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(rh),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ah={decay:Ym,inertia:Ym,tween:nh,keyframes:nh,spring:Km};function oh(e){typeof e.type==`string`&&(e.type=ah[e.type])}var sh=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},ch=e=>e/100,lh=class extends sh{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==kp.now()&&this.tick(kp.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Ap.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;oh(e);let{type:t=nh,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||nh;s!==nh&&typeof o[0]!=`number`&&(this.mixKeyframes=Wf(ch,Nm(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Lm(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=If(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Ym&&(b.value=ih(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Jf(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Jf(e)}get time(){return Jf(this.currentTime)}set time(e){e=qf(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Jm(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(kp.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Jf(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Pm,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(kp.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Ap.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function uh(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var dh=e=>e*180/Math.PI,fh=e=>mh(dh(Math.atan2(e[1],e[0]))),ph={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:fh,rotateZ:fh,skewX:e=>dh(Math.atan(e[1])),skewY:e=>dh(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},mh=e=>(e%=360,e<0&&(e+=360),e),hh=fh,gh=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),_h=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),vh={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:gh,scaleY:_h,scale:e=>(gh(e)+_h(e))/2,rotateX:e=>mh(dh(Math.atan2(e[6],e[5]))),rotateY:e=>mh(dh(Math.atan2(-e[2],e[0]))),rotateZ:hh,rotate:hh,skewX:e=>dh(Math.atan(e[4])),skewY:e=>dh(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function yh(e){return+!!e.includes(`scale`)}function bh(e,t){if(!e||e===`none`)return yh(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=vh,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=ph,i=t}if(!i)return yh(t);let a=r[t],o=i[1].split(`,`).map(Sh);return typeof a==`function`?a(o):o[a]}var xh=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return bh(n,t)};function Sh(e){return parseFloat(e.trim())}var Ch=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],wh=new Set(Ch),Th=e=>e===Lp||e===J,Eh=new Set([`x`,`y`,`z`]),Dh=Ch.filter(e=>!Eh.has(e));function Oh(e){let t=[];return Dh.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var kh={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>bh(t,`x`),y:(e,{transform:t})=>bh(t,`y`)};kh.translateX=kh.x,kh.translateY=kh.y;var Ah=new Set,jh=!1,Mh=!1,Nh=!1;function Ph(){if(Mh){let e=Array.from(Ah).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Oh(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Mh=!1,jh=!1,Ah.forEach(e=>e.complete(Nh)),Ah.clear()}function Fh(){Ah.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Mh=!0)})}function Ih(){Nh=!0,Fh(),Ph(),Nh=!1}var Lh=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Ah.add(this),jh||(jh=!0,Cp.read(Fh),Cp.resolveKeyframes(Ph))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}uh(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Ah.delete(this)}cancel(){this.state===`scheduled`&&(Ah.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Rh=e=>e.startsWith(`--`);function zh(e,t,n){Rh(t)?e.style.setProperty(t,n):e.style[t]=n}var Bh={};function Vh(e,t){let n=Vf(e);return()=>Bh[t]??n()}var Hh=Vh(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Uh=Vh(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Wh=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Gh={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Wh([0,.65,.55,1]),circOut:Wh([.55,0,1,.45]),backIn:Wh([.31,.01,.66,-.59]),backOut:Wh([.33,1.53,.69,.99])};function Kh(e,t){if(e)return typeof e==`function`?Uh()?Fm(e,t):`ease-out`:mp(e)?Wh(e):Array.isArray(e)?e.map(e=>Kh(e,t)||Gh.easeOut):Gh[e]}function qh(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Kh(s,i);Array.isArray(d)&&(u.easing=d),yp.value&&Ap.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return yp.value&&p.finished.finally(()=>{Ap.waapi--}),p}function Jh(e){return typeof e==`function`&&`applyToOptions`in e}function Yh({type:e,...t}){return Jh(e)&&Uh()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Xh=class extends sh{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Yh(e);this.animation=qh(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=ih(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),zh(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Jf(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Jf(e)}get time(){return Jf(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=qf(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Hh()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Hf):r(this)}},Zh={anticipate:op,backInOut:ap,circInOut:lp};function Qh(e){return e in Zh}function $h(e){typeof e.ease==`string`&&Qh(e.ease)&&(e.ease=Zh[e.ease])}var eg=10,tg=class extends Xh{constructor(e){$h(e),oh(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new lh({...a,autoplay:!1}),s=Math.max(eg,kp.now()-this.startTime),c=If(0,eg,s-eg),l=o.sample(s).value,{name:u}=this.options;i&&u&&zh(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},ng=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(gm.test(e)||e===`0`)&&!e.startsWith(`url(`));function cee(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function lee(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=ng(i,t),s=ng(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:cee(e)||(n===`spring`||Jh(n))&&r}function rg(e){e.duration=0,e.type=`keyframes`}var ig=new Set([`opacity`,`clipPath`,`filter`,`transform`]),uee=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function dee(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&uee.test(e[t]))return!0;return!1}var fee=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),pee=Vf(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function mee(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return pee()&&n&&(ig.has(n)||fee.has(n)&&dee(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var hee=40,gee=class extends sh{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=kp.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Lh)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=kp.now();let u=!0;lee(e,i,a,o)||(u=!1,(Lf.instantAnimations||!s)&&l?.(ih(e,n,t)),e[0]=e[e.length-1],rg(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>hee?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&mee(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new tg({...d,element:p})}catch{m=new lh(d)}else m=new lh(d);m.finished.then(()=>{this.notifyFinished()}).catch(Hf),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Ih()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function ag(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var _ee=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vee(e){let t=_ee.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function og(e,t,n=1){`${e}`;let[r,i]=vee(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Rf(e)?parseFloat(e):e}return Pp(i)?og(i,t,n+1):i}var yee={type:`spring`,stiffness:500,damping:25,restSpeed:10},bee=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),xee={type:`keyframes`,duration:.8},See={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Cee=(e,{keyframes:t})=>t.length>2?xee:wh.has(e)?e.startsWith(`scale`)?bee(t[1]):yee:See;function sg(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function cg(e,t){let n=e?.[t]??e?.default??e;return n===e?n:sg(n,e)}var wee=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Tee(e){for(let t in e)if(!wee.has(t))return!0;return!1}var lg=(e,t,n,r={},i,a)=>o=>{let s=cg(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=qf(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Tee(s)||Object.assign(u,Cee(e,u)),u.duration&&=qf(u.duration),u.repeatDelay&&=qf(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(rg(u),u.delay===0&&(d=!0)),(Lf.instantAnimations||Lf.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,rg(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=ih(u.keyframes,s);if(e!==void 0){Cp.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new lh(u):new gee(u)};function ug(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function dg(e,t,n,r){if(typeof t==`function`){let[i,a]=ug(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=ug(r);t=t(n===void 0?e.custom:n,i,a)}return t}function fg(e,t,n){let r=e.getProps();return dg(r,t,n===void 0?r.custom:n,e)}var pg=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Ch]),mg=30,hg=e=>!isNaN(parseFloat(e)),gg={current:void 0},_g=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=kp.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=kp.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=hg(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Kf);let n=this.events[e].add(t);return e===`change`?()=>{n(),Cp.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return gg.current&&gg.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=kp.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>mg)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,mg);return Yf(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function vg(e,t){return new _g(e,t)}var yg=e=>Array.isArray(e);function bg(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,vg(n))}function xg(e){return yg(e)?e[e.length-1]||0:e}function Eee(e,t){let{transitionEnd:n={},transition:r={},...i}=fg(e,t)||{};i={...i,...n};for(let t in i)bg(e,t,xg(i[t]))}var Sg=e=>!!(e&&e.getVelocity);function Dee(e){return!!(Sg(e)&&e.add)}function Cg(e,t){let n=e.getValue(`willChange`);if(Dee(n))return n.add(t);if(!n&&Lf.WillChange){let n=new Lf.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function wg(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Tg=`data-`+wg(`framerAppearId`);function Eg(e){return e.props[Tg]}function Dg({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Og(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?sg(a,c):c;let l=a?.reduceMotion;r&&(a=r);let u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||d&&Dg(d,t))continue;let o={delay:n,...cg(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){Cp.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=Eg(e);if(n){let e=window.MotionHandoffAnimation(n,t,Cp);e!==null&&(o.startTime=e,f=!0)}}Cg(e,t);let p=l??e.shouldReduceMotion;r.start(lg(t,r,i,p&&pg.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>Cp.update(()=>{o&&Eee(e,o)});u.length?Promise.all(u).then(t):t()}return u}function kg(e,t,n={}){let r=fg(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Og(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Oee(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function Oee(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(kg(c,t,{...o,delay:n+(typeof r==`function`?0:r)+ag(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function kee(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>kg(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=kg(e,t,n);else{let i=typeof t==`function`?fg(e,t,n.custom):t;r=Promise.all(Og(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Aee={test:e=>e===`auto`,parse:e=>e},Ag=e=>t=>t.test(e),jg=[Lp,J,Qp,Zp,$p,tee,Aee],Mg=e=>jg.find(Ag(e));function Ng(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Bf(e)}var Pg=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Fg(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Vp)||[];if(!r)return e;let i=n.replace(r,``),a=+!!Pg.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Ig=/\b([a-z-]*)\(.*?\)/gu,Lg={...gm,getAnimatableNone:e=>{let t=e.match(Ig);return t?t.map(Fg).join(` `):e}},Rg={...gm,getAnimatableNone:e=>{let t=gm.parse(e);return gm.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},zg={...Lp,transform:Math.round},Bg={borderWidth:J,borderTopWidth:J,borderRightWidth:J,borderBottomWidth:J,borderLeftWidth:J,borderRadius:J,borderTopLeftRadius:J,borderTopRightRadius:J,borderBottomRightRadius:J,borderBottomLeftRadius:J,width:J,maxWidth:J,height:J,maxHeight:J,top:J,right:J,bottom:J,left:J,inset:J,insetBlock:J,insetBlockStart:J,insetBlockEnd:J,insetInline:J,insetInlineStart:J,insetInlineEnd:J,padding:J,paddingTop:J,paddingRight:J,paddingBottom:J,paddingLeft:J,paddingBlock:J,paddingBlockStart:J,paddingBlockEnd:J,paddingInline:J,paddingInlineStart:J,paddingInlineEnd:J,margin:J,marginTop:J,marginRight:J,marginBottom:J,marginLeft:J,marginBlock:J,marginBlockStart:J,marginBlockEnd:J,marginInline:J,marginInlineStart:J,marginInlineEnd:J,fontSize:J,backgroundPositionX:J,backgroundPositionY:J,rotate:Zp,rotateX:Zp,rotateY:Zp,rotateZ:Zp,scale:zp,scaleX:zp,scaleY:zp,scaleZ:zp,skew:Zp,skewX:Zp,skewY:Zp,distance:J,translateX:J,translateY:J,translateZ:J,x:J,y:J,z:J,perspective:J,transformPerspective:J,opacity:Rp,originX:em,originY:em,originZ:J,zIndex:zg,fillOpacity:Rp,strokeOpacity:Rp,numOctaves:zg},jee={...Bg,color:nm,backgroundColor:nm,outlineColor:nm,fill:nm,stroke:nm,borderColor:nm,borderTopColor:nm,borderRightColor:nm,borderBottomColor:nm,borderLeftColor:nm,filter:Lg,WebkitFilter:Lg,mask:Rg,WebkitMask:Rg},Vg=e=>jee[e],Hg=new Set([Lg,Rg]);function Ug(e,t){let n=Vg(e);return Hg.has(n)||(n=gm),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Wg=new Set([`auto`,`none`,`0`]);function Gg(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Wg.has(t)&&dm(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Ug(n,i)}var Kg=class extends Lh{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Pp(r))){let i=og(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!pg.has(n)||e.length!==2)return;let[r,i]=e,a=Mg(r),o=Mg(i);if(Ip(r)!==Ip(i)&&kh[n]){this.needsMeasurement=!0;return}if(a!==o)if(Th(a)&&Th(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else kh[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Ng(e[t]))&&n.push(t);n.length&&Gg(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=kh[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=kh[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function qg(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var Jg=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Yg(e){return zf(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Xg,cancel:Mee}=Sp(queueMicrotask,!1),Zg={x:!1,y:!1};function Qg(){return Zg.x||Zg.y}function Nee(e){return e===`x`||e===`y`?Zg[e]?null:(Zg[e]=!0,()=>{Zg[e]=!1}):Zg.x||Zg.y?null:(Zg.x=Zg.y=!0,()=>{Zg.x=Zg.y=!1})}function $g(e,t){let n=qg(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Pee(e){return!(e.pointerType===`touch`||Qg())}function Fee(e,t,n={}){let[r,i,a]=$g(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Pee(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var e_=(e,t)=>t?e===t?!0:e_(e,t.parentElement):!1,t_=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,n_=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function r_(e){return n_.has(e.tagName)||e.isContentEditable===!0}var i_=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function a_(e){return i_.has(e.tagName)||e.isContentEditable===!0}var o_=new WeakSet;function s_(e){return t=>{t.key===`Enter`&&e(t)}}function c_(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var l_=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=s_(()=>{if(o_.has(n))return;c_(n,`down`);let e=s_(()=>{c_(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>c_(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function u_(e){return t_(e)&&!Qg()}var d_=new WeakSet;function f_(e,t,n={}){let[r,i,a]=$g(e,n),o=e=>{let r=e.currentTarget;if(!u_(e)||d_.has(e))return;o_.add(r),n.stopPropagation&&d_.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),o_.has(r)&&o_.delete(r),u_(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||e_(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Yg(e)&&(e.addEventListener(`focus`,e=>l_(e,i)),!r_(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function p_(e){return zf(e)&&`ownerSVGElement`in e}var m_=new WeakMap,h_,g_=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:p_(r)&&`getBBox`in r?r.getBBox()[t]:r[n],__=g_(`inline`,`width`,`offsetWidth`),v_=g_(`block`,`height`,`offsetHeight`);function y_({target:e,borderBoxSize:t}){m_.get(e)?.forEach(n=>{n(e,{get width(){return __(e,t)},get height(){return v_(e,t)}})})}function b_(e){e.forEach(y_)}function x_(){typeof ResizeObserver>`u`||(h_=new ResizeObserver(b_))}function S_(e,t){h_||x_();let n=qg(e);return n.forEach(e=>{let n=m_.get(e);n||(n=new Set,m_.set(e,n)),n.add(t),h_?.observe(e)}),()=>{n.forEach(e=>{let n=m_.get(e);n?.delete(t),n?.size||h_?.unobserve(e)})}}var C_=new Set,w_;function T_(){w_=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};C_.forEach(t=>t(e))},window.addEventListener(`resize`,w_)}function E_(e){return C_.add(e),w_||T_(),()=>{C_.delete(e),!C_.size&&typeof w_==`function`&&(window.removeEventListener(`resize`,w_),w_=void 0)}}function D_(e,t){return typeof e==`function`?E_(e):S_(e,t)}function O_(e){return p_(e)&&e.tagName===`svg`}var k_=[...jg,nm,gm],A_=e=>k_.find(Ag(e)),j_=()=>({translate:0,scale:1,origin:0,originPoint:0}),M_=()=>({x:j_(),y:j_()}),N_=()=>({min:0,max:0}),P_=()=>({x:N_(),y:N_()}),F_=new WeakMap;function I_(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function L_(e){return typeof e==`string`||Array.isArray(e)}var R_=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],z_=[`initial`,...R_];function B_(e){return I_(e.animate)||z_.some(t=>L_(e[t]))}function V_(e){return!!(B_(e)||e.variants)}function H_(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Sg(i))e.addValue(r,i);else if(Sg(a))e.addValue(r,vg(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,vg(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var U_={current:null},W_={current:!1},G_=typeof window<`u`;function K_(){if(W_.current=!0,G_)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>U_.current=e.matches;e.addEventListener(`change`,t),t()}else U_.current=!1}var q_=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],J_={};function Y_(e){J_=e}function X_(){return J_}var Iee=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Lh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=kp.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Cp.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=B_(t),this.isVariantNode=V_(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&Sg(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,F_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(W_.current||K_(),this.shouldReduceMotion=U_.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),wp(this.notifyUpdate),wp(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&ig.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Xh({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:qf(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=wh.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Cp.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in J_){let t=J_[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):P_()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<q_.length;t++){let n=q_[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=H_(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=vg(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(Rf(n)||Bf(n))?n=parseFloat(n):!A_(n)&&gm.test(t)&&(n=Ug(e,t)),this.setBaseTarget(e,Sg(n)?n.get():n)),Sg(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=dg(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Sg(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new Kf),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Xg.render(this.render)}},Z_=class extends Iee{constructor(){super(...arguments),this.KeyframeResolver=Kg}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Sg(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Q_=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function $_({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Lee({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ree(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function ev(e){return e===void 0||e===1}function tv({scale:e,scaleX:t,scaleY:n}){return!ev(e)||!ev(t)||!ev(n)}function nv(e){return tv(e)||rv(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function rv(e){return iv(e.x)||iv(e.y)}function iv(e){return e&&e!==`0%`}function av(e,t,n){return n+t*(e-n)}function ov(e,t,n,r,i){return i!==void 0&&(e=av(e,i,r)),av(e,n,r)+t}function sv(e,t=0,n=1,r,i){e.min=ov(e.min,t,n,r,i),e.max=ov(e.max,t,n,r,i)}function cv(e,{x:t,y:n}){sv(e.x,t.translate,t.scale,t.originPoint),sv(e.y,n.translate,n.scale,n.originPoint)}var lv=.999999999999,uv=1.0000000000001;function dv(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(fv(e.x,-a.scroll.offset.x),fv(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,cv(e,o)),r&&nv(a.latestValues)&&hv(e,a.latestValues,a.layout?.layoutBox))}t.x<uv&&t.x>lv&&(t.x=1),t.y<uv&&t.y>lv&&(t.y=1)}function fv(e,t){e.min+=t,e.max+=t}function pv(e,t,n,r,i=.5){sv(e,t,n,ym(e.min,e.max,i),r)}function mv(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function hv(e,t,n){let r=n??e;pv(e.x,mv(t.x,r.x),t.scaleX,t.scale,t.originX),pv(e.y,mv(t.y,r.y),t.scaleY,t.scale,t.originY)}function gv(e,t){return $_(Ree(e.getBoundingClientRect(),t))}function _v(e,t,n){let r=gv(e,n),{scroll:i}=t;return i&&(fv(r.x,i.offset.x),fv(r.y,i.offset.y)),r}var vv={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},yv=Ch.length;function bv(e,t,n){let r=``,i=!0;for(let a=0;a<yv;a++){let o=Ch[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=Jg(s,Bg[o]);if(!c){i=!1;let t=vv[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function xv(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(wh.has(e)){o=!0;continue}else if(Mp(e)){i[e]=n;continue}else{let t=Jg(n,Bg[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=bv(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function Sv(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Cv(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var wv={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(J.test(e))e=parseFloat(e);else return e;return`${Cv(e,t.target.x)}% ${Cv(e,t.target.y)}%`}},Tv={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=gm.parse(e);if(i.length>5)return r;let a=gm.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=ym(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Ev={borderRadius:{...wv,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:wv,borderTopRightRadius:wv,borderBottomLeftRadius:wv,borderBottomRightRadius:wv,boxShadow:Tv};function Dv(e,{layout:t,layoutId:n}){return wh.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ev[e]||e===`opacity`)}function Ov(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Sg(r[t])||i&&Sg(i[t])||Dv(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function kv(e){return window.getComputedStyle(e)}var Av=class extends Z_{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Sv}readValueFromInstance(e,t){if(wh.has(t))return this.projection?.isProjecting?yh(t):xh(e,t);{let n=kv(e),r=(Mp(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return gv(e,t)}build(e,t,n){xv(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Ov(e,t,n)}},jv={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Mv={offset:`strokeDashoffset`,array:`strokeDasharray`};function Nv(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?jv:Mv;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Pv=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Fv(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(xv(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Pv)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Nv(d,i,a,o,!1)}var Iv=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Lv=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Rv(e,t,n,r){Sv(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Iv.has(n)?n:wg(n),t.attrs[n])}function zv(e,t,n){let r=Ov(e,t,n);for(let n in e)if(Sg(e[n])||Sg(t[n])){let t=Ch.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Bv=class extends Z_{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=P_}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(wh.has(t)){let e=Vg(t);return e&&e.default||0}return t=Iv.has(t)?t:wg(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return zv(e,t,n)}build(e,t,n){Fv(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Rv(e,t,n,r)}mount(e){this.isSVGTag=Lv(e.tagName),super.mount(e)}},Vv=z_.length;function Hv(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Hv(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Vv;n++){let r=z_[n],i=e.props[r];(L_(i)||i===!1)&&(t[r]=i)}return t}function Uv(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var Wv=[...R_].reverse(),Gv=R_.length;function Kv(e){return t=>Promise.all(t.map(({animation:t,options:n})=>kee(e,t,n)))}function qv(e){let t=Kv(e),n=Xv(),r=!0,i=!1,a=t=>(n,r)=>{let i=fg(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=Hv(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<Gv;t++){let p=Wv[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=L_(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||I_(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Jv(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=yg(t)&&yg(n)?!Uv(t,n):t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=fg(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=ag(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=fg(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Xv(),i=!0}}}function Jv(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Uv(t,e):!1}function Yv(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Xv(){return{animate:Yv(!0),whileInView:Yv(),whileHover:Yv(),whileTap:Yv(),whileDrag:Yv(),whileFocus:Yv(),exit:Yv()}}function Zv(e,t){e.min=t.min,e.max=t.max}function Qv(e,t){Zv(e.x,t.x),Zv(e.y,t.y)}function $v(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var ey=1e-4,ty=1-ey,ny=1+ey,ry=.01,iy=0-ry,ay=0+ry;function oy(e){return e.max-e.min}function sy(e,t,n){return Math.abs(e-t)<=n}function cy(e,t,n,r=.5){e.origin=r,e.originPoint=ym(t.min,t.max,e.origin),e.scale=oy(n)/oy(t),e.translate=ym(n.min,n.max,e.origin)-e.originPoint,(e.scale>=ty&&e.scale<=ny||isNaN(e.scale))&&(e.scale=1),(e.translate>=iy&&e.translate<=ay||isNaN(e.translate))&&(e.translate=0)}function ly(e,t,n,r){cy(e.x,t.x,n.x,r?r.originX:void 0),cy(e.y,t.y,n.y,r?r.originY:void 0)}function uy(e,t,n,r=0){e.min=(r?ym(n.min,n.max,r):n.min)+t.min,e.max=e.min+oy(t)}function dy(e,t,n,r){uy(e.x,t.x,n.x,r?.x),uy(e.y,t.y,n.y,r?.y)}function fy(e,t,n,r=0){let i=r?ym(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+oy(t)}function py(e,t,n,r){fy(e.x,t.x,n.x,r?.x),fy(e.y,t.y,n.y,r?.y)}function my(e,t,n,r,i){return e-=t,e=av(e,1/n,r),i!==void 0&&(e=av(e,1/i,r)),e}function hy(e,t=0,n=1,r=.5,i,a=e,o=e){if(Qp.test(t)&&(t=parseFloat(t),t=ym(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=ym(a.min,a.max,r);e===a&&(s-=t),e.min=my(e.min,t,n,s,i),e.max=my(e.max,t,n,s,i)}function gy(e,t,[n,r,i],a,o){hy(e,t[n],t[r],t[i],t.scale,a,o)}var _y=[`x`,`scaleX`,`originX`],vy=[`y`,`scaleY`,`originY`];function yy(e,t,n,r){gy(e.x,t,_y,n?n.x:void 0,r?r.x:void 0),gy(e.y,t,vy,n?n.y:void 0,r?r.y:void 0)}function by(e){return e.translate===0&&e.scale===1}function xy(e){return by(e.x)&&by(e.y)}function Sy(e,t){return e.min===t.min&&e.max===t.max}function Cy(e,t){return Sy(e.x,t.x)&&Sy(e.y,t.y)}function wy(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Ty(e,t){return wy(e.x,t.x)&&wy(e.y,t.y)}function Ey(e){return oy(e.x)/oy(e.y)}function Dy(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Oy(e){return[e(`x`),e(`y`)]}function ky(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Ay=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],jy=Ay.length,My=e=>typeof e==`string`?parseFloat(e):e,Ny=e=>typeof e==`number`||J.test(e);function Py(e,t,n,r,i,a){i?(e.opacity=ym(0,n.opacity??1,Iy(r)),e.opacityExit=ym(t.opacity??1,0,Ly(r))):a&&(e.opacity=ym(t.opacity??1,n.opacity??1,r));for(let i=0;i<jy;i++){let a=Ay[i],o=Fy(t,a),s=Fy(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Ny(o)===Ny(s)?(e[a]=Math.max(ym(My(o),My(s),r),0),(Qp.test(s)||Qp.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=ym(t.rotate||0,n.rotate||0,r))}function Fy(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Iy=Ry(0,.5,cp),Ly=Ry(.5,.95,Hf);function Ry(e,t,n){return r=>r<e?0:r>t?1:n(Gf(e,t,r))}function zy(e,t,n){let r=Sg(e)?e:vg(e);return r.start(lg(``,r,t,n)),r.animation}function By(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Vy=(e,t)=>e.depth-t.depth,Hy=class{constructor(){this.children=[],this.isDirty=!1}add(e){Pf(this.children,e),this.isDirty=!0}remove(e){Ff(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Vy),this.isDirty=!1,this.children.forEach(e)}};function Uy(e,t){let n=kp.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(wp(r),e(a-t))};return Cp.setup(r,!0),()=>wp(r)}function Wy(e){return Sg(e)?e.get():e}var Gy=class{constructor(){this.members=[]}add(e){Pf(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Ff(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Ff(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Ky={hasAnimatedSinceResize:!0,hasEverUpdated:!1},qy={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Jy=[``,`X`,`Y`,`Z`],Yy=1e3,Xy=0;function Zy(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Qy(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Eg(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Cp,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Qy(r)}function $y({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=Xy++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,yp.value&&(qy.nodes=qy.calculatedTargetDeltas=qy.calculatedProjections=0),this.nodes.forEach(Vee),this.nodes.forEach(qee),this.nodes.forEach(Jee),this.nodes.forEach(Hee),yp.addProjectionMetrics&&yp.addProjectionMetrics(qy)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Hy)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Kf),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=p_(t)&&!O_(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;Cp.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Uy(i,250),Ky.hasAnimatedSinceResize&&(Ky.hasAnimatedSinceResize=!1,this.nodes.forEach(nb)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||$ee,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Ty(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...cg(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||nb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wp(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Yee),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Qy(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(Wee),this.nodes.forEach(eb);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(tb);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Gee),this.nodes.forEach(Kee),this.nodes.forEach(zee),this.nodes.forEach(Bee)):this.nodes.forEach(tb),this.clearAllSnapshots();let e=kp.now();Tp.delta=If(0,1e3/60,e-Tp.timestamp),Tp.timestamp=e,Tp.isProcessing=!0,Ep.update.process(Tp),Ep.preRender.process(Tp),Ep.render.process(Tp),Tp.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Xg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Uee),this.sharedNodes.forEach(Xee)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Cp.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Cp.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!oy(this.snapshot.measuredBox.x)&&!oy(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=P_(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!xy(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||nv(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),ete(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return P_();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(tte))){let{scroll:e}=this.root;e&&(fv(t.x,e.offset.x),fv(t.y,e.offset.y))}return t}removeElementScroll(e){let t=P_();if(Qv(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Qv(t,e),fv(t.x,i.offset.x),fv(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||P_();Qv(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(fv(r.x,-n.scroll.offset.x),fv(r.y,-n.scroll.offset.y)),nv(n.latestValues)&&hv(r,n.latestValues,n.layout?.layoutBox)}return nv(this.latestValues)&&hv(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=P_();Qv(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!nv(n.latestValues))continue;let r;n.instance&&(tv(n.latestValues)&&n.updateSnapshot(),r=P_(),Qv(r,n.measurePageBox())),yy(t,n.latestValues,n.snapshot?.layoutBox,r)}return nv(this.latestValues)&&yy(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Tp.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=Tp.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=P_(),this.targetWithTransforms=P_()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),dy(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Qv(this.target,this.layout.layoutBox),cv(this.target,this.targetDelta)):Qv(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),yp.value&&qy.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||tv(this.parent.latestValues)||rv(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=P_(),this.relativeTargetOrigin=P_(),py(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),Qv(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===Tp.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Qv(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;dv(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=P_());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():($v(this.prevProjectionDelta.x,this.projectionDelta.x),$v(this.prevProjectionDelta.y,this.projectionDelta.y)),ly(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Dy(this.projectionDelta.x,this.prevProjectionDelta.x)||!Dy(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),yp.value&&qy.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=M_(),this.projectionDelta=M_(),this.projectionDeltaWithTransform=M_()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=M_();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=P_(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(Qee));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;rb(a.x,e.x,n),rb(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(py(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Zee(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&Cy(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=P_(),Qv(d,this.relativeTarget)),s&&(this.animationValues=i,Py(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(wp(this.pendingAnimation),void 0),this.pendingAnimation=Cp.update(()=>{Ky.hasAnimatedSinceResize=!0,Ap.layout++,this.motionValue||=vg(0),this.motionValue.jump(0,!1),this.currentAnimation=zy(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{Ap.layout--},onComplete:()=>{Ap.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Yy),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&cb(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||P_();let t=oy(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=oy(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Qv(t,n),hv(t,i),ly(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Gy),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&Zy(`z`,e,r,this.animationValues);for(let t=0;t<Jy.length;t++)Zy(`rotate${Jy[t]}`,e,r,this.animationValues),Zy(`skew${Jy[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=Wy(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=Wy(t?.pointerEvents)||``),this.hasProjected&&!nv(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=ky(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Ev){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Ev[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?Wy(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(eb),this.root.sharedNodes.clear()}}}function zee(e){e.updateLayout()}function Bee(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)Oy(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=oy(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Zv(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else cb(i,t.layoutBox,n)&&Oy(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=oy(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=M_();ly(o,n,t.layoutBox);let s=M_();a?ly(s,e.applyTransform(r,!0),t.measuredBox):ly(s,n,t.layoutBox);let c=!xy(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=P_();py(s,t.layoutBox,i.layoutBox,o);let c=P_();py(c,n,a.layoutBox,o),Ty(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Vee(e){yp.value&&qy.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Hee(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Uee(e){e.clearSnapshot()}function eb(e){e.clearMeasurements()}function Wee(e){e.isLayoutDirty=!0,e.updateLayout()}function tb(e){e.isLayoutDirty=!1}function Gee(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Kee(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function nb(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function qee(e){e.resolveTargetDelta()}function Jee(e){e.calcProjection()}function Yee(e){e.resetSkewAndRotation()}function Xee(e){e.removeLeadSnapshot()}function rb(e,t,n){e.translate=ym(t.translate,0,n),e.scale=ym(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function ib(e,t,n,r){e.min=ym(t.min,n.min,r),e.max=ym(t.max,n.max,r)}function Zee(e,t,n,r){ib(e.x,t.x,n.x,r),ib(e.y,t.y,n.y,r)}function Qee(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var $ee={duration:.45,ease:[.4,0,.1,1]},ab=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),ob=ab(`applewebkit/`)&&!ab(`chrome/`)?Math.round:Hf;function sb(e){e.min=ob(e.min),e.max=ob(e.max)}function ete(e){sb(e.x),sb(e.y)}function cb(e,t,n){return e===`position`||e===`preserve-aspect`&&!sy(Ey(t),Ey(n),.2)}function tte(e){return e!==e.root&&e.scroll?.wasRoot}var nte=$y({attachResizeListener:(e,t)=>By(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),lb={current:void 0},ub=$y({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!lb.current){let e=new nte({});e.mount(window),e.setOptions({layoutScroll:!0}),lb.current=e}return lb.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),db=(0,L.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function fb(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function rte(...e){return t=>{let n=!1,r=e.map(e=>{let r=fb(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():fb(e[t],null)}}}}function ite(...e){return L.useCallback(rte(...e),e)}var ate=class extends L.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Yg(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Yg(e)&&e.offsetWidth||0,r=Yg(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}};function ote({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,L.useId)(),s=(0,L.useRef)(null),c=(0,L.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:l}=(0,L.useContext)(db),u=ite(s,e.props?.ref??e?.ref);return(0,L.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m}=c.current;if(t||a===!1||!s.current||!e||!u)return;let h=n===`left`?`left: ${f}`:`right: ${p}`,g=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let _=document.createElement(`style`);l&&(_.nonce=l);let v=i??document.head;return v.appendChild(_),_.sheet&&_.sheet.insertRule(`
20
20
  [data-motion-pop-id="${o}"] {
21
21
  position: absolute !important;
22
22
  width: ${e}px !important;
@@ -64,10 +64,14 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
64
64
  font-weight: bold;
65
65
  color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return o.updateDeps=e=>{r=e},o}function O4(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var k4=(e,t)=>Math.abs(e-t)<1.01,A4=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},j4=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},M4=e=>e,N4=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},P4=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(j4(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(j4(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},F4={passive:!0},I4=typeof window>`u`?!0:`onscrollend`in window,L4=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&I4?()=>void 0:A4(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{let{horizontal:o,isRtl:s}=e.options;i=o?n.scrollLeft*(s&&-1||1):n.scrollTop,a(),t(i,r)},s=o(!0),c=o(!1);n.addEventListener(`scroll`,s,F4);let l=e.options.useScrollendEvent&&I4;return l&&n.addEventListener(`scrollend`,c,F4),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},R4=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},z4=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},B4=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:M4,rangeExtractor:N4,onChange:()=>{},measureElement:R4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,...e}},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=D4(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=D4(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=D4(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let l=this.measurementsCache.slice(0,c),u=Array(a).fill(void 0);for(let e=0;e<c;e++){let t=l[e];t&&(u[t.lane]=e)}for(let i=c;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),c,d,f=o===`estimate`||s.has(e);if(a!==void 0&&this.options.lanes>1){c=a;let e=u[c],r=e===void 0?void 0:l[e];d=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?l[i-1]:this.getFurthestMeasurement(l,i);d=e?e.end+this.options.gap:t+n,c=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,c)}let p=s.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=d+m;l[i]={index:i,start:d,size:m,end:h,key:e,lane:c},u[c]=i}return this.measurementsCache=l,l},{key:!1,debug:()=>this.options.debug}),this.calculateRange=D4(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?H4({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=D4(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{let n=this.measurementsCache[e];if(!n)return;let r=t-(this.itemSizeCache.get(n.key)??n.size);r!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?n.start<this.getScrollOffset()+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this))&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.getVirtualItems=D4(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length!==0)return O4(t[V4(0,t.length-1,e=>O4(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=e[e.length-1]?.end??0;else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&k4(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,n&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior=`auto`,this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}));this.scheduleScrollReconcile()}},V4=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function H4({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){let i=e.length-1,a=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let o=V4(0,i,a,n),s=o;if(r===1)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){let a=Array(r).fill(0);for(;s<i&&a.some(e=>e<n+t);){let t=e[s];a[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(i,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var U4=typeof document<`u`?L.useLayoutEffect:L.useEffect;function W4({useFlushSync:e=!0,...t}){let n=L.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,rl.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=L.useState(()=>new B4(r));return i.setOptions(r),U4(()=>i._didMount(),[]),U4(()=>i._willUpdate()),i}function G4(e){return W4({observeElementRect:P4,observeElementOffset:L4,scrollToFn:z4,...e})}function K4(e,t,n){let r=e=>{let t=e==null?``:String(e);return t.includes(`,`)||t.includes(`"`)||t.includes(`
66
66
  `)?`"${t.replace(/"/g,`""`)}"`:t},i=[t.map(r).join(`,`),...n.map(e=>e.map(r).join(`,`))].join(`
67
- `),a=new Blob([``+i],{type:`text/csv;charset=utf-8;`}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=e,s.click(),URL.revokeObjectURL(o)}function q4({message:e=`加载失败,请重试`,onRetry:t}){return(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-96 text-center px-4`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-16 h-16 rounded-full bg-red-50 mb-4`,children:(0,R.jsx)(Ws,{className:`h-8 w-8 text-red-500`})}),(0,R.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 mb-2`,children:`出错了`}),(0,R.jsx)(`p`,{className:`text-sm text-gray-500 mb-6 max-w-md`,children:e}),t&&(0,R.jsx)(Y,{variant:`primary`,size:`sm`,icon:Pc,onClick:t,children:`重试`})]})}function J4(e,t){let n=t.getTime()-e.getTime();if(n<0)return`-`;let r=Math.floor(n/6e4),i=Math.floor(r/60);return i>0?`${i}h ${r%60}m`:r>0?`${r}m`:`${Math.floor(n/1e3)}s`}function Y4(){let e=Ye(),[t,n]=(0,L.useState)(``),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(`all`),[l,u]=(0,L.useState)(new Set),[d,f]=(0,L.useState)(`start_time`),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),y=Fn(),b=(0,L.useRef)(null),{data:x,isLoading:S,isError:C,refetch:w}=ut({queryKey:[`sessions`,{limit:1e3,status:r||void 0}],queryFn:()=>dl({limit:1e3,status:r||void 0}).then(e=>e.data),refetchInterval:1e4}),T=z({mutationFn:e=>pl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}}),E=z({mutationFn:e=>ml(e),onSuccess:()=>{u(new Set),e.invalidateQueries({queryKey:[`sessions`]})}}),D=(x?.items.filter(e=>{let n=e.session_id.toLowerCase().includes(t.toLowerCase())||e.project_path.toLowerCase().includes(t.toLowerCase()),r=!a||e.project_path.split(`/`).pop()===a,i=s===`all`||new Date(e.start_time)>=C4(new Date,s===`1d`?1:s===`7d`?7:30);return n&&r&&i})||[]).sort((e,t)=>{let n=0;return d===`start_time`?n=e.start_time.localeCompare(t.start_time):d===`event_count`?n=e.event_count-t.event_count:d===`duration`&&(n=(e.end_time?new Date(e.end_time).getTime()-new Date(e.start_time).getTime():1/0)-(t.end_time?new Date(t.end_time).getTime()-new Date(t.start_time).getTime():1/0)),p?n:-n}),O=Array.from(new Set(x?.items.map(e=>e.project_path.split(`/`).pop()||``).filter(Boolean)||[])),k=e=>{d===e?m(e=>!e):(f(e),m(!1))},A=G4({count:D.length,getScrollElement:()=>b.current,estimateSize:()=>72,overscan:10}),j=()=>{let e=[`Session ID`,`项目`,`状态`,`开始时间`,`结束时间`,`事件数`],t=D.map(e=>[e.session_id,e.project_path,e.status,e.start_time,e.end_time||``,e.event_count]);K4(`sessions-${x4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)};return S?(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})}):C?(0,R.jsx)(q4,{message:`会话数据加载失败`,onRetry:()=>w()}):(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`搜索会话 ID 或项目...`,value:t,onChange:e=>n(e.target.value),className:`w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,R.jsxs)(`button`,{onClick:()=>g(e=>!e),className:q(`flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border transition-colors`,h||r||a||s!==`all`?`border-blue-300 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:bg-gray-50`),children:[(0,R.jsx)(fc,{className:`h-4 w-4`}),`筛选`,(r||a||s!==`all`)&&(0,R.jsx)(`span`,{className:`ml-1 px-1.5 py-0.5 bg-blue-600 text-white text-xs rounded-full`,children:[r,a,s===`all`?``:s].filter(Boolean).length}),(0,R.jsx)(Bs,{className:q(`h-3.5 w-3.5 transition-transform`,h&&`rotate-180`)})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[l.size>0&&(0,R.jsxs)(Y,{variant:`danger`,size:`sm`,icon:Jc,onClick:()=>{v({open:!0,title:`批量删除会话`,description:`确定删除选中的 ${l.size} 个会话吗?此操作不可撤销。`,count:l.size,onConfirm:()=>{E.mutate(Array.from(l)),v(e=>({...e,open:!1}))}})},loading:E.isPending,children:[`删除 (`,l.size,`)`]}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:nc,onClick:()=>D.length>0&&j(),children:`导出`}),(0,R.jsx)(Y,{variant:`primary`,size:`sm`,onClick:()=>w(),children:`刷新`})]})]}),h&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 pt-2 border-t border-gray-100`,children:[(0,R.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部状态`}),(0,R.jsx)(`option`,{value:`active`,children:`活跃`}),(0,R.jsx)(`option`,{value:`completed`,children:`已完成`}),(0,R.jsx)(`option`,{value:`interrupted`,children:`中断`})]}),(0,R.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部项目`}),O.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden text-sm`,children:[(0,R.jsx)(Is,{className:`h-3.5 w-3.5 text-gray-400 ml-2`}),[`all`,`1d`,`7d`,`30d`].map(e=>(0,R.jsx)(`button`,{onClick:()=>c(e),className:q(`px-2.5 py-1.5 transition-colors`,s===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:e===`all`?`全部`:e},e))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,R.jsx)(`span`,{className:`text-gray-500 text-xs`,children:`排序:`}),[{key:`start_time`,label:`时间`},{key:`event_count`,label:`事件数`},{key:`duration`,label:`时长`}].map(({key:e,label:t})=>(0,R.jsxs)(`button`,{onClick:()=>k(e),className:q(`px-2.5 py-1.5 rounded-lg transition-colors flex items-center gap-1`,d===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:[t,d===e&&(0,R.jsx)(js,{className:q(`h-3 w-3`,p&&`rotate-180`)})]},e))]})]})]})}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:x?.total||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总会话数`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-green-600`,children:x?.items.filter(e=>e.status===`active`).length||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`活跃会话`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-purple-600`,children:x?.items.filter(e=>e.status===`completed`).length||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`已完成`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-orange-600`,children:Math.round((x?.items.reduce((e,t)=>e+t.event_count,0)||0)/(x?.items.length||1))}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`平均事件数`})]})]}),(0,R.jsx)(X,{title:`会话列表 (${D.length})`,action:D.length>0?(0,R.jsx)(`button`,{onClick:()=>{l.size===D.length?u(new Set):u(new Set(D.map(e=>e.session_id)))},className:`text-xs text-blue-600 hover:underline`,children:l.size===D.length?`取消全选`:`全选`}):void 0,children:D.length===0?(0,R.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,R.jsx)(Ds,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,R.jsx)(`p`,{children:`暂无会话记录`}),(0,R.jsx)(`p`,{className:`text-sm mt-1`,children:`使用 Claude Code 开始一个会话后,记录将自动出现在这里`})]}):(0,R.jsx)(`div`,{ref:b,className:`h-[600px] overflow-auto`,children:(0,R.jsx)(`div`,{style:{height:`${A.getTotalSize()}px`,position:`relative`},children:A.getVirtualItems().map(e=>{let t=D[e.index];return(0,R.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:(0,R.jsxs)(`div`,{className:q(`flex items-center gap-3 p-4 rounded-lg border transition-all cursor-pointer mb-2`,l.has(t.session_id)?`border-blue-300 bg-blue-50`:`border-gray-100 hover:border-blue-200 hover:bg-blue-50/50`),onClick:()=>y(`/sessions/${t.session_id}`),children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:l.has(t.session_id),onChange:e=>{e.stopPropagation(),u(e=>{let n=new Set(e);return n.has(t.session_id)?n.delete(t.session_id):n.add(t.session_id),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 cursor-pointer flex-shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-6 gap-4 items-center`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`font-mono text-sm font-medium text-gray-900`,children:[t.session_id.slice(0,12),`...`]}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500 mt-1`,children:t.project_path.split(`/`).slice(-2).join(`/`)})]}),(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsx)(fS,{variant:t.status===`active`?`success`:t.status===`completed`?`info`:`warning`,children:t.status})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,R.jsx)(Ds,{className:`h-4 w-4`}),t.event_count,` 事件`]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,R.jsx)(Ys,{className:`h-4 w-4`}),x4(Df(t.start_time),`MM-dd HH:mm`)]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600`,children:t.end_time?J4(Df(t.start_time),Df(t.end_time)):J4(Df(t.start_time),new Date)}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:ac,children:`查看详情`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Jc,onClick:e=>{e.stopPropagation(),v({open:!0,title:`删除会话`,description:`确认删除此会话及其所有数据?此操作不可撤销。`,onConfirm:()=>{T.mutate(t.session_id),v(e=>({...e,open:!1}))}})},loading:T.isPending&&T.variables===t.session_id})]})]})]})},t.session_id)})})})}),(0,R.jsx)(w4,{open:_.open,title:_.title,description:_.description,count:_.count,variant:`danger`,onConfirm:_.onConfirm,onCancel:()=>v({..._,open:!1})})]})}function X4({items:e}){return(0,R.jsx)(`nav`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:e.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t>0&&(0,R.jsx)(Hs,{className:`h-3.5 w-3.5 text-gray-400`}),e.path?(0,R.jsx)(ei,{to:e.path,className:`hover:text-gray-900 transition-colors`,children:e.label}):(0,R.jsx)(`span`,{className:`text-gray-900 font-medium`,children:e.label})]},t))})}function Z4(){let{id:e}=Ln(),t=Fn(),n=Mn(),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(`phases`),s=n.state?.from||`/sessions`,{data:c,isLoading:l,isError:u,error:d}=ut({queryKey:[`session`,e],queryFn:()=>fl(e).then(e=>e.data),enabled:!!e});if(u)return(0,R.jsxs)(`div`,{className:`flex items-center justify-center h-96 text-red-500`,children:[`加载失败:`,d?.message||`未知错误`]});if(l||!c)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let{session:f,phases:p,dataFlow:m,timeline:h,stats:g}=c,_=Object.entries(g.toolUsage).sort((e,t)=>t[1]-e[1]).slice(0,12).map(([e,t])=>({name:e,value:t}));return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X4,{items:[{label:`会话列表`,path:`/sessions`},{label:f.session_id.slice(0,8)+`...`}]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:ks,onClick:()=>t(s),children:`返回`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-xl font-bold text-gray-900`,children:`会话详情`}),(0,R.jsx)(`p`,{className:`text-sm text-gray-500 font-mono`,children:f.session_id})]}),(0,R.jsx)(fS,{variant:f.status===`active`?`success`:`info`,children:f.status})]}),c.pipeline&&(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(`/pipelines/${c.pipeline.id}`,{state:{from:s}}),children:`查看关联 Pipeline`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Ys,{className:`h-5 w-5 text-blue-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:wf(g.duration)}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`持续时间`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)($c,{className:`h-5 w-5 text-green-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:g.totalEvents}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`总事件数`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(sc,{className:`h-5 w-5 text-purple-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:g.writeOps}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`写入操作`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Lc,{className:`h-5 w-5 text-orange-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:g.readOps}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`读取操作`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Kc,{className:`h-5 w-5 text-red-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:p.length}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`交互轮次`})]})]}),(0,R.jsx)(X,{title:`事件密度时间线`,children:(0,R.jsx)(Dk,{width:`100%`,height:120,children:(0,R.jsxs)(m2,{data:h,children:[(0,R.jsx)(`defs`,{children:(0,R.jsxs)(`linearGradient`,{id:`timelineGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,R.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.4}),(0,R.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:0})]})}),(0,R.jsx)(XX,{strokeDasharray:`3 3`,stroke:`#e5e7eb`}),(0,R.jsx)(Y$,{dataKey:`time`,tick:!1}),(0,R.jsx)(u1,{hide:!0}),(0,R.jsx)(VW,{formatter:e=>[`${e} 事件`,`数量`]}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`count`,stroke:`#3b82f6`,fill:`url(#timelineGrad)`})]})})}),(0,R.jsx)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[`phases`,`flow`,`events`].map(e=>(0,R.jsx)(`button`,{onClick:()=>o(e),className:q(`px-4 py-2 rounded-md text-sm font-medium transition-colors`,a===e?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:{phases:`阶段视图`,flow:`数据流图`,events:`事件列表`}[e]},e))}),a===`phases`&&(0,R.jsx)(`div`,{className:`space-y-3`,children:p.map((e,t)=>(0,R.jsx)(sS.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.05},children:(0,R.jsxs)(X,{className:`!p-0 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between p-4 cursor-pointer hover:bg-gray-50 transition-colors`,onClick:()=>i(r===t?null:t),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 text-white font-bold text-sm`,children:t+1}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-semibold text-gray-900`,children:e.name}),(0,R.jsxs)(`div`,{className:`text-sm text-gray-500`,children:[e.toolCalls,` 工具调用 · `,e.writeOps,` 写入 · `,e.artifacts.length,` 产物`]})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[e.duration&&(0,R.jsx)(`span`,{className:`text-sm text-gray-500`,children:wf(e.duration)}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[e.artifacts.slice(0,3).map((e,t)=>(0,R.jsx)(fS,{variant:`success`,size:`sm`,children:e},t)),e.artifacts.length>3&&(0,R.jsxs)(fS,{variant:`default`,size:`sm`,children:[`+`,e.artifacts.length-3]})]}),r===t?(0,R.jsx)(Bs,{className:`h-5 w-5 text-gray-400`}):(0,R.jsx)(Hs,{className:`h-5 w-5 text-gray-400`})]})]}),r===t&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`border-t border-gray-100`,children:(0,R.jsx)(`div`,{className:`p-4 max-h-96 overflow-y-auto space-y-2`,children:e.events.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,R.jsx)(`div`,{className:`text-gray-400 font-mono w-20 flex-shrink-0`,children:x4(Df(e.time),`HH:mm:ss`)}),(0,R.jsx)(fS,{size:`sm`,variant:e.hookType===`PostToolUse`?`success`:e.hookType===`PreToolUse`?`info`:e.hookType===`UserPromptSubmit`?`warning`:`default`,children:e.hookType}),e.toolName&&(0,R.jsx)(`span`,{className:`font-mono text-gray-700 font-medium`,children:e.toolName}),e.input&&(0,R.jsx)(`span`,{className:`text-gray-500 truncate max-w-md`,children:e.input})]},t))})})]})},t))}),a===`flow`&&(0,R.jsx)(X,{title:`数据流图 (${m.nodes.length} 节点)`,children:(0,R.jsx)(`div`,{className:`space-y-1 max-h-[600px] overflow-y-auto`,children:m.nodes.map((e,t)=>(0,R.jsxs)(sS.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:t*.02},className:`flex items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col items-center w-8`,children:[t>0&&(0,R.jsx)(`div`,{className:`w-0.5 h-3 bg-gray-300`}),(0,R.jsx)(`div`,{className:q(`w-3 h-3 rounded-full border-2`,e.type===`intent`?`bg-blue-500 border-blue-500`:e.type===`artifact`?`bg-green-500 border-green-500`:e.type===`quality`?`bg-yellow-500 border-yellow-500`:`bg-gray-400 border-gray-400`)}),t<m.nodes.length-1&&(0,R.jsx)(`div`,{className:`w-0.5 h-3 bg-gray-300`})]}),(0,R.jsxs)(`div`,{className:q(`flex-1 flex items-center gap-3 p-2 rounded-lg text-sm`,e.type===`intent`?`bg-blue-50`:e.type===`artifact`?`bg-green-50`:e.type===`quality`?`bg-yellow-50`:`bg-gray-50`),children:[(0,R.jsx)(`span`,{className:`font-mono text-xs text-gray-400`,children:x4(Df(e.time),`HH:mm:ss`)}),(0,R.jsx)(fS,{size:`sm`,variant:e.type===`intent`?`info`:e.type===`artifact`?`success`:e.type===`quality`?`warning`:`default`,children:e.label}),e.detail&&(0,R.jsx)(`span`,{className:`text-gray-600 truncate`,children:e.detail})]})]},e.id))})}),a===`events`&&(0,R.jsx)(X,{title:`全部事件 (${c.events.length})`,children:(0,R.jsx)(`div`,{className:`overflow-x-auto`,children:(0,R.jsxs)(`table`,{className:`w-full`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`类型`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`工具`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`详情`})]})}),(0,R.jsx)(`tbody`,{className:`text-sm`,children:c.events.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-gray-50 hover:bg-gray-50`,children:[(0,R.jsx)(`td`,{className:`py-2 font-mono text-gray-500`,children:x4(Df(e.timestamp),`HH:mm:ss`)}),(0,R.jsx)(`td`,{className:`py-2`,children:(0,R.jsx)(fS,{size:`sm`,variant:e.hook_type===`PostToolUse`?`success`:e.hook_type===`UserPromptSubmit`?`warning`:`default`,children:e.hook_type})}),(0,R.jsx)(`td`,{className:`py-2 font-mono`,children:e.tool_name||`-`}),(0,R.jsx)(`td`,{className:`py-2 text-gray-500 truncate max-w-md`,children:typeof e.tool_input==`string`?e.tool_input.slice(0,80):``})]},e.id))})]})})}),(0,R.jsx)(X,{title:`工具使用分布`,children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:_,layout:`vertical`,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`,stroke:`#e5e7eb`}),(0,R.jsx)(Y$,{type:`number`}),(0,R.jsx)(u1,{dataKey:`name`,type:`category`,width:80,tick:{fontSize:12}}),(0,R.jsx)(VW,{}),(0,R.jsx)(O$,{dataKey:`value`,fill:`#3b82f6`,radius:[0,4,4,0]})]})})})]})}var Q4={PreToolUse:`bg-blue-100 text-blue-700`,PostToolUse:`bg-green-100 text-green-700`,UserPromptSubmit:`bg-amber-100 text-amber-700`,Stop:`bg-red-100 text-red-700`,Notification:`bg-purple-100 text-purple-700`};function $4(e){if(!e)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function e3(e){if(e.hook_type===`UserPromptSubmit`){let t=e.user_prompt;return{title:`用户输入`,subtitle:t?t.slice(0,80):`用户提交了新请求`}}if(e.tool_name){let t=e.tool_input;return t?.file_path?{title:`${e.tool_name} 文件`,subtitle:String(t.file_path).split(`/`).slice(-2).join(`/`)}:t?.command?{title:`${e.tool_name} 命令`,subtitle:String(t.command).slice(0,100)}:t?.pattern?{title:`${e.tool_name} 搜索`,subtitle:String(t.pattern)}:{title:e.tool_name,subtitle:e.hook_type}}return{title:e.hook_type,subtitle:e.project_path.split(`/`).pop()||``}}function t3(){let e=Ye(),[t,n]=(0,L.useState)(200),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(``),p=cS(d),[m,h]=(0,L.useState)(``),[g,_]=(0,L.useState)(``),[v,y]=(0,L.useState)(`all`),[b,x]=(0,L.useState)(30),[S,C]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),w=(0,L.useRef)(null),T=v===`all`?void 0:x4(C4(new Date,v===`1d`?1:v===`7d`?7:30),`yyyy-MM-dd'T'HH:mm:ss`),{data:E,isLoading:D,isError:O,refetch:k}=ut({queryKey:[`events`,{limit:t,tool_name:r||void 0,start_time:T,search:m||void 0}],queryFn:()=>hl({limit:t,tool_name:r||void 0,start_time:T,search:m||void 0}).then(e=>e.data)}),A=z({mutationFn:e=>gu(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`events`]})}}),j=E?.items.filter(e=>!(a&&e.hook_type!==a||s&&e.project_path.split(`/`).pop()!==s||p&&![e.tool_name,$4(e.tool_input),$4(e.tool_output)].join(` `).toLowerCase().includes(p.toLowerCase())))||[],M=G4({count:j.length,getScrollElement:()=>w.current,estimateSize:()=>120,overscan:5});if(D)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});if(O)return(0,R.jsx)(q4,{message:`事件数据加载失败`,onRetry:()=>k()});let N=Array.from(new Set(E?.items.map(e=>e.project_path.split(`/`).pop()||``).filter(Boolean)||[])),ee=j.reduce((e,t)=>{let n=t.tool_name||`N/A`;return e[n]=(e[n]||0)+1,e},{}),te=Object.entries(ee).sort((e,t)=>t[1]-e[1]).slice(0,10),P=Array.from(new Set(E?.items.map(e=>e.hook_type)||[]));return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center flex-1`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`实时过滤:工具名、文件名...`,value:d,onChange:e=>{f(e.target.value)},className:`w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`})]}),(0,R.jsx)(`div`,{className:`relative min-w-[200px] max-w-xs`,children:(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h(g)},children:[(0,R.jsx)(`input`,{type:`text`,placeholder:`全文搜索内容(回车提交)...`,value:g,onChange:e=>_(e.target.value),className:q(`w-full pl-3 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`,m?`border-blue-400 bg-blue-50`:`border-gray-200`)}),m&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>{h(``),_(``)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 text-xs`,children:`✕`})]})}),(0,R.jsxs)(`select`,{value:a,onChange:e=>{o(e.target.value)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:``,children:`全部类型`}),P.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}),(0,R.jsxs)(`select`,{value:s,onChange:e=>{c(e.target.value)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:``,children:`全部项目`}),N.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden text-sm`,children:[(0,R.jsx)(Is,{className:`h-3.5 w-3.5 text-gray-400 ml-2`}),[`all`,`1d`,`7d`,`30d`].map(e=>(0,R.jsx)(`button`,{onClick:()=>{y(e)},className:q(`px-2.5 py-2 transition-colors`,v===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:e===`all`?`全部`:e},e))]}),(0,R.jsxs)(`select`,{value:t,onChange:e=>n(Number(e.target.value)),className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:500,children:`500 条`}),(0,R.jsx)(`option`,{value:1e3,children:`1000 条`}),(0,R.jsx)(`option`,{value:2e3,children:`2000 条`}),(0,R.jsx)(`option`,{value:5e3,children:`5000 条`})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,R.jsxs)(`select`,{value:b,onChange:e=>x(Number(e.target.value)),className:`px-2 py-1.5 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:7,children:`7天`}),(0,R.jsx)(`option`,{value:30,children:`30天`}),(0,R.jsx)(`option`,{value:90,children:`90天`})]}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:nc,onClick:()=>{let e=[`时间`,`类型`,`工具`,`项目`,`会话ID`,`摘要`],t=j.map(e=>{let t=e3(e);return[e.timestamp,e.hook_type,e.tool_name||``,e.project_path.split(`/`).pop()||``,e.session_id.slice(0,12),t.subtitle]});K4(`events-${x4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出`}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Jc,onClick:()=>{C({open:!0,title:`清理历史事件`,description:`确认清理 ${b} 天前的已蒸馏事件?此操作不可撤销。`,onConfirm:()=>{A.mutate(b),C({...S,open:!1})}})},loading:A.isPending,children:`清理历史`}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Pc,onClick:()=>k(),children:`刷新`})]})]})}),(0,R.jsx)(X,{title:`工具使用频率`,children:(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:te.map(([e,t])=>(0,R.jsxs)(`button`,{onClick:()=>{i(r===e?``:e)},className:q(`px-3 py-1.5 rounded-full text-sm transition-all`,r===e?`bg-blue-100 text-blue-700 border-2 border-blue-300`:`bg-gray-100 text-gray-700 hover:bg-gray-200 border-2 border-transparent`),children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e}),(0,R.jsx)(`span`,{className:`ml-1 text-xs opacity-70`,children:t})]},e))})}),(0,R.jsx)(X,{title:`执行轨迹 (${j.length})`,children:(0,R.jsx)(`div`,{ref:w,className:`h-[600px] overflow-auto`,style:{contain:`strict`},children:(0,R.jsx)(`div`,{style:{height:`${M.getTotalSize()}px`,width:`100%`,position:`relative`},children:M.getVirtualItems().map(e=>{let t=j[e.index],n=e3(t),r=l===t.event_id;return(0,R.jsx)(`div`,{"data-index":e.index,ref:M.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},className:`pb-2`,children:(0,R.jsxs)(`div`,{className:`border border-gray-100 rounded-lg overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between p-3 hover:bg-gray-50 cursor-pointer`,onClick:()=>u(r?null:t.event_id),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,R.jsx)(`button`,{className:`text-gray-400`,children:r?(0,R.jsx)(Bs,{className:`h-4 w-4`}):(0,R.jsx)(Hs,{className:`h-4 w-4`})}),(0,R.jsx)(fS,{size:`sm`,className:Q4[t.hook_type]||`bg-gray-100 text-gray-700`,children:t.hook_type}),t.tool_name&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1 text-sm text-gray-700 flex-shrink-0`,children:[t.tool_name===`Bash`?(0,R.jsx)(Kc,{className:`h-4 w-4`}):(0,R.jsx)(oc,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`font-mono`,children:t.tool_name})]}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium text-gray-900 truncate`,children:n.title}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500 truncate`,children:n.subtitle})]})]}),(0,R.jsx)(`div`,{className:`text-xs text-gray-400 font-mono ml-3`,children:x4(Df(t.timestamp),`HH:mm:ss`)})]}),(0,R.jsx)(gb,{children:r&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`border-t border-gray-100 bg-gray-50`,children:(0,R.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3 text-xs`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`会话`}),(0,R.jsxs)(`div`,{className:`font-mono text-gray-700`,children:[t.session_id.slice(0,12),`...`]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`项目`}),(0,R.jsx)(`div`,{className:`text-gray-700`,children:t.project_path.split(`/`).pop()})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`时间`}),(0,R.jsx)(`div`,{className:`font-mono text-gray-700`,children:t.timestamp})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`类型`}),(0,R.jsx)(`div`,{className:`text-gray-700`,children:t.hook_type})]})]}),t.tool_input&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider`,children:[(0,R.jsx)(Tc,{className:`h-3 w-3`}),` 输入`]}),(0,R.jsx)(`pre`,{className:`bg-white p-3 rounded-lg text-xs font-mono overflow-x-auto border border-gray-200 text-gray-700 whitespace-pre-wrap break-all`,children:$4(t.tool_input)})]}),t.tool_output&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider`,children:[(0,R.jsx)(Ns,{className:`h-3 w-3`}),` 输出`]}),(0,R.jsx)(`pre`,{className:`bg-white p-3 rounded-lg text-xs font-mono overflow-x-auto border border-gray-200 text-gray-700 whitespace-pre-wrap break-all max-h-64 overflow-y-auto`,children:$4(t.tool_output)})]})]})})})]})},t.event_id)})})})}),(0,R.jsx)(w4,{open:S.open,title:S.title,description:S.description,variant:`danger`,onConfirm:S.onConfirm,onCancel:()=>C({...S,open:!1})})]})}function n3({currentPage:e,totalPages:t,onPageChange:n,pageSize:r,onPageSizeChange:i,totalItems:a}){return(0,R.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-t border-gray-200`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsxs)(`span`,{className:`text-sm text-gray-600`,children:[`显示 `,(e-1)*r+1,`-`,Math.min(e*r,a),` / 共 `,a,` 条`]}),(0,R.jsxs)(`select`,{value:r,onChange:e=>i(Number(e.target.value)),className:`px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:10,children:`10 条/页`}),(0,R.jsx)(`option`,{value:20,children:`20 条/页`}),(0,R.jsx)(`option`,{value:50,children:`50 条/页`}),(0,R.jsx)(`option`,{value:100,children:`100 条/页`})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Vs,onClick:()=>n(e-1),disabled:e===1,children:`上一页`}),(0,R.jsx)(`div`,{className:`flex items-center gap-1`,children:Array.from({length:Math.min(t,7)},(r,i)=>{let a;return a=t<=7||e<=4?i+1:e>=t-3?t-6+i:e-3+i,(0,R.jsx)(`button`,{onClick:()=>n(a),className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${e===a?`bg-blue-600 text-white`:`text-gray-600 hover:bg-gray-100`}`,children:a},a)})}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Hs,onClick:()=>n(e+1),disabled:e===t,children:`下一页`})]})]})}function r3(){let e=Ye(),t=Fn(),[n,r]=(0,L.useState)(``),i=cS(n),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(`all`),[l,u]=(0,L.useState)(1),[d,f]=(0,L.useState)(20),[p,m]=(0,L.useState)(new Set),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:y,isLoading:b,isError:x,refetch:S}=ut({queryKey:[`pipelines`,`active`],queryFn:()=>_l({status:`active`,page_size:100}).then(e=>e.data),refetchInterval:1e4}),{data:C,refetch:w}=ut({queryKey:[`pipelines`,`completed`,i,a,l,d],queryFn:()=>_l({status:`completed`,search:i||void 0,complexity:a||void 0,page:l,page_size:d}).then(e=>e.data)}),T=z({mutationFn:e=>Nl(e),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),E=z({mutationFn:()=>Il(),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),D=z({mutationFn:e=>Fl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`pipelines`]}),m(new Set)}});if(b)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});if(x)return(0,R.jsx)(q4,{message:`Pipeline 数据加载失败`,onRetry:()=>S()});let O=y?.items||[],k=C?.items||[],A=C?.total||0,j=O.filter(e=>!h||e.requirement.toLowerCase().includes(h.toLowerCase())||e.project.toLowerCase().includes(h.toLowerCase())),M=s===`all`||s===`active`,N=s===`all`||s===`completed`,ee=Math.ceil(A/d);return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[O.length,` 个活跃 · `,A,` 个已完成`,p.size>0&&` · 已选 ${p.size} 个`]}),(0,R.jsxs)(`select`,{value:s,onChange:e=>{c(e.target.value),u(1)},className:`px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:`all`,children:`全部状态`}),(0,R.jsx)(`option`,{value:`active`,children:`仅活跃`}),(0,R.jsx)(`option`,{value:`completed`,children:`仅已完成`})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[j.length>0&&p.size>0&&(0,R.jsxs)(Y,{variant:`danger`,size:`sm`,icon:el,onClick:()=>{p.size!==0&&v({open:!0,title:`批量关闭 Pipeline`,description:`确认关闭选中的 ${p.size} 个 Pipeline?`,count:p.size,onConfirm:()=>{D.mutate(Array.from(p)),v(e=>({...e,open:!1}))}})},loading:D.isPending,children:[`批量关闭 (`,p.size,`)`]}),j.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>{p.size===j.length?m(new Set):m(new Set(j.map(e=>e.id)))},children:p.size===j.length?`取消全选`:`全选`}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,icon:Jc,onClick:()=>{v({open:!0,title:`清理过期 Pipeline`,description:`确认关闭所有过期 Pipeline?`,onConfirm:()=>{E.mutate(),v(e=>({...e,open:!1}))}})},loading:E.isPending,children:`清理过期`})]}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Pc,onClick:()=>S(),children:`刷新`}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:nc,onClick:()=>{let e=[...O,...k];K4(`pipelines-${x4(new Date,`yyyyMMdd-HHmmss`)}.csv`,[`ID`,`需求`,`复杂度`,`状态`,`项目`,`创建时间`],e.map(e=>[e.id,e.requirement,e.complexity,e.status,e.project,e.createdAt]))},children:`导出 CSV`})]})]}),M&&O.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,R.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider`,children:[`活跃中 (`,j.length,`/`,O.length,`)`]}),(0,R.jsxs)(`div`,{className:`relative w-64`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`搜索活跃 Pipeline...`,value:h,onChange:e=>g(e.target.value),className:`w-full pl-10 pr-4 py-1.5 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`})]})]}),(0,R.jsx)(`div`,{className:`space-y-3`,children:j.map((e,n)=>(0,R.jsx)(sS.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.05},children:(0,R.jsx)(X,{className:`!p-0 overflow-hidden cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>t(`/pipelines/${e.id}`),children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4 flex-1 min-w-0`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:p.has(e.id),onChange:t=>{t.stopPropagation(),m(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 flex-shrink-0`}),(0,R.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg`,style:{backgroundColor:`#10b98120`},children:(0,R.jsx)(pc,{className:`h-5 w-5`,style:{color:`#10b981`}})}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`div`,{className:`font-medium text-gray-900 truncate`,children:e.requirement}),(0,R.jsxs)(`div`,{className:`text-sm text-gray-500 flex items-center gap-3 mt-1`,children:[(0,R.jsx)(fS,{variant:`primary`,size:`sm`,children:`动态`}),(0,R.jsx)(`span`,{children:e.project}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(Ys,{className:`h-3 w-3`}),x4(Df(e.createdAt),`MM-dd HH:mm`)]})]}),e.type===`dynamic`&&e.nodeConfig&&(0,R.jsxs)(`div`,{className:`mt-2 flex items-center gap-3 text-xs text-gray-600`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(pc,{className:`h-3 w-3`}),e.nodeConfig.totalNodes,` 个节点`]}),e.nodeConfig.boundSkills.length>0&&(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`⚡ `,e.nodeConfig.boundSkills.length,` 个技能`]}),(0,R.jsxs)(`span`,{className:`text-gray-400`,children:[`节点类型:`,e.nodeConfig.nodeTypes.map(e=>e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)).join(` → `)]})]})]})]}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,icon:el,onClick:()=>{v({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{T.mutate(e.id),v(e=>({...e,open:!1}))}})},loading:T.isPending,children:`关闭`})]})})},e.id))})]}),N&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider mb-3`,children:`历史记录`}),(0,R.jsxs)(X,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center mb-4 pb-4 border-b border-gray-100`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`搜索需求描述...`,value:n,onChange:e=>{r(e.target.value),u(1)},className:`w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`})]}),(0,R.jsxs)(`select`,{value:a,onChange:e=>{o(e.target.value),u(1)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:``,children:`全部复杂度`}),(0,R.jsx)(`option`,{value:`simple`,children:`简单`}),(0,R.jsx)(`option`,{value:`moderate`,children:`中等`}),(0,R.jsx)(`option`,{value:`complex`,children:`复杂`})]})]}),(0,R.jsx)(`div`,{className:`overflow-x-auto`,children:(0,R.jsxs)(`table`,{className:`w-full`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`需求`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`项目`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`类型`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`复杂度`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`操作`})]})}),(0,R.jsx)(`tbody`,{className:`text-sm`,children:k.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-gray-50 hover:bg-gray-50 cursor-pointer`,onClick:()=>t(`/pipelines/${e.id}`),children:[(0,R.jsx)(`td`,{className:`py-3 max-w-xs truncate`,children:e.requirement}),(0,R.jsx)(`td`,{className:`py-3`,children:e.project}),(0,R.jsx)(`td`,{className:`py-3`,children:(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(fS,{size:`sm`,variant:`primary`,children:`动态编排`}),e.nodeConfig&&(0,R.jsxs)(`div`,{className:`text-xs text-gray-500 space-y-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(pc,{className:`h-3 w-3`}),e.nodeConfig.totalNodes,` 节点`,e.nodeConfig.boundSkills.length>0&&(0,R.jsxs)(`span`,{className:`ml-1`,children:[`· ⚡ `,e.nodeConfig.boundSkills.length,` 技能`]})]}),(0,R.jsx)(`div`,{className:`text-gray-400 max-w-[200px] truncate`,children:e.nodeConfig.nodeTypes.map(e=>e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)).join(` → `)})]})]})}),(0,R.jsx)(`td`,{className:`py-3`,children:(0,R.jsx)(fS,{size:`sm`,variant:e.complexity===`complex`?`danger`:e.complexity===`moderate`?`warning`:`default`,children:e.complexity||`-`})}),(0,R.jsx)(`td`,{className:`py-3 text-gray-500`,children:x4(Df(e.createdAt),`MM-dd HH:mm`)}),(0,R.jsx)(`td`,{className:`py-3`,children:(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:ac,onClick:n=>{n.stopPropagation(),t(`/pipelines/${e.id}`)},children:`查看`})})]},e.id))})]})}),A===0&&(0,R.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无历史记录`}),A>0&&(0,R.jsx)(n3,{currentPage:l,totalPages:ee,onPageChange:u,pageSize:d,onPageSizeChange:e=>{f(e),u(1)},totalItems:A})]})]}),(0,R.jsx)(w4,{open:_.open,title:_.title,description:_.description,count:_.count,variant:`danger`,onConfirm:_.onConfirm,onCancel:()=>v({..._,open:!1})})]})}var i3={pending:Js,running:Ys,validating:Fc,passed:Gs,failed:qs,need_human:Ws},a3={pending:`text-gray-400`,running:`text-blue-500`,validating:`text-yellow-500`,passed:`text-green-500`,failed:`text-red-500`,need_human:`text-orange-500`},o3={pending:`待执行`,running:`执行中`,validating:`验证中`,passed:`已完成`,failed:`失败`,need_human:`需人工介入`};function s3({steps:e,currentStepId:t}){return!e||e.length===0?null:(0,R.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,R.jsxs)(`div`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:[`步骤进度 (`,e.filter(e=>e.status===`passed`).length,`/`,e.length,`)`]}),(0,R.jsx)(`div`,{className:`space-y-2`,children:e.map((e,n)=>{let r=i3[e.status],i=e.id===t;return(0,R.jsxs)(`div`,{className:q(`flex items-start gap-3 p-3 rounded-lg border transition-colors`,i?`bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800`:`bg-gray-50 dark:bg-gray-800/50 border-gray-200 dark:border-gray-700`),children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-6 h-6 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center text-xs font-medium`,children:n+1}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,R.jsx)(r,{className:q(`w-4 h-4`,a3[e.status])}),(0,R.jsx)(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:e.stepName}),(0,R.jsx)(fS,{variant:e.status===`passed`?`success`:e.status===`failed`?`error`:`default`,children:o3[e.status]}),i&&(0,R.jsx)(fS,{variant:`info`,children:`当前`})]}),e.attempts>0&&(0,R.jsxs)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-1`,children:[`重试次数:`,e.attempts]}),e.failureReason&&(0,R.jsxs)(`div`,{className:`text-xs text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20 p-2 rounded mt-1`,children:[`失败原因:`,e.failureReason]}),e.outputs&&Object.keys(e.outputs).length>0&&(0,R.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,R.jsx)(`div`,{className:`text-gray-600 dark:text-gray-400 mb-1`,children:`输出产物:`}),(0,R.jsx)(`div`,{className:`space-y-1`,children:Object.entries(e.outputs).map(([e,t])=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-700 dark:text-gray-300`,children:[(0,R.jsxs)(`span`,{className:`font-medium`,children:[e,`:`]}),(0,R.jsx)(`a`,{href:`file://${t}`,className:`text-blue-600 dark:text-blue-400 hover:underline truncate`,title:t,children:t})]},e))})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-xs text-gray-500 dark:text-gray-400`,children:[e.startedAt&&(0,R.jsxs)(`span`,{children:[`开始:`,x4(new Date(e.startedAt),`HH:mm:ss`)]}),e.completedAt&&(0,R.jsxs)(`span`,{children:[`完成:`,x4(new Date(e.completedAt),`HH:mm:ss`)]})]})]})]},e.id)})})]})}var c3={document:cc,code:Xs,test:qc,config:Rc,diagram:gc,data:ec,other:lc},l3={analyze:{name:`需求分析`,description:`分析需求,明确目标和范围`},design:{name:`架构设计`,description:`设计系统架构和技术方案`},profile:{name:`性能分析`,description:`分析性能瓶颈,制定优化方案`},code:{name:`编码实现`,description:`编写代码,实现功能`},test:{name:`测试验证`,description:`编写测试,验证功能正确性`},review:{name:`代码审查`,description:`审查代码质量和规范`}},u3={analy:`#3b82f6`,design:`#8b5cf6`,architect:`#8b5cf6`,profile:`#06b6d4`,code:`#10b981`,implement:`#10b981`,test:`#f59e0b`,verif:`#f59e0b`,review:`#ef4444`,deploy:`#06b6d4`};function d3(e){let t=e.toLowerCase();for(let[e,n]of Object.entries(u3))if(t.includes(e))return n;return`#6b7280`}function f3(e){let t=l3[e];return t?t.name:e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function p3(e){return l3[e]?.description||null}function m3(e){let t=new Set,n=[],r=new Map(e.map(e=>[e.id,e]));function i(e){if(t.has(e))return;t.add(e);let a=r.get(e);a&&((a.dependencies||[]).forEach(e=>i(e)),n.push(a))}return e.forEach(e=>i(e.id)),n}function h3(e,t){if(!e)return null;let n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),i=Math.floor((r-n)/1e3);return i<60?`${i}s`:`${Math.floor(i/60)}m ${i%60}s`}function g3({pipeline:e,onRetryNode:t}){let[n,r]=(0,L.useState)(new Set),i=(0,L.useMemo)(()=>m3(e.nodes),[e.nodes]),a=i.filter(e=>e.status===`completed`||e.status===`skipped`).length,o=i.length>0&&i.every(e=>e.status===`completed`||e.status===`skipped`||e.status===`failed`),s=o?-1:i.findIndex(t=>t.id===e.currentNodeId),c=e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return i.length===0?(0,R.jsx)(X,{children:(0,R.jsx)(`div`,{className:`text-center py-8 text-gray-400`,children:`暂无节点`})}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(X,{className:`!p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,R.jsxs)(`span`,{className:`text-sm font-medium text-gray-700`,children:[`编排阶段 · `,a,`/`,i.length,` 已完成`]}),(0,R.jsx)(`span`,{className:`text-xs text-gray-400`,children:o||e.status===`completed`?`✅ 全部完成`:e.status===`failed`?`❌ 已失败`:s>=0?`当前:第 ${s+1} 阶段`:`准备中`})]}),(0,R.jsx)(`div`,{className:`flex items-start gap-0 overflow-x-auto pb-1`,children:i.map((t,n)=>{let r=t.id===e.currentNodeId,a=t.status===`completed`,o=t.status===`failed`,s=t.status===`skipped`,c=d3(t.nodeTypeId),l=o?`#ef4444`:s?`#9ca3af`:a||r?c:void 0;return(0,R.jsxs)(`div`,{className:`flex items-center flex-shrink-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,R.jsx)(`div`,{className:q(`w-9 h-9 rounded-full flex items-center justify-center text-xs font-bold transition-all`,l?`text-white`:`bg-gray-100 text-gray-400`,r&&`ring-4 ring-offset-2`),style:l?{backgroundColor:l,...r?{ringColor:`${c}40`}:{}}:{},children:a?`✓`:o?`✗`:s?`—`:n+1}),(0,R.jsx)(`span`,{className:q(`text-xs mt-1 max-w-[72px] text-center leading-tight break-words`,r?`font-bold text-gray-900`:`text-gray-500`),children:f3(t.nodeTypeId)})]}),n<i.length-1&&(0,R.jsx)(`div`,{className:q(`h-0.5 w-6 mx-0.5 mb-5 flex-shrink-0 transition-colors`,a?`bg-green-400`:`bg-gray-200`)})]},t.id)})})]}),(0,R.jsx)(`div`,{className:`space-y-3`,children:i.map((r,a)=>{let o=r.id===e.currentNodeId,s=d3(r.nodeTypeId),l=f3(r.nodeTypeId),u=p3(r.nodeTypeId),d=h3(r.startedAt,r.completedAt),f=n.has(r.id),p=null,m=null;if(r.output)try{let e=JSON.parse(r.output);e.artifacts&&e.validation?p=e:m=r.output}catch{m=r.output}let h=m?m.trim().split(`
67
+ `),a=new Blob([``+i],{type:`text/csv;charset=utf-8;`}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=e,s.click(),URL.revokeObjectURL(o)}function q4({message:e=`加载失败,请重试`,onRetry:t}){return(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-96 text-center px-4`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-16 h-16 rounded-full bg-red-50 mb-4`,children:(0,R.jsx)(Ws,{className:`h-8 w-8 text-red-500`})}),(0,R.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 mb-2`,children:`出错了`}),(0,R.jsx)(`p`,{className:`text-sm text-gray-500 mb-6 max-w-md`,children:e}),t&&(0,R.jsx)(Y,{variant:`primary`,size:`sm`,icon:Pc,onClick:t,children:`重试`})]})}function J4(e,t){let n=t.getTime()-e.getTime();if(n<0)return`-`;let r=Math.floor(n/6e4),i=Math.floor(r/60);return i>0?`${i}h ${r%60}m`:r>0?`${r}m`:`${Math.floor(n/1e3)}s`}function Y4(){let e=Ye(),[t,n]=(0,L.useState)(``),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(`all`),[l,u]=(0,L.useState)(new Set),[d,f]=(0,L.useState)(`start_time`),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),y=Fn(),b=(0,L.useRef)(null),{data:x,isLoading:S,isError:C,refetch:w}=ut({queryKey:[`sessions`,{limit:100,status:r||void 0}],queryFn:()=>dl({limit:100,status:r||void 0}).then(e=>e.data),refetchInterval:1e4}),T=z({mutationFn:e=>pl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}}),E=z({mutationFn:e=>ml(e),onSuccess:t=>{u(new Set),e.invalidateQueries({queryKey:[`sessions`]}),t.failed.length>0&&alert(`删除完成:成功 ${t.success.length} 个,失败 ${t.failed.length} 个\n失败原因:\n${t.errors.map(e=>`${e.id}: ${e.reason}`).join(`
68
+ `)}`)}}),D=(x?.items.filter(e=>{let n=e.session_id.toLowerCase().includes(t.toLowerCase())||e.project_path.toLowerCase().includes(t.toLowerCase()),r=!a||e.project_path.split(`/`).pop()===a,i=s===`all`||new Date(e.start_time)>=C4(new Date,s===`1d`?1:s===`7d`?7:30);return n&&r&&i})||[]).sort((e,t)=>{let n=0;return d===`start_time`?n=e.start_time.localeCompare(t.start_time):d===`event_count`?n=e.event_count-t.event_count:d===`duration`&&(n=(e.end_time?new Date(e.end_time).getTime()-new Date(e.start_time).getTime():1/0)-(t.end_time?new Date(t.end_time).getTime()-new Date(t.start_time).getTime():1/0)),p?n:-n}),O=Array.from(new Set(x?.items.map(e=>e.project_path.split(`/`).pop()||``).filter(Boolean)||[])),k=e=>{d===e?m(e=>!e):(f(e),m(!1))},A=G4({count:D.length,getScrollElement:()=>b.current,estimateSize:()=>72,overscan:10}),j=()=>{let e=[`Session ID`,`项目`,`状态`,`开始时间`,`结束时间`,`事件数`],t=D.map(e=>[e.session_id,e.project_path,e.status,e.start_time,e.end_time||``,e.event_count]);K4(`sessions-${x4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)};return S?(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})}):C?(0,R.jsx)(q4,{message:`会话数据加载失败`,onRetry:()=>w()}):(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`搜索会话 ID 或项目...`,value:t,onChange:e=>n(e.target.value),className:`w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,R.jsxs)(`button`,{onClick:()=>g(e=>!e),className:q(`flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border transition-colors`,h||r||a||s!==`all`?`border-blue-300 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:bg-gray-50`),children:[(0,R.jsx)(fc,{className:`h-4 w-4`}),`筛选`,(r||a||s!==`all`)&&(0,R.jsx)(`span`,{className:`ml-1 px-1.5 py-0.5 bg-blue-600 text-white text-xs rounded-full`,children:[r,a,s===`all`?``:s].filter(Boolean).length}),(0,R.jsx)(Bs,{className:q(`h-3.5 w-3.5 transition-transform`,h&&`rotate-180`)})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[l.size>0&&(0,R.jsxs)(Y,{variant:`danger`,size:`sm`,icon:Jc,onClick:()=>{v({open:!0,title:`批量删除会话`,description:`确定删除选中的 ${l.size} 个会话吗?此操作不可撤销。`,count:l.size,onConfirm:()=>{E.mutate(Array.from(l)),v(e=>({...e,open:!1}))}})},loading:E.isPending,children:[`删除 (`,l.size,`)`]}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:nc,onClick:()=>D.length>0&&j(),children:`导出`}),(0,R.jsx)(Y,{variant:`primary`,size:`sm`,onClick:()=>w(),children:`刷新`})]})]}),h&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 pt-2 border-t border-gray-100`,children:[(0,R.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部状态`}),(0,R.jsx)(`option`,{value:`active`,children:`活跃`}),(0,R.jsx)(`option`,{value:`completed`,children:`已完成`}),(0,R.jsx)(`option`,{value:`interrupted`,children:`中断`})]}),(0,R.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部项目`}),O.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden text-sm`,children:[(0,R.jsx)(Is,{className:`h-3.5 w-3.5 text-gray-400 ml-2`}),[`all`,`1d`,`7d`,`30d`].map(e=>(0,R.jsx)(`button`,{onClick:()=>c(e),className:q(`px-2.5 py-1.5 transition-colors`,s===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:e===`all`?`全部`:e},e))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,R.jsx)(`span`,{className:`text-gray-500 text-xs`,children:`排序:`}),[{key:`start_time`,label:`时间`},{key:`event_count`,label:`事件数`},{key:`duration`,label:`时长`}].map(({key:e,label:t})=>(0,R.jsxs)(`button`,{onClick:()=>k(e),className:q(`px-2.5 py-1.5 rounded-lg transition-colors flex items-center gap-1`,d===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:[t,d===e&&(0,R.jsx)(js,{className:q(`h-3 w-3`,p&&`rotate-180`)})]},e))]})]})]})}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:x?.total||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总会话数`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-green-600`,children:x?.items.filter(e=>e.status===`active`).length||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`活跃会话`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-purple-600`,children:x?.items.filter(e=>e.status===`completed`).length||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`已完成`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-orange-600`,children:Math.round((x?.items.reduce((e,t)=>e+t.event_count,0)||0)/(x?.items.length||1))}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`平均事件数`})]})]}),(0,R.jsx)(X,{title:`会话列表 (${D.length})`,action:D.length>0?(0,R.jsx)(`button`,{onClick:()=>{l.size===D.length?u(new Set):u(new Set(D.map(e=>e.session_id)))},className:`text-xs text-blue-600 hover:underline`,children:l.size===D.length?`取消全选`:`全选`}):void 0,children:D.length===0?(0,R.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,R.jsx)(Ds,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,R.jsx)(`p`,{children:`暂无会话记录`}),(0,R.jsx)(`p`,{className:`text-sm mt-1`,children:`使用 Claude Code 开始一个会话后,记录将自动出现在这里`})]}):(0,R.jsx)(`div`,{ref:b,className:`h-[600px] overflow-auto`,children:(0,R.jsx)(`div`,{style:{height:`${A.getTotalSize()}px`,position:`relative`},children:A.getVirtualItems().map(e=>{let t=D[e.index];return(0,R.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:(0,R.jsxs)(`div`,{className:q(`flex items-center gap-3 p-4 rounded-lg border transition-all cursor-pointer mb-2`,l.has(t.session_id)?`border-blue-300 bg-blue-50`:`border-gray-100 hover:border-blue-200 hover:bg-blue-50/50`),onClick:()=>y(`/sessions/${t.session_id}`),children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:l.has(t.session_id),onChange:e=>{e.stopPropagation(),u(e=>{let n=new Set(e);return n.has(t.session_id)?n.delete(t.session_id):n.add(t.session_id),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 cursor-pointer flex-shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-6 gap-4 items-center`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`font-mono text-sm font-medium text-gray-900`,children:[t.session_id.slice(0,12),`...`]}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500 mt-1`,children:t.project_path.split(`/`).slice(-2).join(`/`)})]}),(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsx)(fS,{variant:t.status===`active`?`success`:t.status===`completed`?`info`:`warning`,children:t.status})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,R.jsx)(Ds,{className:`h-4 w-4`}),t.event_count,` 事件`]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,R.jsx)(Ys,{className:`h-4 w-4`}),x4(Df(t.start_time),`MM-dd HH:mm`)]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600`,children:t.end_time?J4(Df(t.start_time),Df(t.end_time)):J4(Df(t.start_time),new Date)}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:ac,children:`查看详情`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Jc,onClick:e=>{e.stopPropagation(),v({open:!0,title:`删除会话`,description:`确认删除此会话及其所有数据?此操作不可撤销。`,onConfirm:()=>{T.mutate(t.session_id),v(e=>({...e,open:!1}))}})},loading:T.isPending&&T.variables===t.session_id})]})]})]})},t.session_id)})})})}),(0,R.jsx)(w4,{open:_.open,title:_.title,description:_.description,count:_.count,variant:`danger`,onConfirm:_.onConfirm,onCancel:()=>v({..._,open:!1})})]})}function X4({items:e}){return(0,R.jsx)(`nav`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:e.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t>0&&(0,R.jsx)(Hs,{className:`h-3.5 w-3.5 text-gray-400`}),e.path?(0,R.jsx)(ei,{to:e.path,className:`hover:text-gray-900 transition-colors`,children:e.label}):(0,R.jsx)(`span`,{className:`text-gray-900 font-medium`,children:e.label})]},t))})}function Z4(){let{id:e}=Ln(),t=Fn(),n=Mn(),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(`phases`),s=n.state?.from||`/sessions`,{data:c,isLoading:l,isError:u,error:d}=ut({queryKey:[`session`,e],queryFn:()=>fl(e).then(e=>e.data),enabled:!!e});if(u)return(0,R.jsxs)(`div`,{className:`flex items-center justify-center h-96 text-red-500`,children:[`加载失败:`,d?.message||`未知错误`]});if(l||!c)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let{session:f,phases:p,dataFlow:m,timeline:h,stats:g}=c,_=Object.entries(g.toolUsage).sort((e,t)=>t[1]-e[1]).slice(0,12).map(([e,t])=>({name:e,value:t}));return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X4,{items:[{label:`会话列表`,path:`/sessions`},{label:f.session_id.slice(0,8)+`...`}]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:ks,onClick:()=>t(s),children:`返回`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-xl font-bold text-gray-900`,children:`会话详情`}),(0,R.jsx)(`p`,{className:`text-sm text-gray-500 font-mono`,children:f.session_id})]}),(0,R.jsx)(fS,{variant:f.status===`active`?`success`:`info`,children:f.status})]}),c.pipeline&&(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(`/pipelines/${c.pipeline.id}`,{state:{from:s}}),children:`查看关联 Pipeline`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Ys,{className:`h-5 w-5 text-blue-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:wf(g.duration)}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`持续时间`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)($c,{className:`h-5 w-5 text-green-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:g.totalEvents}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`总事件数`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(sc,{className:`h-5 w-5 text-purple-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:g.writeOps}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`写入操作`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Lc,{className:`h-5 w-5 text-orange-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:g.readOps}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`读取操作`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Kc,{className:`h-5 w-5 text-red-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-xl font-bold`,children:p.length}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`交互轮次`})]})]}),(0,R.jsx)(X,{title:`事件密度时间线`,children:(0,R.jsx)(Dk,{width:`100%`,height:120,children:(0,R.jsxs)(m2,{data:h,children:[(0,R.jsx)(`defs`,{children:(0,R.jsxs)(`linearGradient`,{id:`timelineGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,R.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.4}),(0,R.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:0})]})}),(0,R.jsx)(XX,{strokeDasharray:`3 3`,stroke:`#e5e7eb`}),(0,R.jsx)(Y$,{dataKey:`time`,tick:!1}),(0,R.jsx)(u1,{hide:!0}),(0,R.jsx)(VW,{formatter:e=>[`${e} 事件`,`数量`]}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`count`,stroke:`#3b82f6`,fill:`url(#timelineGrad)`})]})})}),(0,R.jsx)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[`phases`,`flow`,`events`].map(e=>(0,R.jsx)(`button`,{onClick:()=>o(e),className:q(`px-4 py-2 rounded-md text-sm font-medium transition-colors`,a===e?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:{phases:`阶段视图`,flow:`数据流图`,events:`事件列表`}[e]},e))}),a===`phases`&&(0,R.jsx)(`div`,{className:`space-y-3`,children:p.map((e,t)=>(0,R.jsx)(sS.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.05},children:(0,R.jsxs)(X,{className:`!p-0 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between p-4 cursor-pointer hover:bg-gray-50 transition-colors`,onClick:()=>i(r===t?null:t),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 text-white font-bold text-sm`,children:t+1}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-semibold text-gray-900`,children:e.name}),(0,R.jsxs)(`div`,{className:`text-sm text-gray-500`,children:[e.toolCalls,` 工具调用 · `,e.writeOps,` 写入 · `,e.artifacts.length,` 产物`]})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[e.duration&&(0,R.jsx)(`span`,{className:`text-sm text-gray-500`,children:wf(e.duration)}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[e.artifacts.slice(0,3).map((e,t)=>(0,R.jsx)(fS,{variant:`success`,size:`sm`,children:e},t)),e.artifacts.length>3&&(0,R.jsxs)(fS,{variant:`default`,size:`sm`,children:[`+`,e.artifacts.length-3]})]}),r===t?(0,R.jsx)(Bs,{className:`h-5 w-5 text-gray-400`}):(0,R.jsx)(Hs,{className:`h-5 w-5 text-gray-400`})]})]}),r===t&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`border-t border-gray-100`,children:(0,R.jsx)(`div`,{className:`p-4 max-h-96 overflow-y-auto space-y-2`,children:e.events.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,R.jsx)(`div`,{className:`text-gray-400 font-mono w-20 flex-shrink-0`,children:x4(Df(e.time),`HH:mm:ss`)}),(0,R.jsx)(fS,{size:`sm`,variant:e.hookType===`PostToolUse`?`success`:e.hookType===`PreToolUse`?`info`:e.hookType===`UserPromptSubmit`?`warning`:`default`,children:e.hookType}),e.toolName&&(0,R.jsx)(`span`,{className:`font-mono text-gray-700 font-medium`,children:e.toolName}),e.input&&(0,R.jsx)(`span`,{className:`text-gray-500 truncate max-w-md`,children:e.input})]},t))})})]})},t))}),a===`flow`&&(0,R.jsx)(X,{title:`数据流图 (${m.nodes.length} 节点)`,children:(0,R.jsx)(`div`,{className:`space-y-1 max-h-[600px] overflow-y-auto`,children:m.nodes.map((e,t)=>(0,R.jsxs)(sS.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:t*.02},className:`flex items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col items-center w-8`,children:[t>0&&(0,R.jsx)(`div`,{className:`w-0.5 h-3 bg-gray-300`}),(0,R.jsx)(`div`,{className:q(`w-3 h-3 rounded-full border-2`,e.type===`intent`?`bg-blue-500 border-blue-500`:e.type===`artifact`?`bg-green-500 border-green-500`:e.type===`quality`?`bg-yellow-500 border-yellow-500`:`bg-gray-400 border-gray-400`)}),t<m.nodes.length-1&&(0,R.jsx)(`div`,{className:`w-0.5 h-3 bg-gray-300`})]}),(0,R.jsxs)(`div`,{className:q(`flex-1 flex items-center gap-3 p-2 rounded-lg text-sm`,e.type===`intent`?`bg-blue-50`:e.type===`artifact`?`bg-green-50`:e.type===`quality`?`bg-yellow-50`:`bg-gray-50`),children:[(0,R.jsx)(`span`,{className:`font-mono text-xs text-gray-400`,children:x4(Df(e.time),`HH:mm:ss`)}),(0,R.jsx)(fS,{size:`sm`,variant:e.type===`intent`?`info`:e.type===`artifact`?`success`:e.type===`quality`?`warning`:`default`,children:e.label}),e.detail&&(0,R.jsx)(`span`,{className:`text-gray-600 truncate`,children:e.detail})]})]},e.id))})}),a===`events`&&(0,R.jsx)(X,{title:`全部事件 (${c.events.length})`,children:(0,R.jsx)(`div`,{className:`overflow-x-auto`,children:(0,R.jsxs)(`table`,{className:`w-full`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`类型`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`工具`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`详情`})]})}),(0,R.jsx)(`tbody`,{className:`text-sm`,children:c.events.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-gray-50 hover:bg-gray-50`,children:[(0,R.jsx)(`td`,{className:`py-2 font-mono text-gray-500`,children:x4(Df(e.timestamp),`HH:mm:ss`)}),(0,R.jsx)(`td`,{className:`py-2`,children:(0,R.jsx)(fS,{size:`sm`,variant:e.hook_type===`PostToolUse`?`success`:e.hook_type===`UserPromptSubmit`?`warning`:`default`,children:e.hook_type})}),(0,R.jsx)(`td`,{className:`py-2 font-mono`,children:e.tool_name||`-`}),(0,R.jsx)(`td`,{className:`py-2 text-gray-500 truncate max-w-md`,children:typeof e.tool_input==`string`?e.tool_input.slice(0,80):``})]},e.id))})]})})}),(0,R.jsx)(X,{title:`工具使用分布`,children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:_,layout:`vertical`,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`,stroke:`#e5e7eb`}),(0,R.jsx)(Y$,{type:`number`}),(0,R.jsx)(u1,{dataKey:`name`,type:`category`,width:80,tick:{fontSize:12}}),(0,R.jsx)(VW,{}),(0,R.jsx)(O$,{dataKey:`value`,fill:`#3b82f6`,radius:[0,4,4,0]})]})})})]})}var Q4={PreToolUse:`bg-blue-100 text-blue-700`,PostToolUse:`bg-green-100 text-green-700`,UserPromptSubmit:`bg-amber-100 text-amber-700`,Stop:`bg-red-100 text-red-700`,Notification:`bg-purple-100 text-purple-700`};function $4(e){if(!e)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function e3(e){if(e.hook_type===`UserPromptSubmit`){let t=e.user_prompt;return{title:`用户输入`,subtitle:t?t.slice(0,80):`用户提交了新请求`}}if(e.tool_name){let t=e.tool_input;return t?.file_path?{title:`${e.tool_name} 文件`,subtitle:String(t.file_path).split(`/`).slice(-2).join(`/`)}:t?.command?{title:`${e.tool_name} 命令`,subtitle:String(t.command).slice(0,100)}:t?.pattern?{title:`${e.tool_name} 搜索`,subtitle:String(t.pattern)}:{title:e.tool_name,subtitle:e.hook_type}}return{title:e.hook_type,subtitle:e.project_path.split(`/`).pop()||``}}function t3(){let e=Ye(),[t,n]=(0,L.useState)(50),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(``),p=cS(d),[m,h]=(0,L.useState)(``),[g,_]=(0,L.useState)(``),[v,y]=(0,L.useState)(`all`),[b,x]=(0,L.useState)(30),[S,C]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),w=(0,L.useRef)(null),T=v===`all`?void 0:x4(C4(new Date,v===`1d`?1:v===`7d`?7:30),`yyyy-MM-dd'T'HH:mm:ss`),{data:E,isLoading:D,isError:O,refetch:k}=ut({queryKey:[`events`,{limit:t,tool_name:r||void 0,start_time:T,search:m||void 0}],queryFn:()=>hl({limit:t,tool_name:r||void 0,start_time:T,search:m||void 0}).then(e=>e.data)}),A=z({mutationFn:e=>gu(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`events`]})}}),j=E?.items.filter(e=>!(a&&e.hook_type!==a||s&&e.project_path.split(`/`).pop()!==s||p&&![e.tool_name,$4(e.tool_input),$4(e.tool_output)].join(` `).toLowerCase().includes(p.toLowerCase())))||[],M=G4({count:j.length,getScrollElement:()=>w.current,estimateSize:()=>120,overscan:5});if(D)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});if(O)return(0,R.jsx)(q4,{message:`事件数据加载失败`,onRetry:()=>k()});let N=Array.from(new Set(E?.items.map(e=>e.project_path.split(`/`).pop()||``).filter(Boolean)||[])),ee=j.reduce((e,t)=>{let n=t.tool_name||`N/A`;return e[n]=(e[n]||0)+1,e},{}),te=Object.entries(ee).sort((e,t)=>t[1]-e[1]).slice(0,10),P=Array.from(new Set(E?.items.map(e=>e.hook_type)||[]));return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center flex-1`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`实时过滤:工具名、文件名...`,value:d,onChange:e=>{f(e.target.value)},className:`w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`})]}),(0,R.jsx)(`div`,{className:`relative min-w-[200px] max-w-xs`,children:(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h(g)},children:[(0,R.jsx)(`input`,{type:`text`,placeholder:`全文搜索内容(回车提交)...`,value:g,onChange:e=>_(e.target.value),className:q(`w-full pl-3 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`,m?`border-blue-400 bg-blue-50`:`border-gray-200`)}),m&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>{h(``),_(``)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 text-xs`,children:`✕`})]})}),(0,R.jsxs)(`select`,{value:a,onChange:e=>{o(e.target.value)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:``,children:`全部类型`}),P.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}),(0,R.jsxs)(`select`,{value:s,onChange:e=>{c(e.target.value)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:``,children:`全部项目`}),N.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden text-sm`,children:[(0,R.jsx)(Is,{className:`h-3.5 w-3.5 text-gray-400 ml-2`}),[`all`,`1d`,`7d`,`30d`].map(e=>(0,R.jsx)(`button`,{onClick:()=>{y(e)},className:q(`px-2.5 py-2 transition-colors`,v===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:e===`all`?`全部`:e},e))]}),(0,R.jsxs)(`select`,{value:t,onChange:e=>n(Number(e.target.value)),className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:20,children:`20 条`}),(0,R.jsx)(`option`,{value:50,children:`50 条`}),(0,R.jsx)(`option`,{value:100,children:`100 条`})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,R.jsxs)(`select`,{value:b,onChange:e=>x(Number(e.target.value)),className:`px-2 py-1.5 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:7,children:`7天`}),(0,R.jsx)(`option`,{value:30,children:`30天`}),(0,R.jsx)(`option`,{value:90,children:`90天`})]}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:nc,onClick:()=>{let e=[`时间`,`类型`,`工具`,`项目`,`会话ID`,`摘要`],t=j.map(e=>{let t=e3(e);return[e.timestamp,e.hook_type,e.tool_name||``,e.project_path.split(`/`).pop()||``,e.session_id.slice(0,12),t.subtitle]});K4(`events-${x4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出`}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Jc,onClick:()=>{C({open:!0,title:`清理历史事件`,description:`确认清理 ${b} 天前的已蒸馏事件?此操作不可撤销。`,onConfirm:()=>{A.mutate(b),C({...S,open:!1})}})},loading:A.isPending,children:`清理历史`}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Pc,onClick:()=>k(),children:`刷新`})]})]})}),(0,R.jsx)(X,{title:`工具使用频率`,children:(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:te.map(([e,t])=>(0,R.jsxs)(`button`,{onClick:()=>{i(r===e?``:e)},className:q(`px-3 py-1.5 rounded-full text-sm transition-all`,r===e?`bg-blue-100 text-blue-700 border-2 border-blue-300`:`bg-gray-100 text-gray-700 hover:bg-gray-200 border-2 border-transparent`),children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e}),(0,R.jsx)(`span`,{className:`ml-1 text-xs opacity-70`,children:t})]},e))})}),(0,R.jsx)(X,{title:`执行轨迹 (${j.length})`,children:(0,R.jsx)(`div`,{ref:w,className:`h-[600px] overflow-auto`,style:{contain:`strict`},children:(0,R.jsx)(`div`,{style:{height:`${M.getTotalSize()}px`,width:`100%`,position:`relative`},children:M.getVirtualItems().map(e=>{let t=j[e.index],n=e3(t),r=l===t.event_id;return(0,R.jsx)(`div`,{"data-index":e.index,ref:M.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},className:`pb-2`,children:(0,R.jsxs)(`div`,{className:`border border-gray-100 rounded-lg overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between p-3 hover:bg-gray-50 cursor-pointer`,onClick:()=>u(r?null:t.event_id),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,R.jsx)(`button`,{className:`text-gray-400`,children:r?(0,R.jsx)(Bs,{className:`h-4 w-4`}):(0,R.jsx)(Hs,{className:`h-4 w-4`})}),(0,R.jsx)(fS,{size:`sm`,className:Q4[t.hook_type]||`bg-gray-100 text-gray-700`,children:t.hook_type}),t.tool_name&&(0,R.jsxs)(`div`,{className:`flex items-center gap-1 text-sm text-gray-700 flex-shrink-0`,children:[t.tool_name===`Bash`?(0,R.jsx)(Kc,{className:`h-4 w-4`}):(0,R.jsx)(oc,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`font-mono`,children:t.tool_name})]}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium text-gray-900 truncate`,children:n.title}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500 truncate`,children:n.subtitle})]})]}),(0,R.jsx)(`div`,{className:`text-xs text-gray-400 font-mono ml-3`,children:x4(Df(t.timestamp),`HH:mm:ss`)})]}),(0,R.jsx)(gb,{children:r&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`border-t border-gray-100 bg-gray-50`,children:(0,R.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3 text-xs`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`会话`}),(0,R.jsxs)(`div`,{className:`font-mono text-gray-700`,children:[t.session_id.slice(0,12),`...`]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`项目`}),(0,R.jsx)(`div`,{className:`text-gray-700`,children:t.project_path.split(`/`).pop()})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`时间`}),(0,R.jsx)(`div`,{className:`font-mono text-gray-700`,children:t.timestamp})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`类型`}),(0,R.jsx)(`div`,{className:`text-gray-700`,children:t.hook_type})]})]}),t.tool_input&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider`,children:[(0,R.jsx)(Tc,{className:`h-3 w-3`}),` 输入`]}),(0,R.jsx)(`pre`,{className:`bg-white p-3 rounded-lg text-xs font-mono overflow-x-auto border border-gray-200 text-gray-700 whitespace-pre-wrap break-all`,children:$4(t.tool_input)})]}),t.tool_output&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider`,children:[(0,R.jsx)(Ns,{className:`h-3 w-3`}),` 输出`]}),(0,R.jsx)(`pre`,{className:`bg-white p-3 rounded-lg text-xs font-mono overflow-x-auto border border-gray-200 text-gray-700 whitespace-pre-wrap break-all max-h-64 overflow-y-auto`,children:$4(t.tool_output)})]})]})})})]})},t.event_id)})})})}),(0,R.jsx)(w4,{open:S.open,title:S.title,description:S.description,variant:`danger`,onConfirm:S.onConfirm,onCancel:()=>C({...S,open:!1})})]})}function n3({currentPage:e,totalPages:t,onPageChange:n,pageSize:r,onPageSizeChange:i,totalItems:a}){return(0,R.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-t border-gray-200`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsxs)(`span`,{className:`text-sm text-gray-600`,children:[`显示 `,(e-1)*r+1,`-`,Math.min(e*r,a),` / 共 `,a,` 条`]}),(0,R.jsxs)(`select`,{value:r,onChange:e=>i(Number(e.target.value)),className:`px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:10,children:`10 条/页`}),(0,R.jsx)(`option`,{value:20,children:`20 条/页`}),(0,R.jsx)(`option`,{value:50,children:`50 条/页`}),(0,R.jsx)(`option`,{value:100,children:`100 条/页`})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Vs,onClick:()=>n(e-1),disabled:e===1,children:`上一页`}),(0,R.jsx)(`div`,{className:`flex items-center gap-1`,children:Array.from({length:Math.min(t,7)},(r,i)=>{let a;return a=t<=7||e<=4?i+1:e>=t-3?t-6+i:e-3+i,(0,R.jsx)(`button`,{onClick:()=>n(a),className:`px-3 py-1.5 text-sm rounded-lg transition-colors ${e===a?`bg-blue-600 text-white`:`text-gray-600 hover:bg-gray-100`}`,children:a},a)})}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Hs,onClick:()=>n(e+1),disabled:e===t,children:`下一页`})]})]})}function r3(){let e=Ye(),t=Fn(),[n,r]=(0,L.useState)(``),i=cS(n),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(`all`),[l,u]=(0,L.useState)(1),[d,f]=(0,L.useState)(20),[p,m]=(0,L.useState)(new Set),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:y,isLoading:b,isError:x,refetch:S}=ut({queryKey:[`pipelines`,`active`],queryFn:()=>_l({status:`active`,page_size:100}).then(e=>e.data),refetchInterval:1e4}),{data:C,refetch:w}=ut({queryKey:[`pipelines`,`completed`,i,a,l,d],queryFn:()=>_l({status:`completed`,search:i||void 0,complexity:a||void 0,page:l,page_size:d}).then(e=>e.data)}),T=z({mutationFn:e=>Nl(e),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),E=z({mutationFn:()=>Il(),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),D=z({mutationFn:e=>Fl(e),onSuccess:t=>{e.invalidateQueries({queryKey:[`pipelines`]}),m(new Set),t.failed.length>0&&alert(`关闭完成:成功 ${t.success.length} 个,失败 ${t.failed.length} 个\n失败原因:\n${t.errors.map(e=>`${e.id}: ${e.reason}`).join(`
69
+ `)}`)}});if(b)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});if(x)return(0,R.jsx)(q4,{message:`Pipeline 数据加载失败`,onRetry:()=>S()});let O=y?.items||[],k=C?.items||[],A=C?.total||0,j=O.filter(e=>!h||e.requirement.toLowerCase().includes(h.toLowerCase())||e.project.toLowerCase().includes(h.toLowerCase())),M=s===`all`||s===`active`,N=s===`all`||s===`completed`,ee=Math.ceil(A/d);return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[O.length,` 个活跃 · `,A,` 个已完成`,p.size>0&&` · 已选 ${p.size} 个`]}),(0,R.jsxs)(`select`,{value:s,onChange:e=>{c(e.target.value),u(1)},className:`px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:`all`,children:`全部状态`}),(0,R.jsx)(`option`,{value:`active`,children:`仅活跃`}),(0,R.jsx)(`option`,{value:`completed`,children:`仅已完成`})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[j.length>0&&p.size>0&&(0,R.jsxs)(Y,{variant:`danger`,size:`sm`,icon:el,onClick:()=>{p.size!==0&&v({open:!0,title:`批量关闭 Pipeline`,description:`确认关闭选中的 ${p.size} 个 Pipeline?`,count:p.size,onConfirm:()=>{D.mutate(Array.from(p)),v(e=>({...e,open:!1}))}})},loading:D.isPending,children:[`批量关闭 (`,p.size,`)`]}),j.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>{p.size===j.length?m(new Set):m(new Set(j.map(e=>e.id)))},children:p.size===j.length?`取消全选`:`全选`}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,icon:Jc,onClick:()=>{v({open:!0,title:`清理过期 Pipeline`,description:`确认关闭所有过期 Pipeline?`,onConfirm:()=>{E.mutate(),v(e=>({...e,open:!1}))}})},loading:E.isPending,children:`清理过期`})]}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Pc,onClick:()=>S(),children:`刷新`}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:nc,onClick:()=>{let e=[...O,...k];K4(`pipelines-${x4(new Date,`yyyyMMdd-HHmmss`)}.csv`,[`ID`,`需求`,`复杂度`,`状态`,`项目`,`创建时间`],e.map(e=>[e.id,e.requirement,e.complexity,e.status,e.project,e.createdAt]))},children:`导出 CSV`})]})]}),M&&O.length>0&&(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,R.jsxs)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider`,children:[`活跃中 (`,j.length,`/`,O.length,`)`]}),(0,R.jsxs)(`div`,{className:`relative w-64`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`搜索活跃 Pipeline...`,value:h,onChange:e=>g(e.target.value),className:`w-full pl-10 pr-4 py-1.5 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`})]})]}),(0,R.jsx)(`div`,{className:`space-y-3`,children:j.map((e,n)=>(0,R.jsx)(sS.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.05},children:(0,R.jsx)(X,{className:`!p-0 overflow-hidden cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>t(`/pipelines/${e.id}`),children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4 flex-1 min-w-0`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:p.has(e.id),onChange:t=>{t.stopPropagation(),m(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 flex-shrink-0`}),(0,R.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg`,style:{backgroundColor:`#10b98120`},children:(0,R.jsx)(pc,{className:`h-5 w-5`,style:{color:`#10b981`}})}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`div`,{className:`font-medium text-gray-900 truncate`,children:e.requirement}),(0,R.jsxs)(`div`,{className:`text-sm text-gray-500 flex items-center gap-3 mt-1`,children:[(0,R.jsx)(fS,{variant:`primary`,size:`sm`,children:`动态`}),(0,R.jsx)(`span`,{children:e.project}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(Ys,{className:`h-3 w-3`}),x4(Df(e.createdAt),`MM-dd HH:mm`)]})]}),e.type===`dynamic`&&e.nodeConfig&&(0,R.jsxs)(`div`,{className:`mt-2 flex items-center gap-3 text-xs text-gray-600`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(pc,{className:`h-3 w-3`}),e.nodeConfig.totalNodes,` 个节点`]}),e.nodeConfig.boundSkills.length>0&&(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`⚡ `,e.nodeConfig.boundSkills.length,` 个技能`]}),(0,R.jsxs)(`span`,{className:`text-gray-400`,children:[`节点类型:`,e.nodeConfig.nodeTypes.map(e=>e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)).join(` → `)]})]})]})]}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,icon:el,onClick:()=>{v({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{T.mutate(e.id),v(e=>({...e,open:!1}))}})},loading:T.isPending,children:`关闭`})]})})},e.id))})]}),N&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider mb-3`,children:`历史记录`}),(0,R.jsxs)(X,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center mb-4 pb-4 border-b border-gray-100`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`搜索需求描述...`,value:n,onChange:e=>{r(e.target.value),u(1)},className:`w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`})]}),(0,R.jsxs)(`select`,{value:a,onChange:e=>{o(e.target.value),u(1)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,R.jsx)(`option`,{value:``,children:`全部复杂度`}),(0,R.jsx)(`option`,{value:`simple`,children:`简单`}),(0,R.jsx)(`option`,{value:`moderate`,children:`中等`}),(0,R.jsx)(`option`,{value:`complex`,children:`复杂`})]})]}),(0,R.jsx)(`div`,{className:`overflow-x-auto`,children:(0,R.jsxs)(`table`,{className:`w-full`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`需求`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`项目`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`类型`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`复杂度`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`}),(0,R.jsx)(`th`,{className:`pb-3 font-medium`,children:`操作`})]})}),(0,R.jsx)(`tbody`,{className:`text-sm`,children:k.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-gray-50 hover:bg-gray-50 cursor-pointer`,onClick:()=>t(`/pipelines/${e.id}`),children:[(0,R.jsx)(`td`,{className:`py-3 max-w-xs truncate`,children:e.requirement}),(0,R.jsx)(`td`,{className:`py-3`,children:e.project}),(0,R.jsx)(`td`,{className:`py-3`,children:(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(fS,{size:`sm`,variant:`primary`,children:`动态编排`}),e.nodeConfig&&(0,R.jsxs)(`div`,{className:`text-xs text-gray-500 space-y-0.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(pc,{className:`h-3 w-3`}),e.nodeConfig.totalNodes,` 节点`,e.nodeConfig.boundSkills.length>0&&(0,R.jsxs)(`span`,{className:`ml-1`,children:[`· ⚡ `,e.nodeConfig.boundSkills.length,` 技能`]})]}),(0,R.jsx)(`div`,{className:`text-gray-400 max-w-[200px] truncate`,children:e.nodeConfig.nodeTypes.map(e=>e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)).join(` → `)})]})]})}),(0,R.jsx)(`td`,{className:`py-3`,children:(0,R.jsx)(fS,{size:`sm`,variant:e.complexity===`complex`?`danger`:e.complexity===`moderate`?`warning`:`default`,children:e.complexity||`-`})}),(0,R.jsx)(`td`,{className:`py-3 text-gray-500`,children:x4(Df(e.createdAt),`MM-dd HH:mm`)}),(0,R.jsx)(`td`,{className:`py-3`,children:(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:ac,onClick:n=>{n.stopPropagation(),t(`/pipelines/${e.id}`)},children:`查看`})})]},e.id))})]})}),A===0&&(0,R.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无历史记录`}),A>0&&(0,R.jsx)(n3,{currentPage:l,totalPages:ee,onPageChange:u,pageSize:d,onPageSizeChange:e=>{f(e),u(1)},totalItems:A})]})]}),(0,R.jsx)(w4,{open:_.open,title:_.title,description:_.description,count:_.count,variant:`danger`,onConfirm:_.onConfirm,onCancel:()=>v({..._,open:!1})})]})}var i3={pending:Js,running:Ys,validating:Fc,passed:Gs,failed:qs,need_human:Ws},a3={pending:`text-gray-400`,running:`text-blue-500`,validating:`text-yellow-500`,passed:`text-green-500`,failed:`text-red-500`,need_human:`text-orange-500`},o3={pending:`待执行`,running:`执行中`,validating:`验证中`,passed:`已完成`,failed:`失败`,need_human:`需人工介入`};function s3({steps:e,currentStepId:t}){return!e||e.length===0?null:(0,R.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,R.jsxs)(`div`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:[`步骤进度 (`,e.filter(e=>e.status===`passed`).length,`/`,e.length,`)`]}),(0,R.jsx)(`div`,{className:`space-y-2`,children:e.map((e,n)=>{let r=i3[e.status],i=e.id===t;return(0,R.jsxs)(`div`,{className:q(`flex items-start gap-3 p-3 rounded-lg border transition-colors`,i?`bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800`:`bg-gray-50 dark:bg-gray-800/50 border-gray-200 dark:border-gray-700`),children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-6 h-6 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center text-xs font-medium`,children:n+1}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,R.jsx)(r,{className:q(`w-4 h-4`,a3[e.status])}),(0,R.jsx)(`span`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100`,children:e.stepName}),(0,R.jsx)(fS,{variant:e.status===`passed`?`success`:e.status===`failed`?`error`:`default`,children:o3[e.status]}),i&&(0,R.jsx)(fS,{variant:`info`,children:`当前`})]}),e.attempts>0&&(0,R.jsxs)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-1`,children:[`重试次数:`,e.attempts]}),e.failureReason&&(0,R.jsxs)(`div`,{className:`text-xs text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/20 p-2 rounded mt-1`,children:[`失败原因:`,e.failureReason]}),e.outputs&&Object.keys(e.outputs).length>0&&(0,R.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,R.jsx)(`div`,{className:`text-gray-600 dark:text-gray-400 mb-1`,children:`输出产物:`}),(0,R.jsx)(`div`,{className:`space-y-1`,children:Object.entries(e.outputs).map(([e,t])=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-700 dark:text-gray-300`,children:[(0,R.jsxs)(`span`,{className:`font-medium`,children:[e,`:`]}),(0,R.jsx)(`a`,{href:`file://${t}`,className:`text-blue-600 dark:text-blue-400 hover:underline truncate`,title:t,children:t})]},e))})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-4 mt-2 text-xs text-gray-500 dark:text-gray-400`,children:[e.startedAt&&(0,R.jsxs)(`span`,{children:[`开始:`,x4(new Date(e.startedAt),`HH:mm:ss`)]}),e.completedAt&&(0,R.jsxs)(`span`,{children:[`完成:`,x4(new Date(e.completedAt),`HH:mm:ss`)]})]})]})]},e.id)})})]})}var c3={document:cc,code:Xs,test:qc,config:Rc,diagram:gc,data:ec,other:lc},l3={analyze:{name:`需求分析`,description:`分析需求,明确目标和范围`},design:{name:`架构设计`,description:`设计系统架构和技术方案`},profile:{name:`性能分析`,description:`分析性能瓶颈,制定优化方案`},code:{name:`编码实现`,description:`编写代码,实现功能`},test:{name:`测试验证`,description:`编写测试,验证功能正确性`},review:{name:`代码审查`,description:`审查代码质量和规范`}},u3={analy:`#3b82f6`,design:`#8b5cf6`,architect:`#8b5cf6`,profile:`#06b6d4`,code:`#10b981`,implement:`#10b981`,test:`#f59e0b`,verif:`#f59e0b`,review:`#ef4444`,deploy:`#06b6d4`};function d3(e){let t=e.toLowerCase();for(let[e,n]of Object.entries(u3))if(t.includes(e))return n;return`#6b7280`}function f3(e){let t=l3[e];return t?t.name:e.split(/[_\-.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function p3(e){return l3[e]?.description||null}function m3(e){let t=new Set,n=[],r=new Map(e.map(e=>[e.id,e]));function i(e){if(t.has(e))return;t.add(e);let a=r.get(e);a&&((a.dependencies||[]).forEach(e=>i(e)),n.push(a))}return e.forEach(e=>i(e.id)),n}function h3(e,t){if(!e)return null;let n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),i=Math.floor((r-n)/1e3);return i<60?`${i}s`:`${Math.floor(i/60)}m ${i%60}s`}function g3({pipeline:e,onRetryNode:t}){let[n,r]=(0,L.useState)(new Set),i=(0,L.useMemo)(()=>m3(e.nodes),[e.nodes]),a=i.filter(e=>e.status===`completed`||e.status===`skipped`).length,o=i.length>0&&i.every(e=>e.status===`completed`||e.status===`skipped`||e.status===`failed`),s=o?-1:i.findIndex(t=>t.id===e.currentNodeId),c=e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return i.length===0?(0,R.jsx)(X,{children:(0,R.jsx)(`div`,{className:`text-center py-8 text-gray-400`,children:`暂无节点`})}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(X,{className:`!p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,R.jsxs)(`span`,{className:`text-sm font-medium text-gray-700`,children:[`编排阶段 · `,a,`/`,i.length,` 已完成`]}),(0,R.jsx)(`span`,{className:`text-xs text-gray-400`,children:o||e.status===`completed`?`✅ 全部完成`:e.status===`failed`?`❌ 已失败`:s>=0?`当前:第 ${s+1} 阶段`:`准备中`})]}),(0,R.jsx)(`div`,{className:`flex items-start gap-0 overflow-x-auto pb-1`,children:i.map((t,n)=>{let r=t.id===e.currentNodeId,a=t.status===`completed`,o=t.status===`failed`,s=t.status===`skipped`,c=d3(t.nodeTypeId),l=o?`#ef4444`:s?`#9ca3af`:a||r?c:void 0;return(0,R.jsxs)(`div`,{className:`flex items-center flex-shrink-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,R.jsx)(`div`,{className:q(`w-9 h-9 rounded-full flex items-center justify-center text-xs font-bold transition-all`,l?`text-white`:`bg-gray-100 text-gray-400`,r&&`ring-4 ring-offset-2`),style:l?{backgroundColor:l,...r?{ringColor:`${c}40`}:{}}:{},children:a?`✓`:o?`✗`:s?`—`:n+1}),(0,R.jsx)(`span`,{className:q(`text-xs mt-1 max-w-[72px] text-center leading-tight break-words`,r?`font-bold text-gray-900`:`text-gray-500`),children:f3(t.nodeTypeId)})]}),n<i.length-1&&(0,R.jsx)(`div`,{className:q(`h-0.5 w-6 mx-0.5 mb-5 flex-shrink-0 transition-colors`,a?`bg-green-400`:`bg-gray-200`)})]},t.id)})})]}),(0,R.jsx)(`div`,{className:`space-y-3`,children:i.map((r,a)=>{let o=r.id===e.currentNodeId,s=d3(r.nodeTypeId),l=f3(r.nodeTypeId),u=p3(r.nodeTypeId),d=h3(r.startedAt,r.completedAt),f=n.has(r.id),p=null,m=null;if(r.output)try{let e=JSON.parse(r.output);e.artifacts&&e.validation?p=e:m=r.output}catch{m=r.output}let h=m?m.trim().split(`
68
70
  `):[],g=h.length>10,_=(r.dependencies||[]).map(e=>{let t=i.find(t=>t.id===e);return t?f3(t.nodeTypeId):e.slice(0,8)});return(0,R.jsxs)(X,{className:q(`!p-0 overflow-hidden transition-all`,o?`ring-2 ring-blue-400 ring-offset-1`:``),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,R.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center text-white font-bold text-sm flex-shrink-0`,style:{backgroundColor:r.status===`pending`?`#d1d5db`:r.status===`failed`?`#ef4444`:r.status===`skipped`?`#9ca3af`:s},children:r.status===`completed`?`✓`:r.status===`failed`?`✗`:r.status===`skipped`?`—`:a+1}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-gray-900`,children:l}),o&&(0,R.jsx)(fS,{variant:`info`,size:`sm`,children:`当前阶段`}),(0,R.jsx)(fS,{size:`sm`,variant:r.status===`completed`?`success`:r.status===`in_progress`?`info`:r.status===`failed`?`danger`:r.status===`skipped`?`warning`:`default`,children:r.status===`completed`?`已完成`:r.status===`in_progress`?`执行中`:r.status===`failed`?`失败`:r.status===`skipped`?`已跳过`:`等待中`}),d&&(0,R.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-gray-400`,children:[(0,R.jsx)(Ys,{className:`w-3 h-3`}),d]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5 mt-1`,children:[u&&(0,R.jsx)(`span`,{className:`text-xs text-gray-500`,children:u}),r.boundSkillName&&(0,R.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-amber-600`,children:[(0,R.jsx)(tl,{className:`w-3 h-3`}),r.boundSkillName]}),_.length>0&&(0,R.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`依赖:`,_.join(`, `)]}),r.completedAt&&(0,R.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`完成于 `,x4(new Date(r.completedAt),`HH:mm:ss`)]})]})]}),r.status===`failed`&&t&&(0,R.jsx)(Y,{variant:`outline`,size:`sm`,icon:Fc,onClick:()=>t(r.id),className:`flex-shrink-0`,children:`重试`})]}),p&&(0,R.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 px-4 pt-3 pb-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold text-gray-500 uppercase tracking-wider`,children:`阶段产出`}),!p.validation.passed&&(0,R.jsx)(fS,{variant:`danger`,size:`sm`,children:`验证失败`})]}),p.summary&&(0,R.jsx)(`div`,{className:`text-sm text-gray-700 mb-3`,children:p.summary}),p.artifacts.length>0&&(0,R.jsx)(`div`,{className:`space-y-2`,children:p.artifacts.map((e,t)=>(0,R.jsx)(`div`,{className:`bg-white rounded-lg border border-gray-200 p-3`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(c3[e.type]||lc,{className:`w-4 h-4 text-gray-400 mt-0.5 flex-shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`div`,{className:`font-mono text-sm text-gray-900 break-all`,children:e.path}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-xs text-gray-500`,children:[(0,R.jsx)(`span`,{className:`capitalize`,children:e.type}),e.size_bytes&&(0,R.jsxs)(`span`,{children:[`· `,(e.size_bytes/1024).toFixed(1),` KB`]}),(0,R.jsxs)(`span`,{children:[`· `,x4(new Date(e.created_at),`HH:mm:ss`)]})]})]})]})},t))}),p.validation.errors&&p.validation.errors.length>0&&(0,R.jsx)(`div`,{className:`mt-3 p-2 bg-red-50 border border-red-200 rounded text-xs text-red-700`,children:p.validation.errors.map((e,t)=>(0,R.jsxs)(`div`,{children:[`• `,e]},t))})]}),!p&&h.length>0&&(0,R.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 px-4 pt-3 pb-4`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold text-gray-500 uppercase tracking-wider`,children:`阶段产出`}),(0,R.jsx)(`div`,{className:q(`mt-2 text-sm text-gray-800 whitespace-pre-wrap font-mono bg-white rounded-lg border border-gray-100 p-3 leading-relaxed`,!f&&g?`max-h-52 overflow-hidden`:``),children:!f&&g?h.slice(0,10).join(`
69
71
  `)+`
70
- …`:m}),g&&(0,R.jsx)(`button`,{onClick:()=>c(r.id),className:`mt-2 text-xs text-blue-600 hover:underline flex items-center gap-1`,children:f?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Us,{className:`w-3 h-3`}),`收起`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Bs,{className:`w-3 h-3`}),`展开全部(`,h.length,` 行)`]})})]}),r.stepExecutions&&r.stepExecutions.length>0&&(0,R.jsx)(`div`,{className:`border-t border-gray-100 bg-white px-4 py-3`,children:(0,R.jsx)(s3,{steps:r.stepExecutions,currentStepId:r.currentStepId})}),r.status===`in_progress`&&h.length===0&&(0,R.jsxs)(`div`,{className:`border-t border-blue-100 bg-blue-50 px-4 py-3 flex items-center gap-2 text-sm text-blue-600`,children:[(0,R.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500 animate-pulse`}),`正在执行,等待产出…`]})]},r.id)})})]})}var _3={PreToolUse:`#3b82f6`,PostToolUse:`#10b981`,UserPromptSubmit:`#f59e0b`,Stop:`#ef4444`};function v3(){let{id:e}=Ln(),t=Fn(),n=Mn(),r=Ye(),[i,a]=(0,L.useState)(`tasks`),[o,s]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),c=n.state?.from||`/pipelines`,{data:l,isLoading:u,isError:d,error:f}=ut({queryKey:[`pipeline`,e],queryFn:()=>vl(e).then(e=>e.data),enabled:!!e,refetchInterval:5e3}),p=z({mutationFn:()=>Nl(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),t(c)},onError:e=>H(e.message||`关闭失败`,`error`)}),m=z({mutationFn:()=>Pl(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),H(`Pipeline 已重新激活`,`success`)},onError:e=>H(e.message||`重新激活失败`,`error`)}),h=z({mutationFn:()=>Rl(e),onSuccess:()=>{H(`已添加到执行队列,下次工具调用时自动注入提示`,`success`)},onError:e=>H(e.message||`恢复失败`,`error`)}),g=z({mutationFn:t=>zl(e),onSuccess:t=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),H(t.data.message||`节点已重置,等待重新执行`,`success`)},onError:e=>H(e.message||`重试失败`,`error`)}),_=z({mutationFn:e=>nu(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),H(`问题已标记为已解决`,`success`)},onError:e=>H(e.message||`操作失败`,`error`)}),v=z({mutationFn:e=>ru(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),H(`问题已忽略`,`success`)},onError:e=>H(e.message||`操作失败`,`error`)});if(d)return(0,R.jsxs)(`div`,{className:`flex items-center justify-center h-96 text-red-500`,children:[`加载失败:`,f?.message||`未知错误`]});if(u||!l)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let y=l,b=y.status!==`completed`&&y.status!==`failed`;return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X4,{items:[{label:`Pipeline 列表`,path:`/pipelines`},{label:l.id.slice(0,12)+`...`}]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:ks,onClick:()=>t(c),children:`返回`}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`h2`,{className:`text-lg font-bold text-gray-900`,children:`Pipeline 执行轨迹`}),(0,R.jsxs)(fS,{variant:`primary`,size:`sm`,children:[(0,R.jsx)(Qc,{className:`w-3 h-3 mr-1`}),` 动态编排`]})]}),(0,R.jsxs)(`p`,{className:`text-sm text-gray-500`,children:[(0,R.jsx)(`span`,{className:`font-mono`,children:l.id.slice(0,12)}),l.sessionId&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`mx-2`,children:`·`}),(0,R.jsxs)(`span`,{className:`text-blue-600 cursor-pointer hover:underline`,onClick:()=>t(`/sessions/${l.sessionId}`),children:[`会话 `,l.sessionId.slice(0,8)]})]})]})]}),(0,R.jsx)(fS,{variant:b?`info`:`success`,children:y.status===`completed`?`已完成`:y.status===`failed`?`已失败`:`执行中`}),(0,R.jsx)(fS,{variant:l.complexity===`complex`?`danger`:l.complexity===`moderate`?`warning`:`default`,children:l.complexity})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[l.sessionId&&(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Ds,onClick:()=>t(`/sessions/${l.sessionId}`),children:`查看会话`}),b&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Y,{variant:`primary`,size:`sm`,onClick:()=>h.mutate(),loading:h.isPending,children:`继续执行`}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,icon:el,onClick:()=>{s({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{p.mutate(),s(e=>({...e,open:!1}))}})},children:`关闭`})]}),!b&&(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Pc,onClick:()=>{s({open:!0,title:`重新激活 Pipeline`,description:`确认重新激活此 Pipeline?状态将重置为活跃。`,onConfirm:()=>{m.mutate(),s(e=>({...e,open:!1}))}})},loading:m.isPending,children:`重新激活`})]})]}),(0,R.jsx)(X,{className:`!p-4`,children:(0,R.jsx)(`p`,{className:`text-sm text-gray-700 line-clamp-3`,children:l.requirement})}),y.executionPlan&&(0,R.jsx)(X,{title:`编排计划`,className:`!p-4`,children:(0,R.jsxs)(`div`,{className:`space-y-4`,children:[y.reasoning&&(0,R.jsxs)(`div`,{className:`text-sm text-gray-600 bg-blue-50 p-3 rounded-lg border border-blue-100`,children:[(0,R.jsx)(`div`,{className:`font-medium text-blue-900 mb-1`,children:`规划依据`}),(0,R.jsx)(`p`,{className:`text-blue-800`,children:y.reasoning})]}),(0,R.jsx)(`div`,{className:`space-y-2`,children:y.executionPlan.stages.map((e,t)=>{let n=y.nodes.find(t=>t.nodeTypeId===e.nodeTypeId),r=n?.status===`completed`,i=n?.status===`in_progress`,a=!n||n.status===`pending`;return(0,R.jsxs)(`div`,{className:q(`flex items-start gap-3 p-3 rounded-lg border`,r&&`bg-green-50 border-green-200`,i&&`bg-blue-50 border-blue-200`,a&&`bg-gray-50 border-gray-200`),children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold`,style:{backgroundColor:r?`#10b981`:i?`#3b82f6`:`#9ca3af`,color:`white`},children:t+1}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium text-gray-900`,children:e.name}),(0,R.jsx)(fS,{size:`sm`,variant:r?`success`:i?`info`:`default`,children:r?`已完成`:i?`进行中`:`待执行`}),e.phase&&(0,R.jsx)(fS,{size:`sm`,children:e.phase})]}),e.description&&(0,R.jsx)(`p`,{className:`text-sm text-gray-600 mt-1`,children:e.description}),e.expectedArtifacts&&e.expectedArtifacts.length>0&&(0,R.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`预期产物:`}),e.expectedArtifacts.map((e,t)=>(0,R.jsxs)(`span`,{className:`ml-1 font-mono bg-gray-100 px-1.5 py-0.5 rounded`,children:[e.pattern,e.required&&(0,R.jsx)(`span`,{className:`text-red-500`,children:`*`})]},t))]})]})]},t)})})]})}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-3`,children:[(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-blue-600`,children:l.stats.totalEvents}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`事件`})]}),(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-green-600`,children:`${y.stats.completedNodes}/${y.stats.totalNodes}`}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`节点`})]}),(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-purple-600`,children:l.stats.totalArtifacts}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`产物`})]}),(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-orange-600`,children:l.stats.totalQualityIssues}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`质量问题`})]}),(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-red-600`,children:l.stats.unresolvedQuality}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`未解决`})]})]}),(0,R.jsx)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[`tasks`,`events`,`artifacts`,`quality`].map(e=>(0,R.jsx)(`button`,{onClick:()=>a(e),className:q(`px-4 py-2 rounded-md text-sm font-medium transition-colors`,i===e?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:{tasks:`编排图 (${y.stats.totalNodes})`,events:`事件 (${l.stats.totalEvents})`,artifacts:`产物 (${l.stats.totalArtifacts})`,quality:`质量 (${l.stats.totalQualityIssues})`}[e]},e))}),i===`tasks`&&(0,R.jsx)(`div`,{className:`space-y-4`,children:(0,R.jsx)(g3,{pipeline:y,onRetryNode:e=>{s({open:!0,title:`重试失败节点`,description:`确定要重试此节点吗?节点状态将重置为等待中,下次工具调用时自动重新执行。`,onConfirm:()=>{g.mutate(e),s(e=>({...e,open:!1}))}})}})}),i===`events`&&(0,R.jsx)(X,{title:`工具调用时间线`,children:(0,R.jsxs)(`div`,{className:`space-y-1 max-h-[600px] overflow-y-auto`,children:[l.events.map((e,t)=>(0,R.jsxs)(sS.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:t*.01},className:`flex items-center gap-3 py-1.5 px-2 rounded hover:bg-gray-50 text-sm`,children:[(0,R.jsx)(`span`,{className:`text-gray-400 font-mono w-16 flex-shrink-0`,children:x4(Df(e.time),`HH:mm:ss`)}),(0,R.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:_3[e.hookType]||`#6b7280`}}),(0,R.jsx)(`span`,{className:`font-mono text-gray-700 w-20 flex-shrink-0`,children:e.toolName||e.hookType}),(0,R.jsx)(`span`,{className:`text-gray-500 truncate`,children:e.detail||``})]},t)),l.events.length===0&&(0,R.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无事件`})]})}),i===`artifacts`&&(0,R.jsx)(X,{title:`产物文件`,children:(0,R.jsxs)(`div`,{className:`space-y-2`,children:[l.artifacts.map((e,t)=>(0,R.jsx)(sS.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:t*.03},className:`flex items-center justify-between p-3 rounded-lg border border-gray-100 hover:border-green-200 hover:bg-green-50/50`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(oc,{className:`h-5 w-5 text-green-500`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-mono text-sm text-gray-900`,children:e.filePath.split(`/`).slice(-2).join(`/`)}),(0,R.jsxs)(`div`,{className:`text-xs text-gray-400`,children:[e.tool,` · `,x4(Df(e.time),`HH:mm:ss`)]})]})]})},t)),l.artifacts.length===0&&(0,R.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无产物`})]})}),i===`quality`&&(0,R.jsx)(X,{title:`质量问题`,children:(0,R.jsxs)(`div`,{className:`space-y-2`,children:[l.qualityIssues.map((e,t)=>(0,R.jsxs)(sS.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:t*.03},className:`flex items-start justify-between p-3 rounded-lg border border-gray-100`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 flex-1`,children:[e.resolved?(0,R.jsx)(Gs,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,R.jsx)(Xc,{className:`h-5 w-5 text-amber-500 mt-0.5`}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(fS,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,R.jsx)(fS,{size:`sm`,children:e.category})]}),(0,R.jsx)(`p`,{className:`text-sm text-gray-700 mt-1`,children:e.message}),(0,R.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:x4(Df(e.createdAt),`MM-dd HH:mm`)})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(fS,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),!e.resolved&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>_.mutate(e.id),loading:_.isPending,children:`解决`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>v.mutate(e.id),loading:v.isPending,children:`忽略`})]})]})]},t)),l.qualityIssues.length===0&&(0,R.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,R.jsx)(zc,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`暂无质量问题`]})]})}),(0,R.jsx)(w4,{open:o.open,title:o.title,description:o.description,variant:`danger`,onConfirm:o.onConfirm,onCancel:()=>s({...o,open:!1})})]})}var y3={spec:{label:`规格`,icon:cc,color:`text-blue-600`,bg:`bg-blue-50`,border:`border-blue-200`},security:{label:`安全`,icon:Bc,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-200`},quality:{label:`质量`,icon:oc,color:`text-purple-600`,bg:`bg-purple-50`,border:`border-purple-200`},test:{label:`测试`,icon:qc,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-200`},performance:{label:`性能`,icon:tl,color:`text-orange-600`,bg:`bg-orange-50`,border:`border-orange-200`}},b3={fail:{label:`失败`,icon:qs,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-300`},warn:{label:`警告`,icon:Xc,color:`text-yellow-600`,bg:`bg-yellow-50`,border:`border-yellow-300`},pass:{label:`通过`,icon:Gs,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-300`}};function x3({level:e}){let t=b3[e];if(!t)return(0,R.jsx)(fS,{size:`sm`,children:e});let n=t.icon;return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,R.jsx)(n,{className:`h-3 w-3`}),t.label]})}function S3({category:e}){let t=y3[e];if(!t)return(0,R.jsx)(fS,{size:`sm`,children:e});let n=t.icon;return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,R.jsx)(n,{className:`h-3 w-3`}),t.label]})}function C3(){let e=Ye(),[t,n]=(0,L.useState)(``),r=cS(t),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(1),[g,_]=(0,L.useState)(20),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)(new Set),[w,T]=(0,L.useState)(`list`),[E,D]=(0,L.useState)(new Set),[O,k]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:A,isError:j,refetch:M}=ut({queryKey:[`quality-unresolved`],queryFn:()=>bl().then(e=>e.data),refetchInterval:1e4}),{data:N}=ut({queryKey:[`quality-history`,i,o,c,u,r],queryFn:()=>yl({limit:500,level:i||void 0,category:o||void 0,resolved:c===`resolved`?!0:c===`unresolved`?!1:void 0,project_path:u||void 0,search:r||void 0}).then(e=>e.data)}),{data:ee}=ut({queryKey:[`quality-history`,`all`],queryFn:()=>yl({limit:500}).then(e=>e.data)}),te=z({mutationFn:e=>nu(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),P=z({mutationFn:e=>ru(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),ne=z({mutationFn:()=>ou(),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),re=z({mutationFn:e=>iu(e),onSuccess:()=>{C(new Set),e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),ie=z({mutationFn:e=>au(e),onSuccess:()=>{C(new Set),e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),ae=async e=>{try{let t=await su(e);await navigator.clipboard.writeText(t.data.context),x(e),H(`上下文已复制,请粘贴到 Claude Code 进行修复`,`success`),setTimeout(()=>x(null),3e3)}catch{H(`复制失败`,`error`)}},F=N?.items||[],I=F.reduce((e,t)=>{let n=t.project_path?.split(`/`).pop()||`未知项目`;return e[n]||(e[n]=[]),e[n].push(t),e},{}),oe=Math.ceil(F.length/g),se=F.slice((m-1)*g,m*g),ce=ee?.total||0,le=A?.total||0,ue=F.filter(e=>e.level===`fail`).length,de=F.filter(e=>e.level===`warn`).length,fe=Array.from(new Set(ee?.items.map(e=>e.level)||[])),pe=Array.from(new Set(ee?.items.map(e=>e.category)||[])),me=Array.from(new Set(ee?.items.map(e=>e.project_path?.split(`/`).pop()||``).filter(Boolean)||[])),he=[i,o,c,u].filter(Boolean).length,ge=()=>{let e=[`级别`,`类别`,`消息`,`项目`,`状态`,`创建时间`],t=F.map(e=>[e.level,e.category,e.message,e.project_path?.split(`/`).pop()||``,e.resolved?`已解决`:`未解决`,e.created_at?x4(Df(e.created_at),`yyyy-MM-dd HH:mm:ss`):``]);K4(`quality-issues-${x4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)};return j?(0,R.jsx)(q4,{message:`质量数据加载失败`,onRetry:()=>M()}):(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`搜索问题描述...`,value:t,onChange:e=>{n(e.target.value),h(1)},className:`w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,R.jsxs)(`button`,{onClick:()=>p(e=>!e),className:q(`flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border transition-colors`,f||he>0?`border-blue-300 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:bg-gray-50`),children:[(0,R.jsx)(fc,{className:`h-4 w-4`}),`筛选`,he>0&&(0,R.jsx)(`span`,{className:`ml-1 px-1.5 py-0.5 bg-blue-600 text-white text-xs rounded-full`,children:he}),(0,R.jsx)(Bs,{className:q(`h-3.5 w-3.5 transition-transform`,f&&`rotate-180`)})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[S.size>0&&(0,R.jsxs)(Y,{variant:`secondary`,size:`sm`,icon:zs,onClick:()=>k({open:!0,title:`批量解决问题`,description:`确认将选中的 ${S.size} 个问题标记为已解决?`,count:S.size,onConfirm:()=>{ie.mutate(Array.from(S)),k(e=>({...e,open:!1}))}}),loading:ie.isPending,children:[`解决 (`,S.size,`)`]}),S.size>0&&(0,R.jsxs)(Y,{variant:`secondary`,size:`sm`,icon:el,onClick:()=>k({open:!0,title:`批量忽略问题`,description:`确认忽略选中的 ${S.size} 个问题?`,count:S.size,onConfirm:()=>{re.mutate(Array.from(S)),k(e=>({...e,open:!1}))}}),loading:re.isPending,children:[`忽略 (`,S.size,`)`]}),le>0&&(0,R.jsx)(Y,{variant:`primary`,size:`sm`,icon:zs,onClick:()=>k({open:!0,title:`全部标记已修复`,description:`确认将 ${le} 个问题全部标记为已修复?`,onConfirm:()=>{ne.mutate(),k(e=>({...e,open:!1}))}}),loading:ne.isPending,children:`全部已修复`}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:nc,onClick:()=>F.length>0&&ge(),children:`导出`}),(0,R.jsxs)(`div`,{className:`flex border border-gray-200 rounded-lg overflow-hidden`,children:[(0,R.jsx)(`button`,{onClick:()=>T(`list`),className:q(`px-2.5 py-1.5 text-sm transition-colors flex items-center gap-1`,w===`list`?`bg-blue-50 text-blue-700`:`text-gray-600 hover:bg-gray-50`),title:`列表视图`,children:(0,R.jsx)(xc,{className:`h-4 w-4`})}),(0,R.jsx)(`button`,{onClick:()=>T(`group`),className:q(`px-2.5 py-1.5 text-sm transition-colors flex items-center gap-1`,w===`group`?`bg-blue-50 text-blue-700`:`text-gray-600 hover:bg-gray-50`),title:`按项目分组`,children:(0,R.jsx)(uc,{className:`h-4 w-4`})})]})]})]}),f&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 pt-2 border-t border-gray-100`,children:[(0,R.jsxs)(`select`,{value:i,onChange:e=>{a(e.target.value),h(1)},className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部级别`}),fe.map(e=>(0,R.jsx)(`option`,{value:e,children:b3[e]?.label||e},e))]}),(0,R.jsxs)(`select`,{value:o,onChange:e=>{s(e.target.value),h(1)},className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部类别`}),pe.map(e=>(0,R.jsx)(`option`,{value:e,children:y3[e]?.label||e},e))]}),(0,R.jsxs)(`select`,{value:c,onChange:e=>{l(e.target.value),h(1)},className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部状态`}),(0,R.jsx)(`option`,{value:`resolved`,children:`已解决`}),(0,R.jsx)(`option`,{value:`unresolved`,children:`未解决`})]}),(0,R.jsxs)(`select`,{value:u,onChange:e=>{d(e.target.value),h(1)},className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部项目`}),me.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]})]})}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-red-600`,children:ue}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`失败`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-amber-600`,children:de}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`警告`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-orange-600`,children:le}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`未解决`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:ce}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总检查`})]})]}),(0,R.jsxs)(X,{title:`问题列表 (${F.length})`,action:F.length>0?(0,R.jsx)(`button`,{onClick:()=>{let e=w===`list`?se.filter(e=>!e.resolved).map(e=>String(e.id)):F.filter(e=>!e.resolved).map(e=>String(e.id));S.size===e.length&&e.length>0?C(new Set):C(new Set(e))},className:`text-xs text-blue-600 hover:underline`,children:S.size>0?`取消全选`:w===`list`?`全选当前页未解决`:`全选所有未解决`}):void 0,children:[w===`list`?(0,R.jsx)(`div`,{className:`space-y-2`,children:se.map((e,t)=>{let n=v===String(e.id||t);return(0,R.jsxs)(`div`,{className:`rounded-lg border border-gray-100 overflow-hidden`,children:[(0,R.jsxs)(sS.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.02},className:q(`flex items-center gap-3 p-4 cursor-pointer transition-all`,S.has(String(e.id))?`bg-blue-50`:`hover:bg-gray-50`),onClick:()=>y(n?null:String(e.id||t)),children:[e.resolved?(0,R.jsx)(`div`,{className:`h-4 w-4 flex-shrink-0`}):(0,R.jsx)(`input`,{type:`checkbox`,checked:S.has(String(e.id)),onChange:t=>{t.stopPropagation(),C(t=>{let n=new Set(t);return n.has(String(e.id))?n.delete(String(e.id)):n.add(String(e.id)),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 cursor-pointer flex-shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-5 gap-3 items-center min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,R.jsx)(x3,{level:e.level}),(0,R.jsx)(S3,{category:e.category})]}),(0,R.jsx)(`div`,{className:`md:col-span-2 min-w-0`,children:(0,R.jsx)(`p`,{className:`text-sm text-gray-700 truncate`,children:e.message})}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500 truncate`,children:e.project_path?.split(`/`).pop()||`-`}),(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,R.jsx)(fS,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),(0,R.jsx)(`span`,{className:`text-xs text-gray-400 flex-shrink-0`,children:e.created_at?x4(Df(e.created_at),`MM-dd HH:mm`):``}),n?(0,R.jsx)(Bs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}):(0,R.jsx)(Hs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`})]})]})]}),(0,R.jsx)(gb,{children:n&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,R.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 p-4 space-y-2 text-sm`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`完整消息:`}),(0,R.jsx)(`p`,{className:`text-gray-700 mt-1 break-words`,children:e.message})]}),e.project_path&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`项目路径:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1 font-mono text-xs break-all`,children:e.project_path})]}),(0,R.jsxs)(`div`,{className:`flex gap-6`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`创建时间:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1`,children:e.created_at?x4(Df(e.created_at),`yyyy-MM-dd HH:mm:ss`):`-`})]}),e.resolved_at&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`解决时间:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1`,children:x4(Df(e.resolved_at),`yyyy-MM-dd HH:mm:ss`)})]})]}),!e.resolved&&(0,R.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:b===String(e.id)?Rs:Qs,onClick:t=>{t.stopPropagation(),ae(String(e.id))},children:b===String(e.id)?`已复制`:`复制上下文`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:zs,onClick:t=>{t.stopPropagation(),te.mutate(String(e.id))},loading:te.isPending,children:`标记已修复`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:el,onClick:t=>{t.stopPropagation(),P.mutate(String(e.id))},loading:P.isPending,children:`忽略`})]})]})})})]},e.id||t)})}):(0,R.jsx)(`div`,{className:`space-y-3`,children:Object.entries(I).map(([e,t])=>{let n=E.has(e),r=t.filter(e=>!e.resolved).length;return(0,R.jsxs)(`div`,{className:`border border-gray-200 rounded-lg overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100 transition-colors`,onClick:()=>D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?(0,R.jsx)(Bs,{className:`h-4 w-4 text-gray-500`}):(0,R.jsx)(Hs,{className:`h-4 w-4 text-gray-500`}),(0,R.jsx)(`span`,{className:`font-medium text-gray-900`,children:e}),(0,R.jsxs)(fS,{size:`sm`,children:[t.length,` 个问题`]}),r>0&&(0,R.jsxs)(fS,{size:`sm`,variant:`warning`,children:[r,` 未解决`]})]})}),(0,R.jsx)(gb,{children:n&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,R.jsx)(`div`,{className:`divide-y divide-gray-100`,children:t.map((e,t)=>{let n=v===String(e.id||t);return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(sS.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:t*.01},className:q(`flex items-center gap-3 p-3 cursor-pointer transition-all`,S.has(String(e.id))?`bg-blue-50`:`hover:bg-gray-50`),onClick:()=>y(n?null:String(e.id||t)),children:[e.resolved?(0,R.jsx)(`div`,{className:`h-4 w-4 flex-shrink-0`}):(0,R.jsx)(`input`,{type:`checkbox`,checked:S.has(String(e.id)),onChange:t=>{t.stopPropagation(),C(t=>{let n=new Set(t);return n.has(String(e.id))?n.delete(String(e.id)):n.add(String(e.id)),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 cursor-pointer flex-shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-4 gap-3 items-center min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,R.jsx)(x3,{level:e.level}),(0,R.jsx)(S3,{category:e.category})]}),(0,R.jsx)(`div`,{className:`md:col-span-2 min-w-0`,children:(0,R.jsx)(`p`,{className:`text-sm text-gray-700 truncate`,children:e.message})}),(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,R.jsx)(fS,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),(0,R.jsx)(`span`,{className:`text-xs text-gray-400 flex-shrink-0`,children:e.created_at?x4(Df(e.created_at),`MM-dd HH:mm`):``}),n?(0,R.jsx)(Bs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}):(0,R.jsx)(Hs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`})]})]})]}),(0,R.jsx)(gb,{children:n&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,R.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 p-4 space-y-2 text-sm`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`完整消息:`}),(0,R.jsx)(`p`,{className:`text-gray-700 mt-1 break-words`,children:e.message})]}),e.project_path&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`项目路径:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1 font-mono text-xs break-all`,children:e.project_path})]}),(0,R.jsxs)(`div`,{className:`flex gap-6`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`创建时间:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1`,children:e.created_at?x4(Df(e.created_at),`yyyy-MM-dd HH:mm:ss`):`-`})]}),e.resolved_at&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`解决时间:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1`,children:x4(Df(e.resolved_at),`yyyy-MM-dd HH:mm:ss`)})]})]}),!e.resolved&&(0,R.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:b===String(e.id)?Rs:Qs,onClick:t=>{t.stopPropagation(),ae(String(e.id))},children:b===String(e.id)?`已复制`:`复制上下文`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:zs,onClick:t=>{t.stopPropagation(),te.mutate(String(e.id))},loading:te.isPending,children:`标记已修复`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:el,onClick:t=>{t.stopPropagation(),P.mutate(String(e.id))},loading:P.isPending,children:`忽略`})]})]})})})]},e.id||t)})})})})]},e)})}),F.length===0&&(0,R.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,R.jsx)(Gs,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`没有符合条件的记录`]}),F.length>0&&w===`list`&&(0,R.jsx)(n3,{currentPage:m,totalPages:oe,onPageChange:h,pageSize:g,onPageSizeChange:e=>{_(e),h(1)},totalItems:F.length})]}),(0,R.jsx)(w4,{open:O.open,title:O.title,description:O.description,count:O.count,variant:`warning`,onConfirm:O.onConfirm,onCancel:()=>k({...O,open:!1})})]})}var w3=[{key:`distill`,title:`蒸馏配置`,description:`AI 知识蒸馏的触发条件和参数`,fields:[{key:`provider`,label:`提供商`,type:`select`,options:[{value:`claude`,label:`Claude`},{value:`openai`,label:`OpenAI`},{value:`ollama`,label:`Ollama`}]},{key:`auto_trigger`,label:`自动触发`,type:`boolean`,description:`达到事件阈值时自动蒸馏`},{key:`event_threshold`,label:`事件阈值`,type:`number`,description:`触发蒸馏的最小事件数`,min:1,max:1e4},{key:`timer_interval_minutes`,label:`定时器间隔(分钟)`,type:`number`,min:1,max:1440},{key:`model`,label:`模型`,type:`text`},{key:`api_key`,label:`API Key`,type:`text`,sensitive:!0,description:`留空自动从环境变量获取`},{key:`base_url`,label:`API 地址`,type:`text`,description:`留空使用默认地址`}]},{key:`autopilot`,title:`自动驾驶`,description:`意图分析、质量门禁、Pipeline 编排`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`intent_analysis`,label:`意图分析`,type:`boolean`,description:`AI 分析用户意图和任务复杂度`},{key:`quality_gate`,label:`质量门禁`,type:`boolean`,description:`代码变更时自动审查质量`},{key:`quality_review_interval`,label:`审查间隔`,type:`number`,description:`每 N 次 Write/Edit 触发一次审查`,min:1,max:100},{key:`auto_start_pipeline`,label:`自动启动流水线`,type:`boolean`},{key:`pipeline_confirm_mode`,label:`确认模式`,type:`select`,options:[{value:`prompt`,label:`提示确认`},{value:`auto`,label:`自动启动`},{value:`preview`,label:`仅预览`}]}]},{key:`resume`,title:`会话续接`,description:`中断会话的自动恢复`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`timeout_minutes`,label:`超时时间(分钟)`,type:`number`,min:1,max:1440},{key:`max_age_days`,label:`最大保留天数`,type:`number`,min:1,max:365}]},{key:`claudemd`,title:`CLAUDE.md 管理`,description:`项目级 CLAUDE.md 的自动生成与精炼`,fields:[{key:`auto_generate`,label:`自动生成`,type:`boolean`},{key:`auto_refine`,label:`自动精炼`,type:`boolean`},{key:`refine_interval`,label:`精炼间隔`,type:`number`,description:`每 N 次蒸馏后精炼一次`,min:1,max:100}]},{key:`orchestration`,title:`编排通知`,description:`蒸馏和 CLAUDE.md 更新的通知`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`notify_on_distill`,label:`蒸馏完成通知`,type:`boolean`},{key:`notify_on_claudemd`,label:`CLAUDE.md 更新通知`,type:`boolean`}]},{key:`web`,title:`Web 管理后台`,description:`Web 服务配置`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`port`,label:`端口`,type:`number`,min:1024,max:65535}]},{key:`ai`,title:`AI 模型`,description:`分层模型配置(Haiku/Sonnet/Opus)`,fields:[{key:`models.haiku`,label:`Haiku 模型`,type:`text`},{key:`models.sonnet`,label:`Sonnet 模型`,type:`text`},{key:`models.opus`,label:`Opus 模型`,type:`text`}]},{key:`storage`,title:`存储`,description:`数据库路径和容量限制`,fields:[{key:`path`,label:`数据库路径`,type:`text`},{key:`max_size_mb`,label:`最大容量(MB)`,type:`number`,min:100,max:102400}]},{key:`backup`,title:`备份配置`,description:`数据备份策略`,fields:[{key:`include_profile`,label:`包含用户画像`,type:`boolean`,description:`备份时包含用户画像数据`},{key:`encrypt_by_default`,label:`默认加密`,type:`boolean`,description:`备份文件默认加密`}]},{key:`pattern_engine`,title:`模式引擎`,description:`模式识别与演化配置`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`route_timeout_ms`,label:`路由超时(毫秒)`,type:`number`,min:100,max:6e4},{key:`evolve_interval_days`,label:`演化间隔(天)`,type:`number`,min:1,max:365},{key:`evolve_min_executions`,label:`最小执行次数`,type:`number`,description:`触发演化的最小执行次数`,min:1,max:1e3}]},{key:`ui`,title:`UI 配置`,description:`前端界面参数`,fields:[{key:`skill_repair_limit`,label:`Skill 修复上限`,type:`number`,min:1,max:100},{key:`logs_tail_default`,label:`日志默认条数`,type:`number`,min:10,max:1e3},{key:`pipeline_expire_hours`,label:`Pipeline 过期时间(小时)`,type:`number`,min:1,max:720}]},{key:`history`,title:`配置历史`,description:`查看最近 10 次配置变更记录`,fields:[]}];function T3(){let e=Ye(),[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(`idle`),[a,o]=(0,L.useState)(`distill`),[s,c]=(0,L.useState)(new Set),l=s.size>0,[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(new Set),[m,h]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(``),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)({}),{data:E,isLoading:D}=ut({queryKey:[`config`],queryFn:()=>cl().then(e=>e.data)}),{data:O,refetch:k}=ut({queryKey:[`daemon-diagnosis`],queryFn:()=>uu().then(e=>e.data),enabled:a===`environment`}),{data:A,refetch:j}=ut({queryKey:[`backups`],queryFn:()=>pu().then(e=>e.data),enabled:a===`backup_mgmt`}),{data:M}=ut({queryKey:[`config-history`],queryFn:()=>ul().then(e=>e.data),enabled:a===`history`}),{data:N}=ut({queryKey:[`daemon-status`],queryFn:()=>cu().then(e=>e.data),enabled:a===`backup_mgmt`}),{data:ee,refetch:te}=ut({queryKey:[`memory-caches`],queryFn:()=>_u().then(e=>e.data),enabled:a===`memory_mgmt`,refetchInterval:a===`memory_mgmt`?5e3:!1}),{data:P,refetch:ne}=ut({queryKey:[`memory-process`],queryFn:()=>vu().then(e=>e.data),enabled:a===`memory_mgmt`,refetchInterval:a===`memory_mgmt`?5e3:!1}),re=z({mutationFn:e=>yu(e),onSuccess:(e,t)=>{H(`缓存 ${t} 已清空`,`success`),te()},onError:()=>H(`清空缓存失败`,`error`)}),ie=z({mutationFn:()=>bu(),onSuccess:()=>{H(`所有缓存已清空`,`success`),te()},onError:()=>H(`清空缓存失败`,`error`)}),ae=z({mutationFn:()=>xu(),onSuccess:e=>{let t=e.data.freed;H(t?`GC 完成,释放堆内存 ${t.heapMB} MB`:e.data.message,`success`),ne()},onError:()=>H(`GC 触发失败(需要 --expose-gc 启动)`,`error`)}),F=z({mutationFn:()=>fu(v?{encrypt:!0,password:b}:{}),onSuccess:e=>{j(),H(e.data.encrypted?`加密备份已创建`:`备份已创建`,`success`),x(``),i(`success`),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),I=z({mutationFn:({filename:e,password:t})=>hu(e,t),onSuccess:e=>{H(`${e.data.message}(已备份当前数据库为 ${e.data.preRestoreBackup})`,`success`),setTimeout(()=>window.location.reload(),2e3)},onError:()=>H(`恢复失败`,`error`)}),oe=z({mutationFn:()=>du(),onSuccess:e=>{d(e.data),k()}});(0,L.useEffect)(()=>{E&&!t&&n(E)},[E,t]);let se=z({mutationFn:e=>ll(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),i(`success`),c(new Set),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),ce=z({mutationFn:()=>U.post(`/config/reset`),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),n(null),i(`success`),setTimeout(()=>i(`idle`),3e3)}});if(D||!t)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let le=(e,n)=>{let r=t[e];if(!r)return``;let i=n.split(`.`),a=r;for(let e of i)a=a?.[e];return a??``},ue=(e,t,r)=>{c(t=>new Set(t).add(e)),n(n=>{if(!n)return n;let i={...n[e]||{}},a=t.split(`.`);if(a.length===1)i[t]=r;else{let e={...i[a[0]]||{}};e[a[1]]=r,i[a[0]]=e}return{...n,[e]:i}})},de=()=>{if(!t)return;let e={};s.forEach(n=>{e[n]=t[n]}),se.mutate(e)},fe=()=>{n(E),c(new Set)},pe=()=>{let e=JSON.stringify(t,null,2),n=new Blob([e],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`claude-forge-config-${new Date().toISOString().slice(0,10)}.json`,i.click(),URL.revokeObjectURL(r)},me=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`.json`,e.onchange=e=>{let t=e.target.files?.[0];if(!t)return;let r=new FileReader;r.onload=e=>{try{n(JSON.parse(e.target?.result)),c(new Set(w3.map(e=>e.key)))}catch{H(`配置文件格式错误,请选择有效的 JSON 文件`,`error`)}},r.readAsText(t)},e.click()},he=w3.find(e=>e.key===a);return(0,R.jsxs)(`div`,{className:`flex gap-6`,children:[(0,R.jsx)(`div`,{className:`w-56 flex-shrink-0`,children:(0,R.jsx)(X,{className:`!p-2 sticky top-6`,children:(0,R.jsxs)(`nav`,{className:`space-y-1`,children:[w3.map(e=>(0,R.jsx)(`button`,{onClick:()=>o(e.key),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors`,a===e.key?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:e.title},e.key)),(0,R.jsx)(`div`,{className:`border-t border-gray-100 my-1`}),(0,R.jsxs)(`button`,{onClick:()=>o(`backup_mgmt`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`backup_mgmt`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,R.jsx)(ec,{className:`h-3.5 w-3.5`}),`数据备份`]}),(0,R.jsxs)(`button`,{onClick:()=>o(`memory_mgmt`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`memory_mgmt`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,R.jsx)($s,{className:`h-3.5 w-3.5`}),`内存管理`]}),(0,R.jsxs)(`button`,{onClick:()=>o(`environment`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`environment`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,R.jsx)(zc,{className:`h-3.5 w-3.5`}),`环境检测`]})]})})}),(0,R.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900`,children:a===`environment`?`环境检测`:a===`backup_mgmt`?`数据备份`:a===`memory_mgmt`?`内存管理`:a===`history`?`配置历史`:he?.title}),(0,R.jsx)(`p`,{className:`text-sm text-gray-500`,children:a===`environment`?`Hook 脚本与 Claude settings.json 注入状态检测与修复`:a===`backup_mgmt`?`数据库备份与历史备份管理`:a===`memory_mgmt`?`LRU 缓存状态与进程内存管理`:a===`history`?`查看最近 10 次配置变更记录`:he?.description??``})]}),a!==`environment`&&a!==`backup_mgmt`&&a!==`memory_mgmt`&&a!==`history`&&(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(gb,{children:[r===`success`&&(0,R.jsxs)(sS.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0},className:`flex items-center gap-1.5 text-green-600 text-sm`,children:[(0,R.jsx)(Gs,{className:`h-4 w-4`}),`已保存`]}),r===`error`&&(0,R.jsxs)(sS.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0},className:`flex items-center gap-1.5 text-red-600 text-sm`,children:[(0,R.jsx)(qs,{className:`h-4 w-4`}),`保存失败`]})]}),l&&(0,R.jsx)(fS,{variant:`warning`,children:`未保存`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:nc,onClick:pe,children:`导出`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Zc,onClick:me,children:`导入`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Fc,onClick:fe,disabled:!l,children:`撤销`}),(0,R.jsx)(Y,{variant:`primary`,size:`sm`,icon:Ic,onClick:de,loading:se.isPending,disabled:!l,children:`保存`})]})]}),a!==`environment`&&a!==`backup_mgmt`&&a!==`memory_mgmt`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(X,{children:(0,R.jsx)(`div`,{className:`space-y-6`,children:he?.fields.map(e=>(0,R.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,R.jsxs)(`div`,{className:`w-48 flex-shrink-0 pt-2`,children:[(0,R.jsx)(`label`,{className:`text-sm font-medium text-gray-700`,children:e.label}),e.description&&(0,R.jsx)(`p`,{className:`text-xs text-gray-400 mt-0.5`,children:e.description})]}),(0,R.jsx)(`div`,{className:`flex-1`,children:e.type===`boolean`?(0,R.jsx)(`button`,{onClick:()=>ue(a,e.key,!le(a,e.key)),className:q(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors`,le(a,e.key)?`bg-blue-600`:`bg-gray-300`),children:(0,R.jsx)(`span`,{className:q(`inline-block h-4 w-4 transform rounded-full bg-white transition-transform`,le(a,e.key)?`translate-x-6`:`translate-x-1`)})}):e.type===`select`?(0,R.jsx)(`select`,{value:String(le(a,e.key)||``),onChange:t=>ue(a,e.key,t.target.value),className:`w-full max-w-xs px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`,children:e.options?.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))}):e.type===`number`?(0,R.jsx)(`input`,{type:`number`,value:Number(le(a,e.key))||0,onChange:t=>ue(a,e.key,Number(t.target.value)),min:e.min,max:e.max,className:`w-full max-w-xs px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`}):(0,R.jsxs)(`div`,{className:`relative flex items-center max-w-xs`,children:[(0,R.jsx)(`input`,{type:e.sensitive&&!f.has(`${a}.${e.key}`)?`password`:`text`,value:String(le(a,e.key)||``),onChange:t=>ue(a,e.key,t.target.value),className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm pr-9`}),e.sensitive&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(t=>{let n=new Set(t),r=`${a}.${e.key}`;return n.has(r)?n.delete(r):n.add(r),n}),className:`absolute right-2 text-gray-400 hover:text-gray-600`,children:f.has(`${a}.${e.key}`)?(0,R.jsx)(ic,{className:`h-4 w-4`}):(0,R.jsx)(ac,{className:`h-4 w-4`})})]})})]},e.key))})}),(0,R.jsx)(X,{className:`!border-red-200`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold text-red-600`,children:`重置配置`}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 mt-1`,children:`将所有配置恢复为默认值,此操作不可撤销`})]}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,icon:Xc,onClick:()=>{h({open:!0,title:`重置配置`,description:`确定要重置所有配置为默认值吗?此操作不可撤销。`,onConfirm:()=>{ce.mutate(),h({...m,open:!1})}})},loading:ce.isPending,children:`重置`})]})})]}),a===`backup_mgmt`&&(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full bg-blue-50 flex items-center justify-center`,children:(0,R.jsx)(hc,{className:`h-5 w-5 text-blue-600`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`当前数据库`}),(0,R.jsxs)(`p`,{className:`text-sm text-gray-500 mt-1`,children:[`内存占用:`,N?.memory?`${(N.memory.heapUsed/1024/1024).toFixed(2)} MB`:`加载中...`]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm text-gray-600 cursor-pointer`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>y(e.target.checked),className:`rounded`}),(0,R.jsx)(Cc,{className:`h-3.5 w-3.5`}),`加密备份`]})}),v&&(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`input`,{type:S?`text`:`password`,placeholder:`备份密码(≥8位)`,value:b,onChange:e=>x(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 pr-8 w-48`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-gray-400`,children:S?(0,R.jsx)(ic,{className:`h-3.5 w-3.5`}):(0,R.jsx)(ac,{className:`h-3.5 w-3.5`})})]}),(0,R.jsx)(Y,{variant:`primary`,size:`sm`,icon:ec,onClick:()=>F.mutate(),loading:F.isPending,disabled:v&&b.length<8,children:`立即备份`})]})]})}),(0,R.jsxs)(X,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`备份历史`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Pc,onClick:()=>j(),children:`刷新`})]}),A&&A.items.length>0?(0,R.jsx)(`div`,{className:`space-y-2`,children:A.items.map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900 truncate`,children:e.filename}),e.encrypted&&(0,R.jsxs)(`span`,{className:`flex items-center gap-0.5 text-xs text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded`,children:[(0,R.jsx)(Cc,{className:`h-3 w-3`}),` 已加密`]})]}),(0,R.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[x4(new Date(e.createdAt),`yyyy-MM-dd HH:mm:ss`),` · `,e.sizeMb,` MB`]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 ml-3 flex-shrink-0`,children:[(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`恢复数据库`,description:`确定要从 ${e.filename} 恢复数据库吗?当前数据库将被覆盖(会自动备份)。恢复后 daemon 将自动重启。`,onConfirm:()=>{I.mutate({filename:e.filename,password:w[e.filename]}),h(e=>({...e,open:!1}))}})},loading:I.isPending&&I.variables?.filename===e.filename,children:`恢复`}),(0,R.jsx)(`a`,{href:mu(e.filename),download:e.filename,children:(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:nc,children:`下载`})})]})]}),e.encrypted&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Cc,{className:`h-3.5 w-3.5 text-amber-500 flex-shrink-0`}),(0,R.jsx)(`input`,{type:`password`,placeholder:`输入解密密码后点击恢复`,value:w[e.filename]||``,onChange:t=>T(n=>({...n,[e.filename]:t.target.value})),className:`flex-1 px-2 py-1 text-xs border border-amber-200 rounded focus:outline-none focus:ring-1 focus:ring-amber-400`})]})]},e.filename))}):(0,R.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无备份记录`})]}),(0,R.jsxs)(X,{children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`数据管理`})}),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`清理历史事件`}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`删除超过指定天数的事件记录`})]}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`清理历史事件`,description:`确定要清理 30 天前的事件记录吗?此操作不可撤销。`,onConfirm:()=>{U.post(`/events/purge`,{retentionDays:30}).then(()=>{H(`事件清理完成`,`success`),h(e=>({...e,open:!1}))}).catch(()=>{H(`事件清理失败`,`error`),h(e=>({...e,open:!1}))})}})},children:`清理 30 天前`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`数据库优化`}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`执行 VACUUM 回收空间,提升性能`})]}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`数据库优化`,description:`确定要执行 VACUUM 优化吗?此操作可能需要几分钟。`,onConfirm:()=>{U.post(`/config/vacuum`).then(()=>{H(`数据库优化完成`,`success`),h(e=>({...e,open:!1}))}).catch(()=>{H(`数据库优化失败`,`error`),h(e=>({...e,open:!1}))})}})},children:`立即优化`})]})]})]})]}),a===`memory_mgmt`&&(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between mb-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full bg-purple-50 flex items-center justify-center`,children:(0,R.jsx)($s,{className:`h-5 w-5 text-purple-600`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`进程内存`}),P&&(0,R.jsxs)(`div`,{className:`text-sm text-gray-600 mt-2 space-y-1`,children:[(0,R.jsxs)(`div`,{children:[`RSS: `,P.rssMB,` MB`]}),(0,R.jsxs)(`div`,{children:[`堆已用: `,P.heapUsedMB,` MB / `,P.heapTotalMB,` MB`]}),(0,R.jsxs)(`div`,{children:[`外部: `,P.externalMB,` MB`]})]})]})]}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>ae.mutate(),loading:ae.isPending,children:`触发 GC`})]})}),(0,R.jsxs)(X,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`LRU 缓存`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Pc,onClick:()=>void te(),children:`刷新`}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`清空所有缓存`,description:`确定要清空所有 LRU 缓存吗?`,onConfirm:()=>{ie.mutate(),h(e=>({...e,open:!1}))}})},loading:ie.isPending,children:`清空全部`})]})]}),ee&&ee.caches.length>0?(0,R.jsx)(`div`,{className:`space-y-2`,children:ee.caches.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.name}),(0,R.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[e.size,` / `,e.maxSize,` 条`,e.hitRate!==void 0&&` · 命中率 ${(e.hitRate*100).toFixed(1)}%`]})]}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>re.mutate(e.name),loading:re.isPending&&re.variables===e.name,children:`清空`})]},e.name))}):(0,R.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无缓存数据`})]})]}),a===`history`&&(0,R.jsxs)(X,{children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`最近 10 次配置变更`})}),M&&M.items.length>0?(0,R.jsx)(`div`,{className:`space-y-2`,children:M.items.map(e=>{let t=g===String(e.id),n=E,r=[];if(t&&n){let t=(e,n=``)=>typeof e!=`object`||!e?{[n]:JSON.stringify(e)}:Object.entries(e).reduce((e,[r,i])=>{let a=n?`${n}.${r}`:r;return typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(e,t(i,a)):e[a]=JSON.stringify(i),e},{}),i=t(e.config),a=t(n);new Set([...Object.keys(i),...Object.keys(a)]).forEach(e=>{let t=i[e]??`(无)`,n=a[e]??`(无)`;t!==n&&r.push({key:e,old:t,cur:n})})}return(0,R.jsxs)(`div`,{className:`py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`span`,{className:`text-sm font-medium text-gray-900`,children:[`#`,e.id]}),(0,R.jsx)(`span`,{className:`text-xs text-gray-500`,children:x4(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>_(t?null:String(e.id)),children:t?`收起对比`:`与当前对比`}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`确认恢复配置`,description:`确定要恢复到 ${x4(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)} 的配置吗?当前配置将被覆盖。`,onConfirm:()=>{se.mutate(e.config),h(e=>({...e,open:!1}))}})},children:`恢复到此版本`})]})]}),(0,R.jsx)(gb,{children:t&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,R.jsxs)(`div`,{className:`mt-3 rounded border border-gray-200 overflow-hidden text-xs font-mono`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-3 bg-gray-100 px-3 py-1.5 text-gray-500 font-medium text-xs`,children:[(0,R.jsx)(`span`,{children:`配置项`}),(0,R.jsx)(`span`,{className:`text-red-600`,children:`历史值`}),(0,R.jsx)(`span`,{className:`text-green-600`,children:`当前值`})]}),r.length===0?(0,R.jsx)(`div`,{className:`px-3 py-3 text-gray-400 text-center`,children:`与当前配置完全一致`}):(0,R.jsx)(`div`,{className:`divide-y divide-gray-100 max-h-64 overflow-auto`,children:r.map(({key:e,old:t,cur:n})=>(0,R.jsxs)(`div`,{className:`grid grid-cols-3 px-3 py-1.5 hover:bg-gray-50`,children:[(0,R.jsx)(`span`,{className:`text-gray-600 truncate pr-2`,children:e}),(0,R.jsx)(`span`,{className:`text-red-600 truncate pr-2 bg-red-50 rounded px-1`,children:t}),(0,R.jsx)(`span`,{className:`text-green-600 truncate bg-green-50 rounded px-1`,children:n})]},e))})]})})}),!t&&(0,R.jsx)(`div`,{className:`mt-2 text-xs text-gray-500 font-mono bg-white rounded border border-gray-100 p-2 max-h-32 overflow-auto`,children:(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-all`,children:JSON.stringify(e.config,null,2)})})]},e.id)})}):(0,R.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无配置变更记录`})]}),a===`environment`&&(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900 mb-1`,children:`Hook 环境诊断`}),(0,R.jsx)(`p`,{className:`text-sm text-gray-500`,children:`检测 Forge hooks 脚本与 Claude settings.json 中 Forge 注入是否完整`})]}),(0,R.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Pc,onClick:()=>k(),children:`重新检测`}),(0,R.jsx)(Y,{size:`sm`,icon:$c,onClick:()=>oe.mutate(),disabled:oe.isPending||O?.hooksHealthy,children:oe.isPending?`修复中...`:`一键修复`})]})]})}),u&&(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[u.hooksHealthy?(0,R.jsx)(Gs,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,R.jsx)(Xc,{className:`h-4 w-4 text-yellow-500 mt-0.5 flex-shrink-0`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:q(`text-sm font-medium`,u.hooksHealthy?`text-gray-900`:`text-yellow-600`),children:u.hooksHealthy?`Hooks 环境已恢复正常`:`修复后仍有未通过项,请根据下方列表排查`}),u.backupPath&&(0,R.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[`已备份 settings: `,u.backupPath.split(`/`).pop()]})]})]}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:qs,onClick:()=>d(null)})]})}),O&&(0,R.jsx)(X,{children:(0,R.jsx)(`div`,{className:`space-y-2`,children:O.items.map(e=>(0,R.jsxs)(`div`,{className:`flex items-start gap-3 py-2 border-b border-gray-50 last:border-0`,children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,children:e.ok?(0,R.jsx)(Gs,{className:`h-4 w-4 text-green-500`}):e.id===`daemon_process`?(0,R.jsx)(Xc,{className:`h-4 w-4 text-yellow-500`}):(0,R.jsx)(qs,{className:`h-4 w-4 text-red-500`})}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.label}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5 break-all`,children:e.detail})]})]},e.id))})}),O&&(0,R.jsx)(X,{className:O.hooksHealthy?`!border-green-200 !bg-green-50`:`!border-yellow-200 !bg-yellow-50`,children:(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:O.hooksHealthy?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Gs,{className:`h-5 w-5 text-green-600`}),(0,R.jsx)(`p`,{className:`text-sm font-medium text-green-700`,children:`Hooks 相关环境正常`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Xc,{className:`h-5 w-5 text-yellow-600`}),(0,R.jsx)(`p`,{className:`text-sm font-medium text-yellow-700`,children:`检测到 Hooks 环境不完整,请点击「一键修复」`})]})})})]})]}),(0,R.jsx)(w4,{open:m.open,title:m.title,description:m.description,variant:`danger`,onConfirm:m.onConfirm,onCancel:()=>h({...m,open:!1})})]})}function E3({children:e,fallback:t,rootMargin:n=`200px`}){let[r,i]=(0,L.useState)(!1),a=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let e=new IntersectionObserver(([t])=>{t.isIntersecting&&(i(!0),e.disconnect())},{rootMargin:n,threshold:.01});return a.current&&e.observe(a.current),()=>e.disconnect()},[n]),(0,R.jsx)(`div`,{ref:a,style:{minHeight:r?`auto`:`400px`},children:r?e:t||(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96 text-gray-400`,children:`加载中...`})})}var D3=[`#667eea`,`#10b981`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#06b6d4`],O3={"7d":7,"30d":30,"90d":90,custom:0};function k3(){let[e,t]=(0,L.useState)(`30d`),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(`sessions`),c=O3[e],l=e===`custom`?n?`${n}T00:00:00`:void 0:x4(C4(new Date,c),`yyyy-MM-dd'T'HH:mm:ss`),u=e===`custom`&&i?`${i}T23:59:59`:void 0,{data:d,isLoading:f,isError:p,refetch:m}=ut({queryKey:[`sessions`,{limit:500,startTime:l,endTime:u}],queryFn:()=>dl({limit:500,start_time:l,end_time:u}).then(e=>e.data)}),{data:h,isLoading:g,isError:_,refetch:v}=ut({queryKey:[`events`,{limit:1e3,startTime:l,endTime:u}],queryFn:()=>hl({limit:1e3,start_time:l,end_time:u}).then(e=>e.data)}),{data:y,isLoading:b}=ut({queryKey:[`event-stats`],queryFn:()=>gl().then(e=>e.data)}),{data:x}=ut({queryKey:[`api-usage-stats`,e],queryFn:()=>Su(e===`custom`?90:c).then(e=>e.data),staleTime:6e4}),{data:S}=ut({queryKey:[`pipelines-analytics`,{limit:500}],queryFn:()=>_l({limit:500}).then(e=>e.data),enabled:o===`pipelines`}),{data:C}=ut({queryKey:[`quality-history-analytics`,{limit:500}],queryFn:()=>yl({limit:500}).then(e=>e.data),enabled:o===`pipelines`}),w=f||g||b,T=p||_,E=()=>{K4(`analytics-sessions-${x4(new Date,`yyyyMMdd`)}.csv`,[`日期`,`会话数`],D.map(e=>[e.date,e.count])),K4(`analytics-tools-${x4(new Date,`yyyyMMdd`)}.csv`,[`工具`,`使用次数`],j.map(e=>[e.name,e.value])),K4(`analytics-projects-${x4(new Date,`yyyyMMdd`)}.csv`,[`项目`,`事件数`],k.map(e=>[e.name,e.value])),K4(`analytics-durations-${x4(new Date,`yyyyMMdd`)}.csv`,[`时长区间`,`会话数`],N.map(e=>[e.range,e.count]))},D=(0,L.useMemo)(()=>{if(!d?.items)return[];if(e===`custom`){if(!n||!i)return[];let e=new Date(n),t=new Date(i),r=Math.ceil((t.getTime()-e.getTime())/(1e3*60*60*24))+1;return Array.from({length:r},(t,n)=>{let r=x4(new Date(e.getTime()+n*24*60*60*1e3),`MM-dd`);return{date:r,count:d.items.filter(e=>x4(Df(e.start_time),`MM-dd`)===r).length}})}return Array.from({length:c},(e,t)=>{let n=x4(C4(new Date,c-1-t),`MM-dd`);return{date:n,count:d.items.filter(e=>x4(Df(e.start_time),`MM-dd`)===n).length}})},[d?.items,c,e,n,i]),O=(0,L.useMemo)(()=>h?.items?Array.from({length:24},(e,t)=>{let n=h.items.filter(e=>Df(e.timestamp).getHours()===t).length;return{hour:`${t}:00`,count:n}}):[],[h?.items]),k=(0,L.useMemo)(()=>{if(!h?.items)return[];let e=h.items.reduce((e,t)=>{let n=t.project_path.split(`/`).pop()||`Unknown`;return e[n]=(e[n]||0)+1,e},{});return Object.entries(e).sort((e,t)=>t[1]-e[1]).slice(0,10).map(([e,t])=>({name:e,value:t}))},[h?.items]),A={Bash:`Bash 命令`,Read:`读取文件`,Edit:`编辑文件`,Write:`写入文件`,Grep:`搜索内容`,Glob:`查找文件`,Agent:`子代理`,WebFetch:`网页获取`,WebSearch:`网页搜索`,TodoWrite:`任务管理`,NotebookEdit:`笔记编辑`,stop:`停止`,notification:`通知`,UserPrompt:`用户输入`,TaskCreate:`创建任务`,TaskUpdate:`更新任务`,TaskList:`任务列表`,TaskGet:`获取任务`,TaskStop:`停止任务`,TaskOutput:`任务输出`},j=(0,L.useMemo)(()=>{if(!h?.items)return[];let e=h.items.reduce((e,t)=>{let n=t.tool_name||`N/A`;return e[n]=(e[n]||0)+1,e},{});return Object.entries(e).sort((e,t)=>t[1]-e[1]).slice(0,15).map(([e,t])=>({name:A[e]||e,value:t}))},[h?.items]),{sessionDurations:M,durationBuckets:N}=(0,L.useMemo)(()=>{if(!d?.items)return{sessionDurations:[],durationBuckets:[]};let e=d.items.filter(e=>e.end_time).map(e=>{let t=(Df(e.end_time).getTime()-Df(e.start_time).getTime())/1e3/60;return Math.round(t)});return{sessionDurations:e,durationBuckets:[{range:`0-5分钟`,count:e.filter(e=>e<=5).length},{range:`5-15分钟`,count:e.filter(e=>e>5&&e<=15).length},{range:`15-30分钟`,count:e.filter(e=>e>15&&e<=30).length},{range:`30-60分钟`,count:e.filter(e=>e>30&&e<=60).length},{range:`60+分钟`,count:e.filter(e=>e>60).length}]}},[d?.items]),{avgSessionEvents:ee,avgSessionDuration:te}=(0,L.useMemo)(()=>{let e=M.filter(e=>e>0&&e<=480),t=e.length>0?e.reduce((e,t)=>e+t,0)/e.length:0,n=d?.items.filter(e=>e.event_count>0&&e.event_count<=500)??[];return{avgSessionEvents:n.length>0?n.reduce((e,t)=>e+t.event_count,0)/n.length:0,avgSessionDuration:t}},[d?.items,M]),P=(0,L.useMemo)(()=>{if(!S?.items)return null;let e=S.items,t=e.filter(e=>e.status===`completed`).length;return{completed:t,failed:e.filter(e=>e.status===`failed`).length,completionRate:e.length>0?(t/e.length*100).toFixed(1):`0`,complexityDist:e.reduce((e,t)=>(e[t.complexity]=(e[t.complexity]||0)+1,e),{}),avgNodes:e.length>0?(e.reduce((e,t)=>e+(t.stats?.totalNodes||0),0)/e.length).toFixed(1):`0`,total:e.length}},[S?.items]),ne=(0,L.useMemo)(()=>C?.items?Array.from({length:c},(e,t)=>{let n=x4(C4(new Date,c-1-t),`MM-dd`),r=C.items.filter(e=>x4(Df(e.created_at),`MM-dd`)===n);return{date:n,total:r.length,unresolved:r.filter(e=>!e.resolved).length}}):[],[C?.items,c]);return w?(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})}):T?(0,R.jsx)(q4,{message:`分析数据加载失败`,onRetry:()=>{m(),v()}}):(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Is,{className:`h-4 w-4 text-gray-400`}),(0,R.jsx)(`span`,{className:`text-sm text-gray-600`,children:`时间范围:`}),(0,R.jsx)(`div`,{className:`flex gap-1 border border-gray-200 rounded-lg overflow-hidden`,children:[`7d`,`30d`,`90d`,`custom`].map(n=>(0,R.jsx)(`button`,{onClick:()=>t(n),className:q(`px-3 py-1.5 text-sm transition-colors`,e===n?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:n===`7d`?`7 天`:n===`30d`?`30 天`:n===`90d`?`90 天`:`自定义`},n))})]}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,icon:nc,onClick:E,children:`导出数据`})]}),e===`custom`&&(0,R.jsxs)(`div`,{className:`flex items-center gap-3 pl-6`,children:[(0,R.jsx)(`label`,{className:`text-sm text-gray-600`,children:`开始日期:`}),(0,R.jsx)(`input`,{type:`date`,value:n,onChange:e=>r(e.target.value),className:`px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,R.jsx)(`label`,{className:`text-sm text-gray-600`,children:`结束日期:`}),(0,R.jsx)(`input`,{type:`date`,value:i,onChange:e=>a(e.target.value),className:`px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`})]})]})}),(0,R.jsxs)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[(0,R.jsxs)(`button`,{onClick:()=>s(`sessions`),className:q(`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors`,o===`sessions`?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:[(0,R.jsx)(Ds,{className:`h-4 w-4`}),`会话分析`]}),(0,R.jsxs)(`button`,{onClick:()=>s(`pipelines`),className:q(`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors`,o===`pipelines`?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:[(0,R.jsx)(pc,{className:`h-4 w-4`}),`Pipeline 分析`]})]}),o===`sessions`&&(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Ds,{className:`h-7 w-7 text-indigo-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:ee.toFixed(1)}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话事件数`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Ys,{className:`h-7 w-7 text-green-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:te.toFixed(1)}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话时长(分钟)`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(tl,{className:`h-7 w-7 text-amber-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:h?.total||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总事件数`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Yc,{className:`h-7 w-7 text-purple-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:d?.total||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总会话数`})]})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,R.jsx)(X,{title:`最近 ${c} 天会话趋势`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(m2,{data:D,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`count`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3})]})})})}),(0,R.jsx)(X,{title:`24 小时事件分布`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(W0,{data:O,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`hour`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(UZ,{type:`monotone`,dataKey:`count`,stroke:`#10b981`,strokeWidth:2})]})})})}),(0,R.jsx)(X,{title:`项目活跃度 Top 10`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:k,layout:`vertical`,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{type:`number`}),(0,R.jsx)(u1,{dataKey:`name`,type:`category`,width:100}),(0,R.jsx)(VW,{}),(0,R.jsx)(O$,{dataKey:`value`,fill:`#667eea`})]})})})}),(0,R.jsx)(X,{title:`工具使用排行 Top 15`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:j,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`name`,angle:-45,textAnchor:`end`,height:80}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(O$,{dataKey:`value`,fill:`#10b981`})]})})})}),(0,R.jsx)(X,{title:`会话时长分布`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(f2,{children:[(0,R.jsx)(zJ,{data:N,cx:`50%`,cy:`50%`,labelLine:!1,label:({range:e,count:t})=>`${e}: ${t}`,outerRadius:80,fill:`#8884d8`,dataKey:`count`,children:N.map((e,t)=>(0,R.jsx)(HW,{fill:D3[t%D3.length]},`cell-${t}`))}),(0,R.jsx)(VW,{})]})})})}),(0,R.jsx)(X,{title:`事件类型趋势`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(m2,{data:y?.stats.slice(0,30)||[],children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(GA,{}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`count`,stackId:`1`,stroke:`#667eea`,fill:`#667eea`})]})})})})]}),x&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,R.jsx)(tc,{className:`h-5 w-5 text-gray-500`}),(0,R.jsx)(`h2`,{className:`text-base font-semibold text-gray-800`,children:`Token 与费用统计`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[`$`,x.summary.totalCost.toFixed(4)]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总费用(USD)`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(x.summary.totalTokens/1e3).toFixed(1),`K`]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总 Token 数`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(x.summary.totalTokensIn/1e3).toFixed(1),`K`]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`输入 Token`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(x.summary.totalTokensOut/1e3).toFixed(1),`K`]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`输出 Token`})]})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,R.jsx)(X,{title:`每日 Token 趋势`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(m2,{data:x.dailyTrend,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{formatter:e=>`${(e/1e3).toFixed(1)}K`}),(0,R.jsx)(GA,{}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`tokens_in`,name:`输入`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3,stackId:`1`}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`tokens_out`,name:`输出`,stroke:`#10b981`,fill:`#10b981`,fillOpacity:.3,stackId:`1`})]})})})}),(0,R.jsx)(X,{title:`每日费用趋势(USD)`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:x.dailyTrend,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{tickFormatter:e=>`$${e.toFixed(3)}`}),(0,R.jsx)(VW,{formatter:e=>`$${e.toFixed(4)}`}),(0,R.jsx)(O$,{dataKey:`cost_usd`,name:`费用`,fill:`#f59e0b`})]})})})}),x.byModel.length>0&&(0,R.jsx)(X,{title:`按模型费用分布`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(f2,{children:[(0,R.jsx)(zJ,{data:x.byModel,dataKey:`cost`,nameKey:`model`,cx:`50%`,cy:`50%`,outerRadius:80,label:({model:e,cost:t})=>`${e}: $${t.toFixed(4)}`,children:x.byModel.map((e,t)=>(0,R.jsx)(HW,{fill:D3[t%D3.length]},t))}),(0,R.jsx)(VW,{formatter:e=>`$${e.toFixed(4)}`})]})})})})]})]})]}),o===`pipelines`&&P&&(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:P.total}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总 Pipeline`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsxs)(`div`,{className:`text-3xl font-bold text-green-600`,children:[P.completionRate,`%`]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`完成率`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-purple-600`,children:P.avgNodes}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`平均节点数`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-red-600`,children:P.failed}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`失败数`})]})]}),(0,R.jsx)(X,{title:`复杂度分布`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:Object.entries(P.complexityDist).map(([e,t])=>({name:e===`simple`?`简单`:e===`moderate`?`中等`:`复杂`,value:t})),children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`name`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(O$,{dataKey:`value`,name:`数量`,fill:`#667eea`})]})})})}),ne.length>0&&(0,R.jsx)(X,{title:`质量问题趋势`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(W0,{data:ne,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(GA,{}),(0,R.jsx)(UZ,{type:`monotone`,dataKey:`total`,name:`总问题`,stroke:`#667eea`,strokeWidth:2}),(0,R.jsx)(UZ,{type:`monotone`,dataKey:`unresolved`,name:`未解决`,stroke:`#ef4444`,strokeWidth:2})]})})})})]})]})}function A3(e,t){let[n,r]=(0,L.useState)(e);return(0,L.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function j3({open:e,count:t,itemLabel:n=`项`,loading:r=!1,onConfirm:i,onCancel:a}){let[o,s]=(0,L.useState)(``);if((0,L.useEffect)(()=>{e||s(``)},[e]),(0,L.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,a]),!e)return null;let c=t<5?`simple`:t<=20?`count`:`keyword`,l=`DELETE`,u=c===`simple`||c===`count`&&o===String(t)||c===`keyword`&&o===l;return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm`,onClick:a,children:(0,R.jsxs)(`div`,{className:`bg-white rounded-xl shadow-xl w-full max-w-md mx-4 p-6`,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center bg-red-50`,children:(0,R.jsx)(Jc,{className:`h-5 w-5 text-red-500`})}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`h3`,{className:`text-base font-semibold text-gray-900`,children:[`删除 `,t,` 个`,n]}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-gray-500 leading-relaxed`,children:`此操作不可撤销,关联数据也会被删除。`}),c===`count`&&(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`label`,{className:`block text-xs text-gray-500 mb-1`,children:[`请输入数量 `,(0,R.jsx)(`span`,{className:`font-mono font-bold text-gray-800`,children:t}),` 以确认:`]}),(0,R.jsx)(`input`,{autoFocus:!0,type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u&&i()},placeholder:String(t),className:`w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-400 font-mono`})]}),c===`keyword`&&(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`label`,{className:`block text-xs text-gray-500 mb-1`,children:[`请输入 `,(0,R.jsx)(`span`,{className:`font-mono font-bold text-red-600`,children:l}),` 以确认:`]}),(0,R.jsx)(`input`,{autoFocus:!0,type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u&&i()},placeholder:l,className:`w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-400 font-mono`})]})]})]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-3 mt-6`,children:[(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:a,disabled:r,children:`取消`}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,onClick:i,loading:r,disabled:!u,children:`确认删除`})]})]})})}function M3(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=M3(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var N3={value:()=>{}};function P3(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new F3(n)}function F3(e){this._=e}function I3(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}F3.prototype=P3.prototype={constructor:F3,on:function(e,t){var n=this._,r=I3(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=L3(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=R3(n[i],e.name,t);else if(t==null)for(i in n)n[i]=R3(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new F3(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function L3(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function R3(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=N3,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var z3={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function B3(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),z3.hasOwnProperty(t)?{space:z3[t],local:e}:e}function V3(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function H3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function U3(e){var t=B3(e);return(t.local?H3:V3)(t)}function W3(){}function G3(e){return e==null?W3:function(){return this.querySelector(e)}}function K3(e){typeof e!=`function`&&(e=G3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new l6(r,this._parents)}function q3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function J3(){return[]}function Y3(e){return e==null?J3:function(){return this.querySelectorAll(e)}}function Cae(e){return function(){return q3(e.apply(this,arguments))}}function wae(e){e=typeof e==`function`?Cae(e):Y3(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new l6(r,i)}function X3(e){return function(){return this.matches(e)}}function Z3(e){return function(t){return t.matches(e)}}var Tae=Array.prototype.find;function Eae(e){return function(){return Tae.call(this.children,e)}}function Dae(){return this.firstElementChild}function Oae(e){return this.select(e==null?Dae:Eae(typeof e==`function`?e:Z3(e)))}var kae=Array.prototype.filter;function Aae(){return Array.from(this.children)}function jae(e){return function(){return kae.call(this.children,e)}}function Mae(e){return this.selectAll(e==null?Aae:jae(typeof e==`function`?e:Z3(e)))}function Nae(e){typeof e!=`function`&&(e=X3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new l6(r,this._parents)}function Q3(e){return Array(e.length)}function Pae(){return new l6(this._enter||this._groups.map(Q3),this._parents)}function $3(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$3.prototype={constructor:$3,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Fae(e){return function(){return e}}function Iae(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new $3(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Lae(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new $3(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Rae(e){return e.__data__}function zae(e,t){if(!arguments.length)return Array.from(this,Rae);var n=t?Lae:Iae,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Fae(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Bae(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new l6(o,r),o._enter=s,o._exit=c,o}function Bae(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Vae(){return new l6(this._exit||this._groups.map(Q3),this._parents)}function Hae(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Uae(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new l6(s,this._parents)}function Wae(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Gae(e){e||=Kae;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new l6(i,this._parents).order()}function Kae(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function qae(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Jae(){return Array.from(this)}function Yae(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Xae(){let e=0;for(let t of this)++e;return e}function Zae(){return!this.node()}function Qae(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function $ae(e){return function(){this.removeAttribute(e)}}function eoe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function toe(e,t){return function(){this.setAttribute(e,t)}}function noe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function roe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ioe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function aoe(e,t){var n=B3(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?eoe:$ae:typeof t==`function`?n.local?ioe:roe:n.local?noe:toe)(n,t))}function e6(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ooe(e){return function(){this.style.removeProperty(e)}}function soe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function coe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function loe(e,t,n){return arguments.length>1?this.each((t==null?ooe:typeof t==`function`?coe:soe)(e,t,n??``)):t6(this.node(),e)}function t6(e,t){return e.style.getPropertyValue(t)||e6(e).getComputedStyle(e,null).getPropertyValue(t)}function uoe(e){return function(){delete this[e]}}function doe(e,t){return function(){this[e]=t}}function foe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function poe(e,t){return arguments.length>1?this.each((t==null?uoe:typeof t==`function`?foe:doe)(e,t)):this.node()[e]}function n6(e){return e.trim().split(/^|\s+/)}function r6(e){return e.classList||new i6(e)}function i6(e){this._node=e,this._names=n6(e.getAttribute(`class`)||``)}i6.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function a6(e,t){for(var n=r6(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function o6(e,t){for(var n=r6(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function moe(e){return function(){a6(this,e)}}function hoe(e){return function(){o6(this,e)}}function goe(e,t){return function(){(t.apply(this,arguments)?a6:o6)(this,e)}}function _oe(e,t){var n=n6(e+``);if(arguments.length<2){for(var r=r6(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?goe:t?moe:hoe)(n,t))}function voe(){this.textContent=``}function yoe(e){return function(){this.textContent=e}}function boe(e){return function(){this.textContent=e.apply(this,arguments)??``}}function xoe(e){return arguments.length?this.each(e==null?voe:(typeof e==`function`?boe:yoe)(e)):this.node().textContent}function Soe(){this.innerHTML=``}function Coe(e){return function(){this.innerHTML=e}}function woe(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function Toe(e){return arguments.length?this.each(e==null?Soe:(typeof e==`function`?woe:Coe)(e)):this.node().innerHTML}function Eoe(){this.nextSibling&&this.parentNode.appendChild(this)}function Doe(){return this.each(Eoe)}function Ooe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function koe(){return this.each(Ooe)}function Aoe(e){var t=typeof e==`function`?e:U3(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function joe(){return null}function Moe(e,t){var n=typeof e==`function`?e:U3(e),r=t==null?joe:typeof t==`function`?t:G3(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Noe(){var e=this.parentNode;e&&e.removeChild(this)}function Poe(){return this.each(Noe)}function Foe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ioe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Loe(e){return this.select(e?Ioe:Foe)}function Roe(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function zoe(e){return function(t){e.call(this,t,this.__data__)}}function Boe(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Voe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Hoe(e,t,n){return function(){var r=this.__on,i,a=zoe(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Uoe(e,t,n){var r=Boe(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?Hoe:Voe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function s6(e,t,n){var r=e6(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Woe(e,t){return function(){return s6(this,e,t)}}function Goe(e,t){return function(){return s6(this,e,t.apply(this,arguments))}}function Koe(e,t){return this.each((typeof t==`function`?Goe:Woe)(e,t))}function*qoe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var c6=[null];function l6(e,t){this._groups=e,this._parents=t}function u6(){return new l6([[document.documentElement]],c6)}function Joe(){return this}l6.prototype=u6.prototype={constructor:l6,select:K3,selectAll:wae,selectChild:Oae,selectChildren:Mae,filter:Nae,data:zae,enter:Pae,exit:Vae,join:Hae,merge:Uae,selection:Joe,order:Wae,sort:Gae,call:qae,nodes:Jae,node:Yae,size:Xae,empty:Zae,each:Qae,attr:aoe,style:loe,property:poe,classed:_oe,text:xoe,html:Toe,raise:Doe,lower:koe,append:Aoe,insert:Moe,remove:Poe,clone:Loe,datum:Roe,on:Uoe,dispatch:Koe,[Symbol.iterator]:qoe};function d6(e){return typeof e==`string`?new l6([[document.querySelector(e)]],[document.documentElement]):new l6([[e]],c6)}function Yoe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function f6(e,t){if(e=Yoe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var Xoe={passive:!1},p6={capture:!0,passive:!1};function m6(e){e.stopImmediatePropagation()}function h6(e){e.preventDefault(),e.stopImmediatePropagation()}function g6(e){var t=e.document.documentElement,n=d6(e).on(`dragstart.drag`,h6,p6);`onselectstart`in t?n.on(`selectstart.drag`,h6,p6):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function _6(e,t){var n=e.document.documentElement,r=d6(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,h6,p6),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var v6=e=>()=>e;function y6(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}y6.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Zoe(e){return!e.ctrlKey&&!e.button}function Qoe(){return this.parentNode}function $oe(e,t){return t??{x:e.x,y:e.y}}function ese(){return navigator.maxTouchPoints||`ontouchstart`in this}function b6(){var e=Zoe,t=Qoe,n=$oe,r=ese,i={},a=P3(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Xoe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(d6(n.view).on(`mousemove.drag`,m,p6).on(`mouseup.drag`,h,p6),g6(n.view),m6(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(h6(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){d6(e.view).on(`mousemove.drag mouseup.drag`,null),_6(e.view,l),h6(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(m6(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(h6(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(m6(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=f6(l||r,t),p,m,h;if((h=n.call(e,new y6(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=f6(l||a,t),_=o;break}u.call(r,e,new y6(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:v6(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:v6(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:v6(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:v6(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}var x6=0,S6=0,C6=0,w6=1e3,T6,E6,D6=0,O6=0,k6=0,A6=typeof performance==`object`&&performance.now?performance:Date,j6=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function M6(){return O6||=(j6(tse),A6.now()+k6)}function tse(){O6=0}function N6(){this._call=this._time=this._next=null}N6.prototype=P6.prototype={constructor:N6,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?M6():+n)+(t==null?0:+t),!this._next&&E6!==this&&(E6?E6._next=this:T6=this,E6=this),this._call=e,this._time=n,I6()},stop:function(){this._call&&(this._call=null,this._time=1/0,I6())}};function P6(e,t,n){var r=new N6;return r.restart(e,t,n),r}function nse(){M6(),++x6;for(var e=T6,t;e;)(t=O6-e._time)>=0&&e._call.call(void 0,t),e=e._next;--x6}function F6(){O6=(D6=A6.now())+k6,x6=S6=0;try{nse()}finally{x6=0,ise(),O6=0}}function rse(){var e=A6.now(),t=e-D6;t>w6&&(k6-=t,D6=e)}function ise(){for(var e,t=T6,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:T6=n);E6=e,I6(r)}function I6(e){x6||(S6&&=clearTimeout(S6),e-O6>24?(e<1/0&&(S6=setTimeout(F6,e-A6.now()-k6)),C6&&=clearInterval(C6)):(C6||=(D6=A6.now(),setInterval(rse,w6)),x6=1,j6(F6)))}function L6(e,t,n){var r=new N6;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var ase=P3(`start`,`end`,`cancel`,`interrupt`),ose=[];function R6(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;sse(e,n,{name:t,index:r,group:i,on:ase,tween:ose,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function z6(e,t){var n=V6(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function B6(e,t){var n=V6(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function V6(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function sse(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=P6(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return L6(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(L6(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function H6(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function cse(e){return this.each(function(){H6(this,e)})}function lse(e,t){var n,r;return function(){var i=B6(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function use(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=B6(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function dse(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=V6(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?lse:use)(n,e,t))}function U6(e,t,n){var r=e._id;return e.each(function(){var e=B6(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return V6(e,r).value[t]}}function W6(e,t){var n;return(typeof t==`number`?TI:t instanceof XF?bI:(n=XF(t))?(t=n,bI):jI)(e,t)}function fse(e){return function(){this.removeAttribute(e)}}function pse(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mse(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function hse(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function gse(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function _se(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function vse(e,t){var n=B3(e),r=n===`transform`?HI:W6;return this.attrTween(e,typeof t==`function`?(n.local?_se:gse)(n,r,U6(this,`attr.`+e,t)):t==null?(n.local?pse:fse)(n):(n.local?hse:mse)(n,r,t))}function yse(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function bse(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function xse(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&bse(e,i)),n}return i._value=t,i}function Sse(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&yse(e,i)),n}return i._value=t,i}function Cse(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=B3(e);return this.tween(n,(r.local?xse:Sse)(r,t))}function wse(e,t){return function(){z6(this,e).delay=+t.apply(this,arguments)}}function Tse(e,t){return t=+t,function(){z6(this,e).delay=t}}function Ese(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?wse:Tse)(t,e)):V6(this.node(),t).delay}function Dse(e,t){return function(){B6(this,e).duration=+t.apply(this,arguments)}}function Ose(e,t){return t=+t,function(){B6(this,e).duration=t}}function kse(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Dse:Ose)(t,e)):V6(this.node(),t).duration}function Ase(e,t){if(typeof t!=`function`)throw Error();return function(){B6(this,e).ease=t}}function jse(e){var t=this._id;return arguments.length?this.each(Ase(t,e)):V6(this.node(),t).ease}function Mse(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();B6(this,e).ease=n}}function Nse(e){if(typeof e!=`function`)throw Error();return this.each(Mse(this._id,e))}function Pse(e){typeof e!=`function`&&(e=X3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new K6(r,this._parents,this._name,this._id)}function Fse(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new K6(o,this._parents,this._name,this._id)}function Ise(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function Lse(e,t,n){var r,i,a=Ise(t)?z6:B6;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Rse(e,t){var n=this._id;return arguments.length<2?V6(this.node(),n).on.on(e):this.each(Lse(n,e,t))}function zse(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Bse(){return this.on(`end.remove`,zse(this._id))}function Vse(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=G3(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,R6(l[f],t,n,f,l,V6(u,n)));return new K6(a,this._parents,t,n)}function Hse(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Y3(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=V6(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&R6(p,t,n,h,f,m);a.push(f),o.push(u)}return new K6(a,o,t,n)}var Use=u6.prototype.constructor;function Wse(){return new Use(this._groups,this._parents)}function Gse(e,t){var n,r,i;return function(){var a=t6(this,e),o=(this.style.removeProperty(e),t6(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function G6(e){return function(){this.style.removeProperty(e)}}function Kse(e,t,n){var r,i=n+``,a;return function(){var o=t6(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function qse(e,t,n){var r,i,a;return function(){var o=t6(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),t6(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Jse(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=B6(this,e),l=c.on,u=c.value[a]==null?s||=G6(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Yse(e,t,n){var r=(e+=``)==`transform`?VI:W6;return t==null?this.styleTween(e,Gse(e,r)).on(`end.style.`+e,G6(e)):typeof t==`function`?this.styleTween(e,qse(e,r,U6(this,`style.`+e,t))).each(Jse(this._id,e)):this.styleTween(e,Kse(e,r,t),n).on(`end.style.`+e,null)}function Xse(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Zse(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Xse(e,a,n)),r}return a._value=t,a}function Qse(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Zse(e,t,n??``))}function $se(e){return function(){this.textContent=e}}function ece(e){return function(){this.textContent=e(this)??``}}function tce(e){return this.tween(`text`,typeof e==`function`?ece(U6(this,`text`,e)):$se(e==null?``:e+``))}function nce(e){return function(t){this.textContent=e.call(this,t)}}function rce(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&nce(r)),t}return r._value=e,r}function ice(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,rce(e))}function ace(){for(var e=this._name,t=this._id,n=q6(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=V6(c,t);R6(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new K6(r,this._parents,e,n)}function oce(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=B6(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var sce=0;function K6(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function cce(e){return u6().transition(e)}function q6(){return++sce}var J6=u6.prototype;K6.prototype=cce.prototype={constructor:K6,select:Vse,selectAll:Hse,selectChild:J6.selectChild,selectChildren:J6.selectChildren,filter:Pse,merge:Fse,selection:Wse,transition:ace,call:J6.call,nodes:J6.nodes,node:J6.node,size:J6.size,empty:J6.empty,each:J6.each,on:Rse,attr:vse,attrTween:Cse,style:Yse,styleTween:Qse,text:tce,textTween:ice,remove:Bse,tween:dse,delay:Ese,duration:kse,ease:jse,easeVarying:Nse,end:oce,[Symbol.iterator]:J6[Symbol.iterator]};function lce(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var uce={time:null,delay:0,duration:250,ease:lce};function dce(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function fce(e){var t,n;e instanceof K6?(t=e._id,e=e._name):(t=q6(),(n=uce).time=M6(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&R6(c,e,t,l,o,n||dce(c,t));return new K6(r,this._parents,e,t)}u6.prototype.interrupt=cse,u6.prototype.transition=fce;var Y6=e=>()=>e;function pce(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function X6(e,t,n){this.k=e,this.x=t,this.y=n}X6.prototype={constructor:X6,scale:function(e){return e===1?this:new X6(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new X6(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Z6=new X6(1,0,0);Q6.prototype=X6.prototype;function Q6(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Z6;return e.__zoom}function $6(e){e.stopImmediatePropagation()}function e8(e){e.preventDefault(),e.stopImmediatePropagation()}function mce(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function hce(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function t8(){return this.__zoom||Z6}function gce(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _ce(){return navigator.maxTouchPoints||`ontouchstart`in this}function vce(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function n8(){var e=mce,t=hce,n=vce,r=gce,i=_ce,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=qI,l=P3(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,t8).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,t8),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Z6.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new X6(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new X6(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new X6(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=d6(this.that).datum();l.call(e,this.that,new pce(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=f6(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],H6(this),s.start();e8(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=d6(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=f6(t,i),l=t.clientX,u=t.clientY;g6(t.view),$6(t),a.mouse=[c,this.__zoom.invert(c)],H6(this),a.start();function d(e){if(e8(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=f6(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),_6(e.view,a.moved),e8(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=f6(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);e8(r),s>0?d6(this).transition().duration(s).call(x,d,c,r):d6(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for($6(t),s=0;s<i;++s)c=r[s],l=f6(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),H6(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(e8(e),s=0;s<a;++s)c=i[s],l=f6(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for($6(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=f6(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=d6(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Y6(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Y6(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Y6(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Y6([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var r8={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`},i8=[[-1/0,-1/0],[1/0,1/0]],a8=[`Enter`,` `,`Escape`],o8={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},s8;(function(e){e.Strict=`strict`,e.Loose=`loose`})(s8||={});var c8;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(c8||={});var l8;(function(e){e.Partial=`partial`,e.Full=`full`})(l8||={});var u8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},d8;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(d8||={});var f8;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(f8||={});var p8;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(p8||={});var m8={[p8.Left]:p8.Right,[p8.Right]:p8.Left,[p8.Top]:p8.Bottom,[p8.Bottom]:p8.Top};function h8(e){return e===null?null:e?`valid`:`invalid`}var g8=e=>`id`in e&&`source`in e&&`target`in e,yce=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),_8=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),v8=(e,t=[0,0])=>{let{width:n,height:r}=U8(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},bce=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:k8(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):_8(n)?n:t.nodeLookup.get(n.id)),D8(e,i?j8(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),y8=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=D8(n,j8(e)),r=!0)}),r?k8(n):{x:0,y:0,width:0,height:0}},b8=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...L8(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??null,l=e.height??t.height??t.initialHeight??null,u=N8(s,A8(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},xce=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Sce(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Cce({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=B8(y8(Sce(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)}function x8({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,r8.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&H8(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=H8(d)?C8(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,r8.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function wce({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=xce(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var S8=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),C8=(e={x:0,y:0},t,n)=>({x:S8(e.x,t[0][0],t[1][0]-(n?.width??0)),y:S8(e.y,t[0][1],t[1][1]-(n?.height??0))});function w8(e,t,n){let{width:r,height:i}=U8(n),{x:a,y:o}=n.internals.positionAbsolute;return C8(e,[[a,o],[a+r,o+i]],t)}var T8=(e,t,n)=>e<t?S8(Math.abs(e-t),1,t)/t:e>n?-S8(Math.abs(e-n),1,t)/t:0,E8=(e,t,n=15,r=40)=>[T8(e.x,r,t.width-r)*n,T8(e.y,r,t.height-r)*n],D8=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),O8=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),k8=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),A8=(e,t=[0,0])=>{let{x:n,y:r}=_8(e)?e.internals.positionAbsolute:v8(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},j8=(e,t=[0,0])=>{let{x:n,y:r}=_8(e)?e.internals.positionAbsolute:v8(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},M8=(e,t)=>k8(D8(O8(e),O8(t))),N8=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},P8=e=>F8(e.width)&&F8(e.height)&&F8(e.x)&&F8(e.y),F8=e=>!isNaN(e)&&isFinite(e),Tce=(e,t)=>{},I8=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),L8=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?I8(s,o):s},R8=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function z8(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ece(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=z8(e,n),i=z8(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=z8(e.top??e.y??0,n),i=z8(e.bottom??e.y??0,n),a=z8(e.left??e.x??0,t),o=z8(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Dce(e,t,n,r,i,a){let{x:o,y:s}=R8(e,[t,n,r]),{x:c,y:l}=R8({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var B8=(e,t,n,r,i,a)=>{let o=Ece(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=S8(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=Dce(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},V8=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function H8(e){return e!=null&&e!==`parent`}function U8(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function W8(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function G8(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function K8(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Oce(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function kce(e){return{...o8,...e||{}}}function q8(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Q8(e),s=L8({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?I8(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var J8=e=>({width:e.offsetWidth,height:e.offsetHeight}),Y8=e=>e?.getRootNode?.()||window?.document,Ace=[`INPUT`,`SELECT`,`TEXTAREA`];function X8(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Ace.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Z8=e=>`clientX`in e,Q8=(e,t)=>{let n=Z8(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},$8=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...J8(t)}})};function e5({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function t5(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function n5({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case p8.Left:return[t-t5(t-r,a),n];case p8.Right:return[t+t5(r-t,a),n];case p8.Top:return[t,n-t5(n-i,a)];case p8.Bottom:return[t,n+t5(i-n,a)]}}function r5({sourceX:e,sourceY:t,sourcePosition:n=p8.Bottom,targetX:r,targetY:i,targetPosition:a=p8.Top,curvature:o=.25}){let[s,c]=n5({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=n5({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=e5({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function i5({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function jce({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function Mce({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=D8(j8(e),j8(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),N8({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},k8(a))>0}var Nce=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Pce=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Fce=(e,t,n={})=>{if(!e.source||!e.target)return r8.error006(),t;let r=n.getEdgeId||Nce,i;return i=g8(e)?{...e}:{...e,id:r(e)},Pce(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function a5({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=i5({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var o5={[p8.Left]:{x:-1,y:0},[p8.Right]:{x:1,y:0},[p8.Top]:{x:0,y:-1},[p8.Bottom]:{x:0,y:1}},Ice=({source:e,sourcePosition:t=p8.Bottom,target:n})=>t===p8.Left||t===p8.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},s5=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Lce({source:e,sourcePosition:t=p8.Bottom,target:n,targetPosition:r=p8.Top,center:i,offset:a,stepPosition:o}){let s=o5[t],c=o5[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Ice({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=i5({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Rce(e,t,n,r){let i=Math.min(s5(e,t)/2,s5(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function c5({sourceX:e,sourceY:t,sourcePosition:n=p8.Bottom,targetX:r,targetY:i,targetPosition:a=p8.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Lce({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=Rce(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function l5(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function zce(e){let{sourceNode:t,targetNode:n}=e;if(!l5(t)||!l5(n))return null;let r=t.internals.handleBounds||u5(t.handles),i=n.internals.handleBounds||u5(n.handles),a=f5(r?.source??[],e.sourceHandle),o=f5(e.connectionMode===s8.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,r8.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||p8.Bottom,c=o?.position||p8.Top,l=d5(t,a,s),u=d5(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function u5(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function d5(e,t,n=p8.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??U8(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case p8.Top:return{x:i+o/2,y:a};case p8.Right:return{x:i+o,y:a+s/2};case p8.Bottom:return{x:i+o/2,y:a+s};case p8.Left:return{x:i,y:a+s/2}}}function f5(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function p5(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Bce(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=p5(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var m5=1e3,Vce=10,h5={nodeOrigin:[0,0],nodeExtent:i8,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Hce={...h5,checkEquality:!0};function g5(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Uce(e,t,n){let r=g5(h5,n);for(let n of e.values())if(n.parentId)y5(n,e,t,r);else{let e=C8(v8(n,r.nodeOrigin),H8(n.extent)?n.extent:r.nodeExtent,U8(n));n.internals.positionAbsolute=e}}function Wce(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function _5(e){return e===`manual`}function v5(e,t,n,r={}){let i=g5(Hce,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!_5(i.zIndexMode)?m5:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=C8(v8(u,i.nodeOrigin),H8(u.extent)?u.extent:i.nodeExtent,U8(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Wce(u,e),z:b5(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&y5(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Gce(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function y5(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=g5(h5,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Gce(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Vce),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Kce(e,u,o,s,a&&!_5(c)?m5:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function b5(e,t,n){let r=F8(e.zIndex)?e.zIndex:0;return _5(n)?r:r+(e.selected?t:0)}function Kce(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=U8(e),l=v8(e,n),u=H8(e.extent)?C8(l,e.extent,c):l,d=C8({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=w8(d,c,t));let f=b5(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function x5(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=M8(a.get(n.parentId)?.expandedRect??A8(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=U8(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function qce(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=J8(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=H8(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=w8(h,s,t.get(e.parentId)):m&&(h=C8(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:$8(`source`,r.nodeElement,p,d,e.id),target:$8(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&y5(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:A8(g,i)}))}}if(f.length>0){let e=x5(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Jce({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r),s=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(s)}function S5(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function C5(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;S5(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),S5(`target`,s,c,e,i,o),t.set(r.id,r)}}function w5(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:w5(n,t):!1}function T5(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Yce(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!w5(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function E5({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Xce({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=I8(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Zce({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=d6(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?O8(y8(s)):null,x=v&&l?Xce({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:I8(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=x8({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=E5({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=E8(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=q8(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Yce(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=E5({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=b6().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=q8(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Q8(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=q8(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Q8(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Q8(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!(!d||p)&&(c=!1,d=!1,cancelAnimationFrame(o),s.size>0)){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=E5({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!T5(t,`.${g}`,v))&&(!_||T5(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Qce(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())N8(i,A8(e))>0&&r.push(e);return r}var $ce=250;function ele(e,t,n,r){let i=[],a=1/0,o=Qce(e,n,t+$ce);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=d5(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function D5(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...d5(o,c,c.position,!0)}:c}function O5(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function tle(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var k5=()=>!0;function nle(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=k5,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Y8(e.target),E=0,D,{x:O,y:k}=Q8(e),A=O5(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=D5(i,A,r,c,t);if(!N)return;let ee=Q8(e,j),te=!1,P=null,ne=!1,re=null;function ie(){if(!u||!j)return;let[e,t]=E8(ee,j,S);f({x:e,y:t}),E=requestAnimationFrame(ie)}let ae={...N,nodeId:i,type:A,position:N.position},F=c.get(i),I={inProgress:!0,isValid:null,from:d5(F,ae,p8.Left,!0),fromHandle:ae,fromPosition:ae.position,fromNode:F,to:ee,toHandle:null,toPosition:m8[ae.position],toNode:null,pointer:ee};function oe(){M=!0,y(I),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&oe();function se(e){if(!M){let{x:t,y:n}=Q8(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;oe()}if(!x()||!ae){ce(e);return}let a=b();ee=Q8(e,j),D=ele(L8(ee,a,!1,[1,1]),n,c,ae),te||=(ie(),!0);let s=A5(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});re=s.handleDomNode,P=s.connection,ne=tle(!!D,s.isValid);let u=c.get(i),f=u?d5(u,ae,p8.Left,!0):I.from,p={...I,from:f,isValid:ne,to:s.toHandle&&ne?R8({x:s.toHandle.x,y:s.toHandle.y},a):ee,toHandle:s.toHandle,toPosition:ne&&s.toHandle?s.toHandle.position:m8[ae.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:ee};y(p),I=p}function ce(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||re)&&P&&ne&&h?.(P);let{inProgress:t,...n}=I,r={...n,toPosition:I.toHandle?I.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),te=!1,ne=!1,P=null,re=null,T.removeEventListener(`mousemove`,se),T.removeEventListener(`mouseup`,ce),T.removeEventListener(`touchmove`,se),T.removeEventListener(`touchend`,ce)}}T.addEventListener(`mousemove`,se),T.addEventListener(`mouseup`,ce),T.addEventListener(`touchmove`,se),T.addEventListener(`touchend`,ce)}function A5(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=k5,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Q8(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=O5(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===s8.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=D5(t,e,a,u,n,!0)}return _}var j5={onPointerDown:nle,isValid:A5};function rle({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=d6(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&V8()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=n8().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:f6}}var M5=e=>({x:e.x,y:e.y,zoom:e.k}),N5=({x:e,y:t,zoom:n})=>Z6.translate(e,t).scale(n),P5=(e,t)=>e.target.closest(`.${t}`),F5=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ile=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,I5=(e,t=0,n=ile,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},L5=e=>{let t=e.ctrlKey&&V8()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function ale({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(P5(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=f6(u),t=d*2**L5(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===c8.Vertical?0:u.deltaX*f,m=i===c8.Horizontal?0:u.deltaY*f;!V8()&&u.shiftKey&&i!==c8.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=M5(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function ole({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=P5(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function sle({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=M5(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function cle({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&F5(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,M5(a.transform))}}function lle({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&F5(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=M5(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function ule({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(P5(d,`${l}-flow__node`)||P5(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||P5(d,s)&&m||P5(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function dle({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=n8().scaleExtent([t,n]).translateExtent(r),f=d6(e).call(d);v({x:i.x,y:i.y,zoom:S8(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(L5);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?MI:qI).transform(I5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!F8(E)||E<0?0:E);let k=O?ale({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):ole({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=sle({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=cle({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=lle({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=ule({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(A),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=N5(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=N5(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=N5(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?Q6(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?MI:qI).scaleTo(I5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?MI:qI).scaleBy(I5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!F8(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var R5;(function(e){e.Line=`line`,e.Handle=`handle`})(R5||={});function fle({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function z5(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function B5(e,t){return Math.max(0,t-e)}function V5(e,t){return Math.max(0,e-t)}function H5(e,t,n){return Math.max(0,t-e,e-n)}function U5(e,t){return e?!t:t}function ple(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=H5(E,h,g),j=H5(D,_,v);if(o){let e=0,t=0;c&&w<0?e=B5(y+w+O,o[0][0]):!c&&w>0&&(e=V5(y+E+O,o[1][0])),l&&T<0?t=B5(b+T+k,o[0][1]):!l&&T>0&&(t=V5(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=V5(y+w,s[0][0]):!c&&w<0&&(e=B5(y+E,s[1][0])),l&&T>0?t=V5(b+T,s[0][1]):!l&&T<0&&(t=B5(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=H5(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?V5(b+k+E/C,o[1][1])*C:B5(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?B5(b+E/C,s[1][1])*C:V5(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=H5(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?V5(y+D*C+O,o[1][0])/C:B5(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?B5(y+D*C,s[1][0])/C:V5(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(U5(c,l)?-w:w)/C:w=(U5(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var W5={width:0,height:0,x:0,y:0},mle={...W5,pointerX:0,pointerY:0,aspectRatio:1};function hle(e){return[[0,0],[e.measured.width,e.measured.height]]}function gle(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function _le({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=d6(e),o={controlDirection:z5(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...W5},h={...mle};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:z5(e)};let g,_=null,v=[],y,b,x,S=!1,C=b6().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=q8(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId),b=y&&g.extent===`parent`?hle(y):void 0),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=gle(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=q8(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=ple(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,ee=A!==f&&M;if(!N&&!ee&&!j&&!M)return;if((N||ee||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=ee?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let te=fle({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),P={...m,direction:te};p?.(e,P)!==!1&&(S=!0,d?.(e,P),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var G5=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},vle=e=>e?G5(e):G5,{useDebugValue:yle}=L.default,{useSyncExternalStoreWithSelector:ble}=rT.default,xle=e=>e;function K5(e,t=xle,n){let r=ble(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return yle(r),r}var q5=(e,t)=>{let n=vle(e),r=(e,r=t)=>K5(n,e,r);return Object.assign(r,n),r},Sle=(e,t)=>e?q5(e,t):q5;function J5(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Y5=(0,L.createContext)(null),Cle=Y5.Provider,X5=r8.error001();function Z5(e,t){let n=(0,L.useContext)(Y5);if(n===null)throw Error(X5);return K5(n,e,t)}function Q5(){let e=(0,L.useContext)(Y5);if(e===null)throw Error(X5);return(0,L.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var $5={display:`none`},wle={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},e7=`react-flow__node-desc`,t7=`react-flow__edge-desc`,Tle=`react-flow__aria-live`,Ele=e=>e.ariaLiveMessage,Dle=e=>e.ariaLabelConfig;function Ole({rfId:e}){let t=Z5(Ele);return(0,R.jsx)(`div`,{id:`${Tle}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:wle,children:t})}function kle({rfId:e,disableKeyboardA11y:t}){let n=Z5(Dle);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{id:`${e7}-${e}`,style:$5,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,R.jsx)(`div`,{id:`${t7}-${e}`,style:$5,children:n[`edge.a11yDescription.default`]}),!t&&(0,R.jsx)(Ole,{rfId:e})]})}var n7=(0,L.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,R.jsx)(`div`,{className:M3([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));n7.displayName=`Panel`;function Ale({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,R.jsx)(n7,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev`,children:(0,R.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var jle=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},r7=e=>e.id;function Mle(e,t){return J5(e.selectedNodes.map(r7),t.selectedNodes.map(r7))&&J5(e.selectedEdges.map(r7),t.selectedEdges.map(r7))}function Nle({onSelectionChange:e}){let t=Q5(),{selectedNodes:n,selectedEdges:r}=Z5(jle,Mle);return(0,L.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Ple=e=>!!e.onSelectionChangeHandlers;function Fle({onSelectionChange:e}){let t=Z5(Ple);return e||t?(0,R.jsx)(Nle,{onSelectionChange:e}):null}var i7=typeof window<`u`?L.useLayoutEffect:L.useEffect,a7=[0,0],Ile={x:0,y:0,zoom:1},o7=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],Lle=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),s7={translateExtent:i8,nodeOrigin:a7,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Rle(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=Z5(Lle,J5),l=Q5();i7(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=s7,s()}),[]);let u=(0,L.useRef)(s7);return i7(()=>{for(let s of o7){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:kce(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},o7.map(t=>e[t])),null}function c7(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function zle(e){let[t,n]=(0,L.useState)(e===`system`?null:e);return(0,L.useEffect)(()=>{if(e!==`system`){n(e);return}let t=c7(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?c7()?.matches?`dark`:`light`:t}var l7=typeof document<`u`?document:null;function u7(e=null,t={target:l7,actInsideInputWithModifier:!0}){let[n,r]=(0,L.useState)(!1),i=(0,L.useRef)(!1),a=(0,L.useRef)(new Set([])),[o,s]=(0,L.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
72
+ …`:m}),g&&(0,R.jsx)(`button`,{onClick:()=>c(r.id),className:`mt-2 text-xs text-blue-600 hover:underline flex items-center gap-1`,children:f?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Us,{className:`w-3 h-3`}),`收起`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Bs,{className:`w-3 h-3`}),`展开全部(`,h.length,` 行)`]})})]}),r.stepExecutions&&r.stepExecutions.length>0&&(0,R.jsx)(`div`,{className:`border-t border-gray-100 bg-white px-4 py-3`,children:(0,R.jsx)(s3,{steps:r.stepExecutions,currentStepId:r.currentStepId})}),r.status===`in_progress`&&h.length===0&&(0,R.jsxs)(`div`,{className:`border-t border-blue-100 bg-blue-50 px-4 py-3 flex items-center gap-2 text-sm text-blue-600`,children:[(0,R.jsx)(`div`,{className:`w-2 h-2 rounded-full bg-blue-500 animate-pulse`}),`正在执行,等待产出…`]})]},r.id)})})]})}var _3={PreToolUse:`#3b82f6`,PostToolUse:`#10b981`,UserPromptSubmit:`#f59e0b`,Stop:`#ef4444`};function v3(){let{id:e}=Ln(),t=Fn(),n=Mn(),r=Ye(),[i,a]=(0,L.useState)(`tasks`),[o,s]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),c=n.state?.from||`/pipelines`,{data:l,isLoading:u,isError:d,error:f}=ut({queryKey:[`pipeline`,e],queryFn:()=>vl(e).then(e=>e.data),enabled:!!e,refetchInterval:5e3}),p=z({mutationFn:()=>Nl(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),t(c)},onError:e=>H(e.message||`关闭失败`,`error`)}),m=z({mutationFn:()=>Pl(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),H(`Pipeline 已重新激活`,`success`)},onError:e=>H(e.message||`重新激活失败`,`error`)}),h=z({mutationFn:()=>Rl(e),onSuccess:()=>{H(`已添加到执行队列,下次工具调用时自动注入提示`,`success`)},onError:e=>H(e.message||`恢复失败`,`error`)}),g=z({mutationFn:t=>zl(e),onSuccess:t=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),H(t.data.message||`节点已重置,等待重新执行`,`success`)},onError:e=>H(e.message||`重试失败`,`error`)}),_=z({mutationFn:e=>nu(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),H(`问题已标记为已解决`,`success`)},onError:e=>H(e.message||`操作失败`,`error`)}),v=z({mutationFn:e=>ru(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),H(`问题已忽略`,`success`)},onError:e=>H(e.message||`操作失败`,`error`)});if(d)return(0,R.jsxs)(`div`,{className:`flex items-center justify-center h-96 text-red-500`,children:[`加载失败:`,f?.message||`未知错误`]});if(u||!l)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let y=l,b=y.status!==`completed`&&y.status!==`failed`;return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X4,{items:[{label:`Pipeline 列表`,path:`/pipelines`},{label:l.id.slice(0,12)+`...`}]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:ks,onClick:()=>t(c),children:`返回`}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`h2`,{className:`text-lg font-bold text-gray-900`,children:`Pipeline 执行轨迹`}),(0,R.jsxs)(fS,{variant:`primary`,size:`sm`,children:[(0,R.jsx)(Qc,{className:`w-3 h-3 mr-1`}),` 动态编排`]})]}),(0,R.jsxs)(`p`,{className:`text-sm text-gray-500`,children:[(0,R.jsx)(`span`,{className:`font-mono`,children:l.id.slice(0,12)}),l.sessionId&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`mx-2`,children:`·`}),(0,R.jsxs)(`span`,{className:`text-blue-600 cursor-pointer hover:underline`,onClick:()=>t(`/sessions/${l.sessionId}`),children:[`会话 `,l.sessionId.slice(0,8)]})]})]})]}),(0,R.jsx)(fS,{variant:b?`info`:`success`,children:y.status===`completed`?`已完成`:y.status===`failed`?`已失败`:`执行中`}),(0,R.jsx)(fS,{variant:l.complexity===`complex`?`danger`:l.complexity===`moderate`?`warning`:`default`,children:l.complexity})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[l.sessionId&&(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Ds,onClick:()=>t(`/sessions/${l.sessionId}`),children:`查看会话`}),b&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Y,{variant:`primary`,size:`sm`,onClick:()=>h.mutate(),loading:h.isPending,children:`继续执行`}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,icon:el,onClick:()=>{s({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{p.mutate(),s(e=>({...e,open:!1}))}})},children:`关闭`})]}),!b&&(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Pc,onClick:()=>{s({open:!0,title:`重新激活 Pipeline`,description:`确认重新激活此 Pipeline?状态将重置为活跃。`,onConfirm:()=>{m.mutate(),s(e=>({...e,open:!1}))}})},loading:m.isPending,children:`重新激活`})]})]}),(0,R.jsx)(X,{className:`!p-4`,children:(0,R.jsx)(`p`,{className:`text-sm text-gray-700 line-clamp-3`,children:l.requirement})}),y.executionPlan&&(0,R.jsx)(X,{title:`编排计划`,className:`!p-4`,children:(0,R.jsxs)(`div`,{className:`space-y-4`,children:[y.reasoning&&(0,R.jsxs)(`div`,{className:`text-sm text-gray-600 bg-blue-50 p-3 rounded-lg border border-blue-100`,children:[(0,R.jsx)(`div`,{className:`font-medium text-blue-900 mb-1`,children:`规划依据`}),(0,R.jsx)(`p`,{className:`text-blue-800`,children:y.reasoning})]}),(0,R.jsx)(`div`,{className:`space-y-2`,children:y.executionPlan.stages.map((e,t)=>{let n=y.nodes.find(t=>t.nodeTypeId===e.nodeTypeId),r=n?.status===`completed`,i=n?.status===`in_progress`,a=!n||n.status===`pending`;return(0,R.jsxs)(`div`,{className:q(`flex items-start gap-3 p-3 rounded-lg border`,r&&`bg-green-50 border-green-200`,i&&`bg-blue-50 border-blue-200`,a&&`bg-gray-50 border-gray-200`),children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold`,style:{backgroundColor:r?`#10b981`:i?`#3b82f6`:`#9ca3af`,color:`white`},children:t+1}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium text-gray-900`,children:e.name}),(0,R.jsx)(fS,{size:`sm`,variant:r?`success`:i?`info`:`default`,children:r?`已完成`:i?`进行中`:`待执行`}),e.phase&&(0,R.jsx)(fS,{size:`sm`,children:e.phase})]}),e.description&&(0,R.jsx)(`p`,{className:`text-sm text-gray-600 mt-1`,children:e.description}),e.expectedArtifacts&&e.expectedArtifacts.length>0&&(0,R.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`预期产物:`}),e.expectedArtifacts.map((e,t)=>(0,R.jsxs)(`span`,{className:`ml-1 font-mono bg-gray-100 px-1.5 py-0.5 rounded`,children:[e.pattern,e.required&&(0,R.jsx)(`span`,{className:`text-red-500`,children:`*`})]},t))]})]})]},t)})})]})}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-3`,children:[(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-blue-600`,children:l.stats.totalEvents}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`事件`})]}),(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-green-600`,children:`${y.stats.completedNodes}/${y.stats.totalNodes}`}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`节点`})]}),(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-purple-600`,children:l.stats.totalArtifacts}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`产物`})]}),(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-orange-600`,children:l.stats.totalQualityIssues}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`质量问题`})]}),(0,R.jsxs)(X,{className:`text-center !p-3`,children:[(0,R.jsx)(`div`,{className:`text-xl font-bold text-red-600`,children:l.stats.unresolvedQuality}),(0,R.jsx)(`div`,{className:`text-xs text-gray-500`,children:`未解决`})]})]}),(0,R.jsx)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[`tasks`,`events`,`artifacts`,`quality`].map(e=>(0,R.jsx)(`button`,{onClick:()=>a(e),className:q(`px-4 py-2 rounded-md text-sm font-medium transition-colors`,i===e?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:{tasks:`编排图 (${y.stats.totalNodes})`,events:`事件 (${l.stats.totalEvents})`,artifacts:`产物 (${l.stats.totalArtifacts})`,quality:`质量 (${l.stats.totalQualityIssues})`}[e]},e))}),i===`tasks`&&(0,R.jsx)(`div`,{className:`space-y-4`,children:(0,R.jsx)(g3,{pipeline:y,onRetryNode:e=>{s({open:!0,title:`重试失败节点`,description:`确定要重试此节点吗?节点状态将重置为等待中,下次工具调用时自动重新执行。`,onConfirm:()=>{g.mutate(e),s(e=>({...e,open:!1}))}})}})}),i===`events`&&(0,R.jsx)(X,{title:`工具调用时间线`,children:(0,R.jsxs)(`div`,{className:`space-y-1 max-h-[600px] overflow-y-auto`,children:[l.events.map((e,t)=>(0,R.jsxs)(sS.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:t*.01},className:`flex items-center gap-3 py-1.5 px-2 rounded hover:bg-gray-50 text-sm`,children:[(0,R.jsx)(`span`,{className:`text-gray-400 font-mono w-16 flex-shrink-0`,children:x4(Df(e.time),`HH:mm:ss`)}),(0,R.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:_3[e.hookType]||`#6b7280`}}),(0,R.jsx)(`span`,{className:`font-mono text-gray-700 w-20 flex-shrink-0`,children:e.toolName||e.hookType}),(0,R.jsx)(`span`,{className:`text-gray-500 truncate`,children:e.detail||``})]},t)),l.events.length===0&&(0,R.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无事件`})]})}),i===`artifacts`&&(0,R.jsx)(X,{title:`产物文件`,children:(0,R.jsxs)(`div`,{className:`space-y-2`,children:[l.artifacts.map((e,t)=>(0,R.jsx)(sS.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:t*.03},className:`flex items-center justify-between p-3 rounded-lg border border-gray-100 hover:border-green-200 hover:bg-green-50/50`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(oc,{className:`h-5 w-5 text-green-500`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-mono text-sm text-gray-900`,children:e.filePath.split(`/`).slice(-2).join(`/`)}),(0,R.jsxs)(`div`,{className:`text-xs text-gray-400`,children:[e.tool,` · `,x4(Df(e.time),`HH:mm:ss`)]})]})]})},t)),l.artifacts.length===0&&(0,R.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无产物`})]})}),i===`quality`&&(0,R.jsx)(X,{title:`质量问题`,children:(0,R.jsxs)(`div`,{className:`space-y-2`,children:[l.qualityIssues.map((e,t)=>(0,R.jsxs)(sS.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:t*.03},className:`flex items-start justify-between p-3 rounded-lg border border-gray-100`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3 flex-1`,children:[e.resolved?(0,R.jsx)(Gs,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,R.jsx)(Xc,{className:`h-5 w-5 text-amber-500 mt-0.5`}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(fS,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,R.jsx)(fS,{size:`sm`,children:e.category})]}),(0,R.jsx)(`p`,{className:`text-sm text-gray-700 mt-1`,children:e.message}),(0,R.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:x4(Df(e.createdAt),`MM-dd HH:mm`)})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(fS,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),!e.resolved&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>_.mutate(e.id),loading:_.isPending,children:`解决`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>v.mutate(e.id),loading:v.isPending,children:`忽略`})]})]})]},t)),l.qualityIssues.length===0&&(0,R.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,R.jsx)(zc,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`暂无质量问题`]})]})}),(0,R.jsx)(w4,{open:o.open,title:o.title,description:o.description,variant:`danger`,onConfirm:o.onConfirm,onCancel:()=>s({...o,open:!1})})]})}var y3={spec:{label:`规格`,icon:cc,color:`text-blue-600`,bg:`bg-blue-50`,border:`border-blue-200`},security:{label:`安全`,icon:Bc,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-200`},quality:{label:`质量`,icon:oc,color:`text-purple-600`,bg:`bg-purple-50`,border:`border-purple-200`},test:{label:`测试`,icon:qc,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-200`},performance:{label:`性能`,icon:tl,color:`text-orange-600`,bg:`bg-orange-50`,border:`border-orange-200`}},b3={fail:{label:`失败`,icon:qs,color:`text-red-600`,bg:`bg-red-50`,border:`border-red-300`},warn:{label:`警告`,icon:Xc,color:`text-yellow-600`,bg:`bg-yellow-50`,border:`border-yellow-300`},pass:{label:`通过`,icon:Gs,color:`text-green-600`,bg:`bg-green-50`,border:`border-green-300`}};function x3({level:e}){let t=b3[e];if(!t)return(0,R.jsx)(fS,{size:`sm`,children:e});let n=t.icon;return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,R.jsx)(n,{className:`h-3 w-3`}),t.label]})}function S3({category:e}){let t=y3[e];if(!t)return(0,R.jsx)(fS,{size:`sm`,children:e});let n=t.icon;return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border ${t.bg} ${t.color} ${t.border}`,children:[(0,R.jsx)(n,{className:`h-3 w-3`}),t.label]})}function C3(){let e=Ye(),[t,n]=(0,L.useState)(``),r=cS(t),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(1),[g,_]=(0,L.useState)(20),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)(new Set),[w,T]=(0,L.useState)(`list`),[E,D]=(0,L.useState)(new Set),[O,k]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:A,isError:j,refetch:M}=ut({queryKey:[`quality-unresolved`],queryFn:()=>bl().then(e=>e.data),refetchInterval:1e4}),{data:N}=ut({queryKey:[`quality-history`,i,o,c,u,r],queryFn:()=>yl({limit:500,level:i||void 0,category:o||void 0,resolved:c===`resolved`?!0:c===`unresolved`?!1:void 0,project_path:u||void 0,search:r||void 0}).then(e=>e.data)}),{data:ee}=ut({queryKey:[`quality-history`,`all`],queryFn:()=>yl({limit:500}).then(e=>e.data)}),te=z({mutationFn:e=>nu(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),P=z({mutationFn:e=>ru(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),ne=z({mutationFn:()=>ou(),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),re=z({mutationFn:e=>iu(e),onSuccess:t=>{C(new Set),e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]}),t.failed.length>0&&alert(`忽略完成:成功 ${t.success.length} 个,失败 ${t.failed.length} 个\n失败原因:\n${t.errors.map(e=>`${e.id}: ${e.reason}`).join(`
73
+ `)}`)}}),ie=z({mutationFn:e=>au(e),onSuccess:t=>{C(new Set),e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]}),t.failed.length>0&&alert(`解决完成:成功 ${t.success.length} 个,失败 ${t.failed.length} 个\n失败原因:\n${t.errors.map(e=>`${e.id}: ${e.reason}`).join(`
74
+ `)}`)}}),ae=async e=>{try{let t=await su(e);await navigator.clipboard.writeText(t.data.context),x(e),H(`上下文已复制,请粘贴到 Claude Code 进行修复`,`success`),setTimeout(()=>x(null),3e3)}catch{H(`复制失败`,`error`)}},F=N?.items||[],I=F.reduce((e,t)=>{let n=t.project_path?.split(`/`).pop()||`未知项目`;return e[n]||(e[n]=[]),e[n].push(t),e},{}),oe=Math.ceil(F.length/g),se=F.slice((m-1)*g,m*g),ce=ee?.total||0,le=A?.total||0,ue=F.filter(e=>e.level===`fail`).length,de=F.filter(e=>e.level===`warn`).length,fe=Array.from(new Set(ee?.items.map(e=>e.level)||[])),pe=Array.from(new Set(ee?.items.map(e=>e.category)||[])),me=Array.from(new Set(ee?.items.map(e=>e.project_path?.split(`/`).pop()||``).filter(Boolean)||[])),he=[i,o,c,u].filter(Boolean).length,ge=()=>{let e=[`级别`,`类别`,`消息`,`项目`,`状态`,`创建时间`],t=F.map(e=>[e.level,e.category,e.message,e.project_path?.split(`/`).pop()||``,e.resolved?`已解决`:`未解决`,e.created_at?x4(Df(e.created_at),`yyyy-MM-dd HH:mm:ss`):``]);K4(`quality-issues-${x4(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)};return j?(0,R.jsx)(q4,{message:`质量数据加载失败`,onRetry:()=>M()}):(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[(0,R.jsx)(Lc,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,R.jsx)(`input`,{type:`text`,placeholder:`搜索问题描述...`,value:t,onChange:e=>{n(e.target.value),h(1)},className:`w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,R.jsxs)(`button`,{onClick:()=>p(e=>!e),className:q(`flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border transition-colors`,f||he>0?`border-blue-300 bg-blue-50 text-blue-700`:`border-gray-200 text-gray-600 hover:bg-gray-50`),children:[(0,R.jsx)(fc,{className:`h-4 w-4`}),`筛选`,he>0&&(0,R.jsx)(`span`,{className:`ml-1 px-1.5 py-0.5 bg-blue-600 text-white text-xs rounded-full`,children:he}),(0,R.jsx)(Bs,{className:q(`h-3.5 w-3.5 transition-transform`,f&&`rotate-180`)})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[S.size>0&&(0,R.jsxs)(Y,{variant:`secondary`,size:`sm`,icon:zs,onClick:()=>k({open:!0,title:`批量解决问题`,description:`确认将选中的 ${S.size} 个问题标记为已解决?`,count:S.size,onConfirm:()=>{ie.mutate(Array.from(S)),k(e=>({...e,open:!1}))}}),loading:ie.isPending,children:[`解决 (`,S.size,`)`]}),S.size>0&&(0,R.jsxs)(Y,{variant:`secondary`,size:`sm`,icon:el,onClick:()=>k({open:!0,title:`批量忽略问题`,description:`确认忽略选中的 ${S.size} 个问题?`,count:S.size,onConfirm:()=>{re.mutate(Array.from(S)),k(e=>({...e,open:!1}))}}),loading:re.isPending,children:[`忽略 (`,S.size,`)`]}),le>0&&(0,R.jsx)(Y,{variant:`primary`,size:`sm`,icon:zs,onClick:()=>k({open:!0,title:`全部标记已修复`,description:`确认将 ${le} 个问题全部标记为已修复?`,onConfirm:()=>{ne.mutate(),k(e=>({...e,open:!1}))}}),loading:ne.isPending,children:`全部已修复`}),(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:nc,onClick:()=>F.length>0&&ge(),children:`导出`}),(0,R.jsxs)(`div`,{className:`flex border border-gray-200 rounded-lg overflow-hidden`,children:[(0,R.jsx)(`button`,{onClick:()=>T(`list`),className:q(`px-2.5 py-1.5 text-sm transition-colors flex items-center gap-1`,w===`list`?`bg-blue-50 text-blue-700`:`text-gray-600 hover:bg-gray-50`),title:`列表视图`,children:(0,R.jsx)(xc,{className:`h-4 w-4`})}),(0,R.jsx)(`button`,{onClick:()=>T(`group`),className:q(`px-2.5 py-1.5 text-sm transition-colors flex items-center gap-1`,w===`group`?`bg-blue-50 text-blue-700`:`text-gray-600 hover:bg-gray-50`),title:`按项目分组`,children:(0,R.jsx)(uc,{className:`h-4 w-4`})})]})]})]}),f&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-3 pt-2 border-t border-gray-100`,children:[(0,R.jsxs)(`select`,{value:i,onChange:e=>{a(e.target.value),h(1)},className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部级别`}),fe.map(e=>(0,R.jsx)(`option`,{value:e,children:b3[e]?.label||e},e))]}),(0,R.jsxs)(`select`,{value:o,onChange:e=>{s(e.target.value),h(1)},className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部类别`}),pe.map(e=>(0,R.jsx)(`option`,{value:e,children:y3[e]?.label||e},e))]}),(0,R.jsxs)(`select`,{value:c,onChange:e=>{l(e.target.value),h(1)},className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部状态`}),(0,R.jsx)(`option`,{value:`resolved`,children:`已解决`}),(0,R.jsx)(`option`,{value:`unresolved`,children:`未解决`})]}),(0,R.jsxs)(`select`,{value:u,onChange:e=>{d(e.target.value),h(1)},className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,R.jsx)(`option`,{value:``,children:`全部项目`}),me.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]})]})}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-red-600`,children:ue}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`失败`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-amber-600`,children:de}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`警告`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-orange-600`,children:le}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`未解决`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:ce}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总检查`})]})]}),(0,R.jsxs)(X,{title:`问题列表 (${F.length})`,action:F.length>0?(0,R.jsx)(`button`,{onClick:()=>{let e=w===`list`?se.filter(e=>!e.resolved).map(e=>String(e.id)):F.filter(e=>!e.resolved).map(e=>String(e.id));S.size===e.length&&e.length>0?C(new Set):C(new Set(e))},className:`text-xs text-blue-600 hover:underline`,children:S.size>0?`取消全选`:w===`list`?`全选当前页未解决`:`全选所有未解决`}):void 0,children:[w===`list`?(0,R.jsx)(`div`,{className:`space-y-2`,children:se.map((e,t)=>{let n=v===String(e.id||t);return(0,R.jsxs)(`div`,{className:`rounded-lg border border-gray-100 overflow-hidden`,children:[(0,R.jsxs)(sS.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.02},className:q(`flex items-center gap-3 p-4 cursor-pointer transition-all`,S.has(String(e.id))?`bg-blue-50`:`hover:bg-gray-50`),onClick:()=>y(n?null:String(e.id||t)),children:[e.resolved?(0,R.jsx)(`div`,{className:`h-4 w-4 flex-shrink-0`}):(0,R.jsx)(`input`,{type:`checkbox`,checked:S.has(String(e.id)),onChange:t=>{t.stopPropagation(),C(t=>{let n=new Set(t);return n.has(String(e.id))?n.delete(String(e.id)):n.add(String(e.id)),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 cursor-pointer flex-shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-5 gap-3 items-center min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,R.jsx)(x3,{level:e.level}),(0,R.jsx)(S3,{category:e.category})]}),(0,R.jsx)(`div`,{className:`md:col-span-2 min-w-0`,children:(0,R.jsx)(`p`,{className:`text-sm text-gray-700 truncate`,children:e.message})}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500 truncate`,children:e.project_path?.split(`/`).pop()||`-`}),(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,R.jsx)(fS,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),(0,R.jsx)(`span`,{className:`text-xs text-gray-400 flex-shrink-0`,children:e.created_at?x4(Df(e.created_at),`MM-dd HH:mm`):``}),n?(0,R.jsx)(Bs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}):(0,R.jsx)(Hs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`})]})]})]}),(0,R.jsx)(gb,{children:n&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,R.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 p-4 space-y-2 text-sm`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`完整消息:`}),(0,R.jsx)(`p`,{className:`text-gray-700 mt-1 break-words`,children:e.message})]}),e.project_path&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`项目路径:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1 font-mono text-xs break-all`,children:e.project_path})]}),(0,R.jsxs)(`div`,{className:`flex gap-6`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`创建时间:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1`,children:e.created_at?x4(Df(e.created_at),`yyyy-MM-dd HH:mm:ss`):`-`})]}),e.resolved_at&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`解决时间:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1`,children:x4(Df(e.resolved_at),`yyyy-MM-dd HH:mm:ss`)})]})]}),!e.resolved&&(0,R.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:b===String(e.id)?Rs:Qs,onClick:t=>{t.stopPropagation(),ae(String(e.id))},children:b===String(e.id)?`已复制`:`复制上下文`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:zs,onClick:t=>{t.stopPropagation(),te.mutate(String(e.id))},loading:te.isPending,children:`标记已修复`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:el,onClick:t=>{t.stopPropagation(),P.mutate(String(e.id))},loading:P.isPending,children:`忽略`})]})]})})})]},e.id||t)})}):(0,R.jsx)(`div`,{className:`space-y-3`,children:Object.entries(I).map(([e,t])=>{let n=E.has(e),r=t.filter(e=>!e.resolved).length;return(0,R.jsxs)(`div`,{className:`border border-gray-200 rounded-lg overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100 transition-colors`,onClick:()=>D(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?(0,R.jsx)(Bs,{className:`h-4 w-4 text-gray-500`}):(0,R.jsx)(Hs,{className:`h-4 w-4 text-gray-500`}),(0,R.jsx)(`span`,{className:`font-medium text-gray-900`,children:e}),(0,R.jsxs)(fS,{size:`sm`,children:[t.length,` 个问题`]}),r>0&&(0,R.jsxs)(fS,{size:`sm`,variant:`warning`,children:[r,` 未解决`]})]})}),(0,R.jsx)(gb,{children:n&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,R.jsx)(`div`,{className:`divide-y divide-gray-100`,children:t.map((e,t)=>{let n=v===String(e.id||t);return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(sS.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:t*.01},className:q(`flex items-center gap-3 p-3 cursor-pointer transition-all`,S.has(String(e.id))?`bg-blue-50`:`hover:bg-gray-50`),onClick:()=>y(n?null:String(e.id||t)),children:[e.resolved?(0,R.jsx)(`div`,{className:`h-4 w-4 flex-shrink-0`}):(0,R.jsx)(`input`,{type:`checkbox`,checked:S.has(String(e.id)),onChange:t=>{t.stopPropagation(),C(t=>{let n=new Set(t);return n.has(String(e.id))?n.delete(String(e.id)):n.add(String(e.id)),n})},onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded border-gray-300 text-blue-600 cursor-pointer flex-shrink-0`}),(0,R.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-4 gap-3 items-center min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,R.jsx)(x3,{level:e.level}),(0,R.jsx)(S3,{category:e.category})]}),(0,R.jsx)(`div`,{className:`md:col-span-2 min-w-0`,children:(0,R.jsx)(`p`,{className:`text-sm text-gray-700 truncate`,children:e.message})}),(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,R.jsx)(fS,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),(0,R.jsx)(`span`,{className:`text-xs text-gray-400 flex-shrink-0`,children:e.created_at?x4(Df(e.created_at),`MM-dd HH:mm`):``}),n?(0,R.jsx)(Bs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}):(0,R.jsx)(Hs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`})]})]})]}),(0,R.jsx)(gb,{children:n&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,R.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 p-4 space-y-2 text-sm`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`完整消息:`}),(0,R.jsx)(`p`,{className:`text-gray-700 mt-1 break-words`,children:e.message})]}),e.project_path&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`项目路径:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1 font-mono text-xs break-all`,children:e.project_path})]}),(0,R.jsxs)(`div`,{className:`flex gap-6`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`创建时间:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1`,children:e.created_at?x4(Df(e.created_at),`yyyy-MM-dd HH:mm:ss`):`-`})]}),e.resolved_at&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`解决时间:`}),(0,R.jsx)(`span`,{className:`text-gray-700 ml-1`,children:x4(Df(e.resolved_at),`yyyy-MM-dd HH:mm:ss`)})]})]}),!e.resolved&&(0,R.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:b===String(e.id)?Rs:Qs,onClick:t=>{t.stopPropagation(),ae(String(e.id))},children:b===String(e.id)?`已复制`:`复制上下文`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:zs,onClick:t=>{t.stopPropagation(),te.mutate(String(e.id))},loading:te.isPending,children:`标记已修复`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:el,onClick:t=>{t.stopPropagation(),P.mutate(String(e.id))},loading:P.isPending,children:`忽略`})]})]})})})]},e.id||t)})})})})]},e)})}),F.length===0&&(0,R.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,R.jsx)(Gs,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`没有符合条件的记录`]}),F.length>0&&w===`list`&&(0,R.jsx)(n3,{currentPage:m,totalPages:oe,onPageChange:h,pageSize:g,onPageSizeChange:e=>{_(e),h(1)},totalItems:F.length})]}),(0,R.jsx)(w4,{open:O.open,title:O.title,description:O.description,count:O.count,variant:`warning`,onConfirm:O.onConfirm,onCancel:()=>k({...O,open:!1})})]})}var w3=[{key:`distill`,title:`蒸馏配置`,description:`AI 知识蒸馏的触发条件和参数`,fields:[{key:`provider`,label:`提供商`,type:`select`,options:[{value:`claude`,label:`Claude`},{value:`openai`,label:`OpenAI`},{value:`ollama`,label:`Ollama`}]},{key:`auto_trigger`,label:`自动触发`,type:`boolean`,description:`达到事件阈值时自动蒸馏`},{key:`event_threshold`,label:`事件阈值`,type:`number`,description:`触发蒸馏的最小事件数`,min:1,max:1e4},{key:`timer_interval_minutes`,label:`定时器间隔(分钟)`,type:`number`,min:1,max:1440},{key:`model`,label:`模型`,type:`text`},{key:`api_key`,label:`API Key`,type:`text`,sensitive:!0,description:`留空自动从环境变量获取`},{key:`base_url`,label:`API 地址`,type:`text`,description:`留空使用默认地址`}]},{key:`autopilot`,title:`自动驾驶`,description:`意图分析、质量门禁、Pipeline 编排`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`intent_analysis`,label:`意图分析`,type:`boolean`,description:`AI 分析用户意图和任务复杂度`},{key:`quality_gate`,label:`质量门禁`,type:`boolean`,description:`代码变更时自动审查质量`},{key:`quality_review_interval`,label:`审查间隔`,type:`number`,description:`每 N 次 Write/Edit 触发一次审查`,min:1,max:100},{key:`auto_start_pipeline`,label:`自动启动流水线`,type:`boolean`},{key:`pipeline_confirm_mode`,label:`确认模式`,type:`select`,options:[{value:`prompt`,label:`提示确认`},{value:`auto`,label:`自动启动`},{value:`preview`,label:`仅预览`}]}]},{key:`resume`,title:`会话续接`,description:`中断会话的自动恢复`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`timeout_minutes`,label:`超时时间(分钟)`,type:`number`,min:1,max:1440},{key:`max_age_days`,label:`最大保留天数`,type:`number`,min:1,max:365}]},{key:`claudemd`,title:`CLAUDE.md 管理`,description:`项目级 CLAUDE.md 的自动生成与精炼`,fields:[{key:`auto_generate`,label:`自动生成`,type:`boolean`},{key:`auto_refine`,label:`自动精炼`,type:`boolean`},{key:`refine_interval`,label:`精炼间隔`,type:`number`,description:`每 N 次蒸馏后精炼一次`,min:1,max:100}]},{key:`orchestration`,title:`编排通知`,description:`蒸馏和 CLAUDE.md 更新的通知`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`notify_on_distill`,label:`蒸馏完成通知`,type:`boolean`},{key:`notify_on_claudemd`,label:`CLAUDE.md 更新通知`,type:`boolean`}]},{key:`web`,title:`Web 管理后台`,description:`Web 服务配置`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`port`,label:`端口`,type:`number`,min:1024,max:65535}]},{key:`ai`,title:`AI 模型`,description:`分层模型配置(Haiku/Sonnet/Opus)`,fields:[{key:`models.haiku`,label:`Haiku 模型`,type:`text`},{key:`models.sonnet`,label:`Sonnet 模型`,type:`text`},{key:`models.opus`,label:`Opus 模型`,type:`text`}]},{key:`storage`,title:`存储`,description:`数据库路径和容量限制`,fields:[{key:`path`,label:`数据库路径`,type:`text`},{key:`max_size_mb`,label:`最大容量(MB)`,type:`number`,min:100,max:102400}]},{key:`backup`,title:`备份配置`,description:`数据备份策略`,fields:[{key:`include_profile`,label:`包含用户画像`,type:`boolean`,description:`备份时包含用户画像数据`},{key:`encrypt_by_default`,label:`默认加密`,type:`boolean`,description:`备份文件默认加密`}]},{key:`pattern_engine`,title:`模式引擎`,description:`模式识别与演化配置`,fields:[{key:`enabled`,label:`启用`,type:`boolean`},{key:`route_timeout_ms`,label:`路由超时(毫秒)`,type:`number`,min:100,max:6e4},{key:`evolve_interval_days`,label:`演化间隔(天)`,type:`number`,min:1,max:365},{key:`evolve_min_executions`,label:`最小执行次数`,type:`number`,description:`触发演化的最小执行次数`,min:1,max:1e3}]},{key:`ui`,title:`UI 配置`,description:`前端界面参数`,fields:[{key:`skill_repair_limit`,label:`Skill 修复上限`,type:`number`,min:1,max:100},{key:`logs_tail_default`,label:`日志默认条数`,type:`number`,min:10,max:1e3},{key:`pipeline_expire_hours`,label:`Pipeline 过期时间(小时)`,type:`number`,min:1,max:720}]},{key:`history`,title:`配置历史`,description:`查看最近 10 次配置变更记录`,fields:[]}];function T3(){let e=Ye(),[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(`idle`),[a,o]=(0,L.useState)(`distill`),[s,c]=(0,L.useState)(new Set),l=s.size>0,[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(new Set),[m,h]=(0,L.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(``),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)({}),{data:E,isLoading:D}=ut({queryKey:[`config`],queryFn:()=>cl().then(e=>e.data)}),{data:O,refetch:k}=ut({queryKey:[`daemon-diagnosis`],queryFn:()=>uu().then(e=>e.data),enabled:a===`environment`}),{data:A,refetch:j}=ut({queryKey:[`backups`],queryFn:()=>pu().then(e=>e.data),enabled:a===`backup_mgmt`}),{data:M}=ut({queryKey:[`config-history`],queryFn:()=>ul().then(e=>e.data),enabled:a===`history`}),{data:N}=ut({queryKey:[`daemon-status`],queryFn:()=>cu().then(e=>e.data),enabled:a===`backup_mgmt`}),{data:ee,refetch:te}=ut({queryKey:[`memory-caches`],queryFn:()=>_u().then(e=>e.data),enabled:a===`memory_mgmt`,refetchInterval:a===`memory_mgmt`?5e3:!1}),{data:P,refetch:ne}=ut({queryKey:[`memory-process`],queryFn:()=>vu().then(e=>e.data),enabled:a===`memory_mgmt`,refetchInterval:a===`memory_mgmt`?5e3:!1}),re=z({mutationFn:e=>yu(e),onSuccess:(e,t)=>{H(`缓存 ${t} 已清空`,`success`),te()},onError:()=>H(`清空缓存失败`,`error`)}),ie=z({mutationFn:()=>bu(),onSuccess:()=>{H(`所有缓存已清空`,`success`),te()},onError:()=>H(`清空缓存失败`,`error`)}),ae=z({mutationFn:()=>xu(),onSuccess:e=>{let t=e.data.freed;H(t?`GC 完成,释放堆内存 ${t.heapMB} MB`:e.data.message,`success`),ne()},onError:()=>H(`GC 触发失败(需要 --expose-gc 启动)`,`error`)}),F=z({mutationFn:()=>fu(v?{encrypt:!0,password:b}:{}),onSuccess:e=>{j(),H(e.data.encrypted?`加密备份已创建`:`备份已创建`,`success`),x(``),i(`success`),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),I=z({mutationFn:({filename:e,password:t})=>hu(e,t),onSuccess:e=>{H(`${e.data.message}(已备份当前数据库为 ${e.data.preRestoreBackup})`,`success`),setTimeout(()=>window.location.reload(),2e3)},onError:()=>H(`恢复失败`,`error`)}),oe=z({mutationFn:()=>du(),onSuccess:e=>{d(e.data),k()}});(0,L.useEffect)(()=>{E&&!t&&n(E)},[E,t]);let se=z({mutationFn:e=>ll(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),i(`success`),c(new Set),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),ce=z({mutationFn:()=>U.post(`/config/reset`),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),n(null),i(`success`),setTimeout(()=>i(`idle`),3e3)}});if(D||!t)return(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let le=(e,n)=>{let r=t[e];if(!r)return``;let i=n.split(`.`),a=r;for(let e of i)a=a?.[e];return a??``},ue=(e,t,r)=>{c(t=>new Set(t).add(e)),n(n=>{if(!n)return n;let i={...n[e]||{}},a=t.split(`.`);if(a.length===1)i[t]=r;else{let e={...i[a[0]]||{}};e[a[1]]=r,i[a[0]]=e}return{...n,[e]:i}})},de=()=>{if(!t)return;let e={};s.forEach(n=>{e[n]=t[n]}),se.mutate(e)},fe=()=>{n(E),c(new Set)},pe=()=>{let e=JSON.stringify(t,null,2),n=new Blob([e],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`claude-forge-config-${new Date().toISOString().slice(0,10)}.json`,i.click(),URL.revokeObjectURL(r)},me=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`.json`,e.onchange=e=>{let t=e.target.files?.[0];if(!t)return;let r=new FileReader;r.onload=e=>{try{n(JSON.parse(e.target?.result)),c(new Set(w3.map(e=>e.key)))}catch{H(`配置文件格式错误,请选择有效的 JSON 文件`,`error`)}},r.readAsText(t)},e.click()},he=w3.find(e=>e.key===a);return(0,R.jsxs)(`div`,{className:`flex gap-6`,children:[(0,R.jsx)(`div`,{className:`w-56 flex-shrink-0`,children:(0,R.jsx)(X,{className:`!p-2 sticky top-6`,children:(0,R.jsxs)(`nav`,{className:`space-y-1`,children:[w3.map(e=>(0,R.jsx)(`button`,{onClick:()=>o(e.key),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors`,a===e.key?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:e.title},e.key)),(0,R.jsx)(`div`,{className:`border-t border-gray-100 my-1`}),(0,R.jsxs)(`button`,{onClick:()=>o(`backup_mgmt`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`backup_mgmt`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,R.jsx)(ec,{className:`h-3.5 w-3.5`}),`数据备份`]}),(0,R.jsxs)(`button`,{onClick:()=>o(`memory_mgmt`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`memory_mgmt`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,R.jsx)($s,{className:`h-3.5 w-3.5`}),`内存管理`]}),(0,R.jsxs)(`button`,{onClick:()=>o(`environment`),className:q(`w-full text-left px-3 py-2.5 rounded-lg text-sm transition-colors flex items-center gap-2`,a===`environment`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50 hover:text-gray-900`),children:[(0,R.jsx)(zc,{className:`h-3.5 w-3.5`}),`环境检测`]})]})})}),(0,R.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900`,children:a===`environment`?`环境检测`:a===`backup_mgmt`?`数据备份`:a===`memory_mgmt`?`内存管理`:a===`history`?`配置历史`:he?.title}),(0,R.jsx)(`p`,{className:`text-sm text-gray-500`,children:a===`environment`?`Hook 脚本与 Claude settings.json 注入状态检测与修复`:a===`backup_mgmt`?`数据库备份与历史备份管理`:a===`memory_mgmt`?`LRU 缓存状态与进程内存管理`:a===`history`?`查看最近 10 次配置变更记录`:he?.description??``})]}),a!==`environment`&&a!==`backup_mgmt`&&a!==`memory_mgmt`&&a!==`history`&&(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(gb,{children:[r===`success`&&(0,R.jsxs)(sS.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0},className:`flex items-center gap-1.5 text-green-600 text-sm`,children:[(0,R.jsx)(Gs,{className:`h-4 w-4`}),`已保存`]}),r===`error`&&(0,R.jsxs)(sS.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0},className:`flex items-center gap-1.5 text-red-600 text-sm`,children:[(0,R.jsx)(qs,{className:`h-4 w-4`}),`保存失败`]})]}),l&&(0,R.jsx)(fS,{variant:`warning`,children:`未保存`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:nc,onClick:pe,children:`导出`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Zc,onClick:me,children:`导入`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Fc,onClick:fe,disabled:!l,children:`撤销`}),(0,R.jsx)(Y,{variant:`primary`,size:`sm`,icon:Ic,onClick:de,loading:se.isPending,disabled:!l,children:`保存`})]})]}),a!==`environment`&&a!==`backup_mgmt`&&a!==`memory_mgmt`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(X,{children:(0,R.jsx)(`div`,{className:`space-y-6`,children:he?.fields.map(e=>(0,R.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,R.jsxs)(`div`,{className:`w-48 flex-shrink-0 pt-2`,children:[(0,R.jsx)(`label`,{className:`text-sm font-medium text-gray-700`,children:e.label}),e.description&&(0,R.jsx)(`p`,{className:`text-xs text-gray-400 mt-0.5`,children:e.description})]}),(0,R.jsx)(`div`,{className:`flex-1`,children:e.type===`boolean`?(0,R.jsx)(`button`,{onClick:()=>ue(a,e.key,!le(a,e.key)),className:q(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors`,le(a,e.key)?`bg-blue-600`:`bg-gray-300`),children:(0,R.jsx)(`span`,{className:q(`inline-block h-4 w-4 transform rounded-full bg-white transition-transform`,le(a,e.key)?`translate-x-6`:`translate-x-1`)})}):e.type===`select`?(0,R.jsx)(`select`,{value:String(le(a,e.key)||``),onChange:t=>ue(a,e.key,t.target.value),className:`w-full max-w-xs px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`,children:e.options?.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))}):e.type===`number`?(0,R.jsx)(`input`,{type:`number`,value:Number(le(a,e.key))||0,onChange:t=>ue(a,e.key,Number(t.target.value)),min:e.min,max:e.max,className:`w-full max-w-xs px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`}):(0,R.jsxs)(`div`,{className:`relative flex items-center max-w-xs`,children:[(0,R.jsx)(`input`,{type:e.sensitive&&!f.has(`${a}.${e.key}`)?`password`:`text`,value:String(le(a,e.key)||``),onChange:t=>ue(a,e.key,t.target.value),className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm pr-9`}),e.sensitive&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(t=>{let n=new Set(t),r=`${a}.${e.key}`;return n.has(r)?n.delete(r):n.add(r),n}),className:`absolute right-2 text-gray-400 hover:text-gray-600`,children:f.has(`${a}.${e.key}`)?(0,R.jsx)(ic,{className:`h-4 w-4`}):(0,R.jsx)(ac,{className:`h-4 w-4`})})]})})]},e.key))})}),(0,R.jsx)(X,{className:`!border-red-200`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold text-red-600`,children:`重置配置`}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 mt-1`,children:`将所有配置恢复为默认值,此操作不可撤销`})]}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,icon:Xc,onClick:()=>{h({open:!0,title:`重置配置`,description:`确定要重置所有配置为默认值吗?此操作不可撤销。`,onConfirm:()=>{ce.mutate(),h({...m,open:!1})}})},loading:ce.isPending,children:`重置`})]})})]}),a===`backup_mgmt`&&(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full bg-blue-50 flex items-center justify-center`,children:(0,R.jsx)(hc,{className:`h-5 w-5 text-blue-600`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`当前数据库`}),(0,R.jsxs)(`p`,{className:`text-sm text-gray-500 mt-1`,children:[`内存占用:`,N?.memory?`${(N.memory.heapUsed/1024/1024).toFixed(2)} MB`:`加载中...`]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm text-gray-600 cursor-pointer`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:v,onChange:e=>y(e.target.checked),className:`rounded`}),(0,R.jsx)(Cc,{className:`h-3.5 w-3.5`}),`加密备份`]})}),v&&(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`input`,{type:S?`text`:`password`,placeholder:`备份密码(≥8位)`,value:b,onChange:e=>x(e.target.value),className:`px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 pr-8 w-48`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-gray-400`,children:S?(0,R.jsx)(ic,{className:`h-3.5 w-3.5`}):(0,R.jsx)(ac,{className:`h-3.5 w-3.5`})})]}),(0,R.jsx)(Y,{variant:`primary`,size:`sm`,icon:ec,onClick:()=>F.mutate(),loading:F.isPending,disabled:v&&b.length<8,children:`立即备份`})]})]})}),(0,R.jsxs)(X,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`备份历史`}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Pc,onClick:()=>j(),children:`刷新`})]}),A&&A.items.length>0?(0,R.jsx)(`div`,{className:`space-y-2`,children:A.items.map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900 truncate`,children:e.filename}),e.encrypted&&(0,R.jsxs)(`span`,{className:`flex items-center gap-0.5 text-xs text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded`,children:[(0,R.jsx)(Cc,{className:`h-3 w-3`}),` 已加密`]})]}),(0,R.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[x4(new Date(e.createdAt),`yyyy-MM-dd HH:mm:ss`),` · `,e.sizeMb,` MB`]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 ml-3 flex-shrink-0`,children:[(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`恢复数据库`,description:`确定要从 ${e.filename} 恢复数据库吗?当前数据库将被覆盖(会自动备份)。恢复后 daemon 将自动重启。`,onConfirm:()=>{I.mutate({filename:e.filename,password:w[e.filename]}),h(e=>({...e,open:!1}))}})},loading:I.isPending&&I.variables?.filename===e.filename,children:`恢复`}),(0,R.jsx)(`a`,{href:mu(e.filename),download:e.filename,children:(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:nc,children:`下载`})})]})]}),e.encrypted&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Cc,{className:`h-3.5 w-3.5 text-amber-500 flex-shrink-0`}),(0,R.jsx)(`input`,{type:`password`,placeholder:`输入解密密码后点击恢复`,value:w[e.filename]||``,onChange:t=>T(n=>({...n,[e.filename]:t.target.value})),className:`flex-1 px-2 py-1 text-xs border border-amber-200 rounded focus:outline-none focus:ring-1 focus:ring-amber-400`})]})]},e.filename))}):(0,R.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无备份记录`})]}),(0,R.jsxs)(X,{children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`数据管理`})}),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`清理历史事件`}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`删除超过指定天数的事件记录`})]}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`清理历史事件`,description:`确定要清理 30 天前的事件记录吗?此操作不可撤销。`,onConfirm:()=>{U.post(`/events/purge`,{retentionDays:30}).then(()=>{H(`事件清理完成`,`success`),h(e=>({...e,open:!1}))}).catch(()=>{H(`事件清理失败`,`error`),h(e=>({...e,open:!1}))})}})},children:`清理 30 天前`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:`数据库优化`}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:`执行 VACUUM 回收空间,提升性能`})]}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`数据库优化`,description:`确定要执行 VACUUM 优化吗?此操作可能需要几分钟。`,onConfirm:()=>{U.post(`/config/vacuum`).then(()=>{H(`数据库优化完成`,`success`),h(e=>({...e,open:!1}))}).catch(()=>{H(`数据库优化失败`,`error`),h(e=>({...e,open:!1}))})}})},children:`立即优化`})]})]})]})]}),a===`memory_mgmt`&&(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between mb-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full bg-purple-50 flex items-center justify-center`,children:(0,R.jsx)($s,{className:`h-5 w-5 text-purple-600`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`进程内存`}),P&&(0,R.jsxs)(`div`,{className:`text-sm text-gray-600 mt-2 space-y-1`,children:[(0,R.jsxs)(`div`,{children:[`RSS: `,P.rssMB,` MB`]}),(0,R.jsxs)(`div`,{children:[`堆已用: `,P.heapUsedMB,` MB / `,P.heapTotalMB,` MB`]}),(0,R.jsxs)(`div`,{children:[`外部: `,P.externalMB,` MB`]})]})]})]}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>ae.mutate(),loading:ae.isPending,children:`触发 GC`})]})}),(0,R.jsxs)(X,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`LRU 缓存`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:Pc,onClick:()=>void te(),children:`刷新`}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`清空所有缓存`,description:`确定要清空所有 LRU 缓存吗?`,onConfirm:()=>{ie.mutate(),h(e=>({...e,open:!1}))}})},loading:ie.isPending,children:`清空全部`})]})]}),ee&&ee.caches.length>0?(0,R.jsx)(`div`,{className:`space-y-2`,children:ee.caches.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.name}),(0,R.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[e.size,` / `,e.maxSize,` 条`,e.hitRate!==void 0&&` · 命中率 ${(e.hitRate*100).toFixed(1)}%`]})]}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>re.mutate(e.name),loading:re.isPending&&re.variables===e.name,children:`清空`})]},e.name))}):(0,R.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无缓存数据`})]})]}),a===`history`&&(0,R.jsxs)(X,{children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,R.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`最近 10 次配置变更`})}),M&&M.items.length>0?(0,R.jsx)(`div`,{className:`space-y-2`,children:M.items.map(e=>{let t=g===String(e.id),n=E,r=[];if(t&&n){let t=(e,n=``)=>typeof e!=`object`||!e?{[n]:JSON.stringify(e)}:Object.entries(e).reduce((e,[r,i])=>{let a=n?`${n}.${r}`:r;return typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(e,t(i,a)):e[a]=JSON.stringify(i),e},{}),i=t(e.config),a=t(n);new Set([...Object.keys(i),...Object.keys(a)]).forEach(e=>{let t=i[e]??`(无)`,n=a[e]??`(无)`;t!==n&&r.push({key:e,old:t,cur:n})})}return(0,R.jsxs)(`div`,{className:`py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`span`,{className:`text-sm font-medium text-gray-900`,children:[`#`,e.id]}),(0,R.jsx)(`span`,{className:`text-xs text-gray-500`,children:x4(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>_(t?null:String(e.id)),children:t?`收起对比`:`与当前对比`}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`确认恢复配置`,description:`确定要恢复到 ${x4(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)} 的配置吗?当前配置将被覆盖。`,onConfirm:()=>{se.mutate(e.config),h(e=>({...e,open:!1}))}})},children:`恢复到此版本`})]})]}),(0,R.jsx)(gb,{children:t&&(0,R.jsx)(sS.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,R.jsxs)(`div`,{className:`mt-3 rounded border border-gray-200 overflow-hidden text-xs font-mono`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-3 bg-gray-100 px-3 py-1.5 text-gray-500 font-medium text-xs`,children:[(0,R.jsx)(`span`,{children:`配置项`}),(0,R.jsx)(`span`,{className:`text-red-600`,children:`历史值`}),(0,R.jsx)(`span`,{className:`text-green-600`,children:`当前值`})]}),r.length===0?(0,R.jsx)(`div`,{className:`px-3 py-3 text-gray-400 text-center`,children:`与当前配置完全一致`}):(0,R.jsx)(`div`,{className:`divide-y divide-gray-100 max-h-64 overflow-auto`,children:r.map(({key:e,old:t,cur:n})=>(0,R.jsxs)(`div`,{className:`grid grid-cols-3 px-3 py-1.5 hover:bg-gray-50`,children:[(0,R.jsx)(`span`,{className:`text-gray-600 truncate pr-2`,children:e}),(0,R.jsx)(`span`,{className:`text-red-600 truncate pr-2 bg-red-50 rounded px-1`,children:t}),(0,R.jsx)(`span`,{className:`text-green-600 truncate bg-green-50 rounded px-1`,children:n})]},e))})]})})}),!t&&(0,R.jsx)(`div`,{className:`mt-2 text-xs text-gray-500 font-mono bg-white rounded border border-gray-100 p-2 max-h-32 overflow-auto`,children:(0,R.jsx)(`pre`,{className:`whitespace-pre-wrap break-all`,children:JSON.stringify(e.config,null,2)})})]},e.id)})}):(0,R.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无配置变更记录`})]}),a===`environment`&&(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-medium text-gray-900 mb-1`,children:`Hook 环境诊断`}),(0,R.jsx)(`p`,{className:`text-sm text-gray-500`,children:`检测 Forge hooks 脚本与 Claude settings.json 中 Forge 注入是否完整`})]}),(0,R.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,icon:Pc,onClick:()=>k(),children:`重新检测`}),(0,R.jsx)(Y,{size:`sm`,icon:$c,onClick:()=>oe.mutate(),disabled:oe.isPending||O?.hooksHealthy,children:oe.isPending?`修复中...`:`一键修复`})]})]})}),u&&(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[u.hooksHealthy?(0,R.jsx)(Gs,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,R.jsx)(Xc,{className:`h-4 w-4 text-yellow-500 mt-0.5 flex-shrink-0`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:q(`text-sm font-medium`,u.hooksHealthy?`text-gray-900`:`text-yellow-600`),children:u.hooksHealthy?`Hooks 环境已恢复正常`:`修复后仍有未通过项,请根据下方列表排查`}),u.backupPath&&(0,R.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[`已备份 settings: `,u.backupPath.split(`/`).pop()]})]})]}),(0,R.jsx)(Y,{variant:`ghost`,size:`sm`,icon:qs,onClick:()=>d(null)})]})}),O&&(0,R.jsx)(X,{children:(0,R.jsx)(`div`,{className:`space-y-2`,children:O.items.map(e=>(0,R.jsxs)(`div`,{className:`flex items-start gap-3 py-2 border-b border-gray-50 last:border-0`,children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,children:e.ok?(0,R.jsx)(Gs,{className:`h-4 w-4 text-green-500`}):e.id===`daemon_process`?(0,R.jsx)(Xc,{className:`h-4 w-4 text-yellow-500`}):(0,R.jsx)(qs,{className:`h-4 w-4 text-red-500`})}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.label}),(0,R.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5 break-all`,children:e.detail})]})]},e.id))})}),O&&(0,R.jsx)(X,{className:O.hooksHealthy?`!border-green-200 !bg-green-50`:`!border-yellow-200 !bg-yellow-50`,children:(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:O.hooksHealthy?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Gs,{className:`h-5 w-5 text-green-600`}),(0,R.jsx)(`p`,{className:`text-sm font-medium text-green-700`,children:`Hooks 相关环境正常`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Xc,{className:`h-5 w-5 text-yellow-600`}),(0,R.jsx)(`p`,{className:`text-sm font-medium text-yellow-700`,children:`检测到 Hooks 环境不完整,请点击「一键修复」`})]})})})]})]}),(0,R.jsx)(w4,{open:m.open,title:m.title,description:m.description,variant:`danger`,onConfirm:m.onConfirm,onCancel:()=>h({...m,open:!1})})]})}function E3({children:e,fallback:t,rootMargin:n=`200px`}){let[r,i]=(0,L.useState)(!1),a=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let e=new IntersectionObserver(([t])=>{t.isIntersecting&&(i(!0),e.disconnect())},{rootMargin:n,threshold:.01});return a.current&&e.observe(a.current),()=>e.disconnect()},[n]),(0,R.jsx)(`div`,{ref:a,style:{minHeight:r?`auto`:`400px`},children:r?e:t||(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96 text-gray-400`,children:`加载中...`})})}var D3=[`#667eea`,`#10b981`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#06b6d4`],O3={"7d":7,"30d":30,"90d":90,custom:0};function k3(){let[e,t]=(0,L.useState)(`30d`),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(`sessions`),c=O3[e],l=e===`custom`?n?`${n}T00:00:00`:void 0:x4(C4(new Date,c),`yyyy-MM-dd'T'HH:mm:ss`),u=e===`custom`&&i?`${i}T23:59:59`:void 0,{data:d,isLoading:f,isError:p,refetch:m}=ut({queryKey:[`sessions`,{limit:100,startTime:l,endTime:u}],queryFn:()=>dl({limit:100,start_time:l,end_time:u}).then(e=>e.data)}),{data:h,isLoading:g,isError:_,refetch:v}=ut({queryKey:[`events`,{limit:100,startTime:l,endTime:u}],queryFn:()=>hl({limit:100,start_time:l,end_time:u}).then(e=>e.data)}),{data:y,isLoading:b}=ut({queryKey:[`event-stats`],queryFn:()=>gl().then(e=>e.data)}),{data:x}=ut({queryKey:[`api-usage-stats`,e],queryFn:()=>Su(e===`custom`?90:c).then(e=>e.data),staleTime:6e4}),{data:S}=ut({queryKey:[`pipelines-analytics`,{limit:100}],queryFn:()=>_l({limit:100}).then(e=>e.data),enabled:o===`pipelines`}),{data:C}=ut({queryKey:[`quality-history-analytics`,{limit:100}],queryFn:()=>yl({limit:100}).then(e=>e.data),enabled:o===`pipelines`}),w=f||g||b,T=p||_,E=()=>{K4(`analytics-sessions-${x4(new Date,`yyyyMMdd`)}.csv`,[`日期`,`会话数`],D.map(e=>[e.date,e.count])),K4(`analytics-tools-${x4(new Date,`yyyyMMdd`)}.csv`,[`工具`,`使用次数`],j.map(e=>[e.name,e.value])),K4(`analytics-projects-${x4(new Date,`yyyyMMdd`)}.csv`,[`项目`,`事件数`],k.map(e=>[e.name,e.value])),K4(`analytics-durations-${x4(new Date,`yyyyMMdd`)}.csv`,[`时长区间`,`会话数`],N.map(e=>[e.range,e.count]))},D=(0,L.useMemo)(()=>{if(!d?.items)return[];if(e===`custom`){if(!n||!i)return[];let e=new Date(n),t=new Date(i),r=Math.ceil((t.getTime()-e.getTime())/(1e3*60*60*24))+1;return Array.from({length:r},(t,n)=>{let r=x4(new Date(e.getTime()+n*24*60*60*1e3),`MM-dd`);return{date:r,count:d.items.filter(e=>x4(Df(e.start_time),`MM-dd`)===r).length}})}return Array.from({length:c},(e,t)=>{let n=x4(C4(new Date,c-1-t),`MM-dd`);return{date:n,count:d.items.filter(e=>x4(Df(e.start_time),`MM-dd`)===n).length}})},[d?.items,c,e,n,i]),O=(0,L.useMemo)(()=>h?.items?Array.from({length:24},(e,t)=>{let n=h.items.filter(e=>Df(e.timestamp).getHours()===t).length;return{hour:`${t}:00`,count:n}}):[],[h?.items]),k=(0,L.useMemo)(()=>{if(!h?.items)return[];let e=h.items.reduce((e,t)=>{let n=t.project_path.split(`/`).pop()||`Unknown`;return e[n]=(e[n]||0)+1,e},{});return Object.entries(e).sort((e,t)=>t[1]-e[1]).slice(0,10).map(([e,t])=>({name:e,value:t}))},[h?.items]),A={Bash:`Bash 命令`,Read:`读取文件`,Edit:`编辑文件`,Write:`写入文件`,Grep:`搜索内容`,Glob:`查找文件`,Agent:`子代理`,WebFetch:`网页获取`,WebSearch:`网页搜索`,TodoWrite:`任务管理`,NotebookEdit:`笔记编辑`,stop:`停止`,notification:`通知`,UserPrompt:`用户输入`,TaskCreate:`创建任务`,TaskUpdate:`更新任务`,TaskList:`任务列表`,TaskGet:`获取任务`,TaskStop:`停止任务`,TaskOutput:`任务输出`},j=(0,L.useMemo)(()=>{if(!h?.items)return[];let e=h.items.reduce((e,t)=>{let n=t.tool_name||`N/A`;return e[n]=(e[n]||0)+1,e},{});return Object.entries(e).sort((e,t)=>t[1]-e[1]).slice(0,15).map(([e,t])=>({name:A[e]||e,value:t}))},[h?.items]),{sessionDurations:M,durationBuckets:N}=(0,L.useMemo)(()=>{if(!d?.items)return{sessionDurations:[],durationBuckets:[]};let e=d.items.filter(e=>e.end_time).map(e=>{let t=(Df(e.end_time).getTime()-Df(e.start_time).getTime())/1e3/60;return Math.round(t)});return{sessionDurations:e,durationBuckets:[{range:`0-5分钟`,count:e.filter(e=>e<=5).length},{range:`5-15分钟`,count:e.filter(e=>e>5&&e<=15).length},{range:`15-30分钟`,count:e.filter(e=>e>15&&e<=30).length},{range:`30-60分钟`,count:e.filter(e=>e>30&&e<=60).length},{range:`60+分钟`,count:e.filter(e=>e>60).length}]}},[d?.items]),{avgSessionEvents:ee,avgSessionDuration:te}=(0,L.useMemo)(()=>{let e=M.filter(e=>e>0&&e<=480),t=e.length>0?e.reduce((e,t)=>e+t,0)/e.length:0,n=d?.items.filter(e=>e.event_count>0&&e.event_count<=500)??[];return{avgSessionEvents:n.length>0?n.reduce((e,t)=>e+t.event_count,0)/n.length:0,avgSessionDuration:t}},[d?.items,M]),P=(0,L.useMemo)(()=>{if(!S?.items)return null;let e=S.items,t=e.filter(e=>e.status===`completed`).length;return{completed:t,failed:e.filter(e=>e.status===`failed`).length,completionRate:e.length>0?(t/e.length*100).toFixed(1):`0`,complexityDist:e.reduce((e,t)=>(e[t.complexity]=(e[t.complexity]||0)+1,e),{}),avgNodes:e.length>0?(e.reduce((e,t)=>e+(t.stats?.totalNodes||0),0)/e.length).toFixed(1):`0`,total:e.length}},[S?.items]),ne=(0,L.useMemo)(()=>C?.items?Array.from({length:c},(e,t)=>{let n=x4(C4(new Date,c-1-t),`MM-dd`),r=C.items.filter(e=>x4(Df(e.created_at),`MM-dd`)===n);return{date:n,total:r.length,unresolved:r.filter(e=>!e.resolved).length}}):[],[C?.items,c]);return w?(0,R.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,R.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})}):T?(0,R.jsx)(q4,{message:`分析数据加载失败`,onRetry:()=>{m(),v()}}):(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsx)(X,{children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Is,{className:`h-4 w-4 text-gray-400`}),(0,R.jsx)(`span`,{className:`text-sm text-gray-600`,children:`时间范围:`}),(0,R.jsx)(`div`,{className:`flex gap-1 border border-gray-200 rounded-lg overflow-hidden`,children:[`7d`,`30d`,`90d`,`custom`].map(n=>(0,R.jsx)(`button`,{onClick:()=>t(n),className:q(`px-3 py-1.5 text-sm transition-colors`,e===n?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:n===`7d`?`7 天`:n===`30d`?`30 天`:n===`90d`?`90 天`:`自定义`},n))})]}),(0,R.jsx)(Y,{variant:`outline`,size:`sm`,icon:nc,onClick:E,children:`导出数据`})]}),e===`custom`&&(0,R.jsxs)(`div`,{className:`flex items-center gap-3 pl-6`,children:[(0,R.jsx)(`label`,{className:`text-sm text-gray-600`,children:`开始日期:`}),(0,R.jsx)(`input`,{type:`date`,value:n,onChange:e=>r(e.target.value),className:`px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`}),(0,R.jsx)(`label`,{className:`text-sm text-gray-600`,children:`结束日期:`}),(0,R.jsx)(`input`,{type:`date`,value:i,onChange:e=>a(e.target.value),className:`px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`})]})]})}),(0,R.jsxs)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[(0,R.jsxs)(`button`,{onClick:()=>s(`sessions`),className:q(`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors`,o===`sessions`?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:[(0,R.jsx)(Ds,{className:`h-4 w-4`}),`会话分析`]}),(0,R.jsxs)(`button`,{onClick:()=>s(`pipelines`),className:q(`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors`,o===`pipelines`?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`),children:[(0,R.jsx)(pc,{className:`h-4 w-4`}),`Pipeline 分析`]})]}),o===`sessions`&&(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Ds,{className:`h-7 w-7 text-indigo-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:ee.toFixed(1)}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话事件数`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Ys,{className:`h-7 w-7 text-green-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:te.toFixed(1)}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话时长(分钟)`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(tl,{className:`h-7 w-7 text-amber-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:h?.total||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总事件数`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsx)(Yc,{className:`h-7 w-7 text-purple-500 mx-auto mb-2`}),(0,R.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:d?.total||0}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总会话数`})]})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,R.jsx)(X,{title:`最近 ${c} 天会话趋势`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(m2,{data:D,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`count`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3})]})})})}),(0,R.jsx)(X,{title:`24 小时事件分布`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(W0,{data:O,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`hour`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(UZ,{type:`monotone`,dataKey:`count`,stroke:`#10b981`,strokeWidth:2})]})})})}),(0,R.jsx)(X,{title:`项目活跃度 Top 10`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:k,layout:`vertical`,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{type:`number`}),(0,R.jsx)(u1,{dataKey:`name`,type:`category`,width:100}),(0,R.jsx)(VW,{}),(0,R.jsx)(O$,{dataKey:`value`,fill:`#667eea`})]})})})}),(0,R.jsx)(X,{title:`工具使用排行 Top 15`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:j,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`name`,angle:-45,textAnchor:`end`,height:80}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(O$,{dataKey:`value`,fill:`#10b981`})]})})})}),(0,R.jsx)(X,{title:`会话时长分布`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(f2,{children:[(0,R.jsx)(zJ,{data:N,cx:`50%`,cy:`50%`,labelLine:!1,label:({range:e,count:t})=>`${e}: ${t}`,outerRadius:80,fill:`#8884d8`,dataKey:`count`,children:N.map((e,t)=>(0,R.jsx)(HW,{fill:D3[t%D3.length]},`cell-${t}`))}),(0,R.jsx)(VW,{})]})})})}),(0,R.jsx)(X,{title:`事件类型趋势`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(m2,{data:y?.stats.slice(0,30)||[],children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(GA,{}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`count`,stackId:`1`,stroke:`#667eea`,fill:`#667eea`})]})})})})]}),x&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,R.jsx)(tc,{className:`h-5 w-5 text-gray-500`}),(0,R.jsx)(`h2`,{className:`text-base font-semibold text-gray-800`,children:`Token 与费用统计`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[`$`,x.summary.totalCost.toFixed(4)]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总费用(USD)`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(x.summary.totalTokens/1e3).toFixed(1),`K`]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总 Token 数`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(x.summary.totalTokensIn/1e3).toFixed(1),`K`]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`输入 Token`})]}),(0,R.jsxs)(X,{className:`text-center !p-4`,children:[(0,R.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(x.summary.totalTokensOut/1e3).toFixed(1),`K`]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-500`,children:`输出 Token`})]})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,R.jsx)(X,{title:`每日 Token 趋势`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(m2,{data:x.dailyTrend,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{formatter:e=>`${(e/1e3).toFixed(1)}K`}),(0,R.jsx)(GA,{}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`tokens_in`,name:`输入`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3,stackId:`1`}),(0,R.jsx)(OQ,{type:`monotone`,dataKey:`tokens_out`,name:`输出`,stroke:`#10b981`,fill:`#10b981`,fillOpacity:.3,stackId:`1`})]})})})}),(0,R.jsx)(X,{title:`每日费用趋势(USD)`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:x.dailyTrend,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{tickFormatter:e=>`$${e.toFixed(3)}`}),(0,R.jsx)(VW,{formatter:e=>`$${e.toFixed(4)}`}),(0,R.jsx)(O$,{dataKey:`cost_usd`,name:`费用`,fill:`#f59e0b`})]})})})}),x.byModel.length>0&&(0,R.jsx)(X,{title:`按模型费用分布`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(f2,{children:[(0,R.jsx)(zJ,{data:x.byModel,dataKey:`cost`,nameKey:`model`,cx:`50%`,cy:`50%`,outerRadius:80,label:({model:e,cost:t})=>`${e}: $${t.toFixed(4)}`,children:x.byModel.map((e,t)=>(0,R.jsx)(HW,{fill:D3[t%D3.length]},t))}),(0,R.jsx)(VW,{formatter:e=>`$${e.toFixed(4)}`})]})})})})]})]})]}),o===`pipelines`&&P&&(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:P.total}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总 Pipeline`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsxs)(`div`,{className:`text-3xl font-bold text-green-600`,children:[P.completionRate,`%`]}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`完成率`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-purple-600`,children:P.avgNodes}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`平均节点数`})]}),(0,R.jsxs)(X,{className:`text-center`,children:[(0,R.jsx)(`div`,{className:`text-3xl font-bold text-red-600`,children:P.failed}),(0,R.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`失败数`})]})]}),(0,R.jsx)(X,{title:`复杂度分布`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(K0,{data:Object.entries(P.complexityDist).map(([e,t])=>({name:e===`simple`?`简单`:e===`moderate`?`中等`:`复杂`,value:t})),children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`name`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(O$,{dataKey:`value`,name:`数量`,fill:`#667eea`})]})})})}),ne.length>0&&(0,R.jsx)(X,{title:`质量问题趋势`,children:(0,R.jsx)(E3,{children:(0,R.jsx)(Dk,{width:`100%`,height:250,children:(0,R.jsxs)(W0,{data:ne,children:[(0,R.jsx)(XX,{strokeDasharray:`3 3`}),(0,R.jsx)(Y$,{dataKey:`date`}),(0,R.jsx)(u1,{}),(0,R.jsx)(VW,{}),(0,R.jsx)(GA,{}),(0,R.jsx)(UZ,{type:`monotone`,dataKey:`total`,name:`总问题`,stroke:`#667eea`,strokeWidth:2}),(0,R.jsx)(UZ,{type:`monotone`,dataKey:`unresolved`,name:`未解决`,stroke:`#ef4444`,strokeWidth:2})]})})})})]})]})}function A3(e,t){let[n,r]=(0,L.useState)(e);return(0,L.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function j3({open:e,count:t,itemLabel:n=`项`,loading:r=!1,onConfirm:i,onCancel:a}){let[o,s]=(0,L.useState)(``);if((0,L.useEffect)(()=>{e||s(``)},[e]),(0,L.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,a]),!e)return null;let c=t<5?`simple`:t<=20?`count`:`keyword`,l=`DELETE`,u=c===`simple`||c===`count`&&o===String(t)||c===`keyword`&&o===l;return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm`,onClick:a,children:(0,R.jsxs)(`div`,{className:`bg-white rounded-xl shadow-xl w-full max-w-md mx-4 p-6`,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,R.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center bg-red-50`,children:(0,R.jsx)(Jc,{className:`h-5 w-5 text-red-500`})}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`h3`,{className:`text-base font-semibold text-gray-900`,children:[`删除 `,t,` 个`,n]}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-gray-500 leading-relaxed`,children:`此操作不可撤销,关联数据也会被删除。`}),c===`count`&&(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`label`,{className:`block text-xs text-gray-500 mb-1`,children:[`请输入数量 `,(0,R.jsx)(`span`,{className:`font-mono font-bold text-gray-800`,children:t}),` 以确认:`]}),(0,R.jsx)(`input`,{autoFocus:!0,type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u&&i()},placeholder:String(t),className:`w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-400 font-mono`})]}),c===`keyword`&&(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`label`,{className:`block text-xs text-gray-500 mb-1`,children:[`请输入 `,(0,R.jsx)(`span`,{className:`font-mono font-bold text-red-600`,children:l}),` 以确认:`]}),(0,R.jsx)(`input`,{autoFocus:!0,type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u&&i()},placeholder:l,className:`w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-400 font-mono`})]})]})]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-3 mt-6`,children:[(0,R.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:a,disabled:r,children:`取消`}),(0,R.jsx)(Y,{variant:`danger`,size:`sm`,onClick:i,loading:r,disabled:!u,children:`确认删除`})]})]})})}function M3(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=M3(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var N3={value:()=>{}};function P3(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new F3(n)}function F3(e){this._=e}function I3(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}F3.prototype=P3.prototype={constructor:F3,on:function(e,t){var n=this._,r=I3(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=L3(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=R3(n[i],e.name,t);else if(t==null)for(i in n)n[i]=R3(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new F3(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function L3(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function R3(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=N3,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var z3={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function B3(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),z3.hasOwnProperty(t)?{space:z3[t],local:e}:e}function V3(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function H3(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function U3(e){var t=B3(e);return(t.local?H3:V3)(t)}function W3(){}function G3(e){return e==null?W3:function(){return this.querySelector(e)}}function K3(e){typeof e!=`function`&&(e=G3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new l6(r,this._parents)}function q3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function J3(){return[]}function Y3(e){return e==null?J3:function(){return this.querySelectorAll(e)}}function Cae(e){return function(){return q3(e.apply(this,arguments))}}function wae(e){e=typeof e==`function`?Cae(e):Y3(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new l6(r,i)}function X3(e){return function(){return this.matches(e)}}function Z3(e){return function(t){return t.matches(e)}}var Tae=Array.prototype.find;function Eae(e){return function(){return Tae.call(this.children,e)}}function Dae(){return this.firstElementChild}function Oae(e){return this.select(e==null?Dae:Eae(typeof e==`function`?e:Z3(e)))}var kae=Array.prototype.filter;function Aae(){return Array.from(this.children)}function jae(e){return function(){return kae.call(this.children,e)}}function Mae(e){return this.selectAll(e==null?Aae:jae(typeof e==`function`?e:Z3(e)))}function Nae(e){typeof e!=`function`&&(e=X3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new l6(r,this._parents)}function Q3(e){return Array(e.length)}function Pae(){return new l6(this._enter||this._groups.map(Q3),this._parents)}function $3(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$3.prototype={constructor:$3,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Fae(e){return function(){return e}}function Iae(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new $3(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Lae(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new $3(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Rae(e){return e.__data__}function zae(e,t){if(!arguments.length)return Array.from(this,Rae);var n=t?Lae:Iae,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Fae(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Bae(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new l6(o,r),o._enter=s,o._exit=c,o}function Bae(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Vae(){return new l6(this._exit||this._groups.map(Q3),this._parents)}function Hae(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Uae(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new l6(s,this._parents)}function Wae(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Gae(e){e||=Kae;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new l6(i,this._parents).order()}function Kae(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function qae(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Jae(){return Array.from(this)}function Yae(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Xae(){let e=0;for(let t of this)++e;return e}function Zae(){return!this.node()}function Qae(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function $ae(e){return function(){this.removeAttribute(e)}}function eoe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function toe(e,t){return function(){this.setAttribute(e,t)}}function noe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function roe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ioe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function aoe(e,t){var n=B3(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?eoe:$ae:typeof t==`function`?n.local?ioe:roe:n.local?noe:toe)(n,t))}function e6(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ooe(e){return function(){this.style.removeProperty(e)}}function soe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function coe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function loe(e,t,n){return arguments.length>1?this.each((t==null?ooe:typeof t==`function`?coe:soe)(e,t,n??``)):t6(this.node(),e)}function t6(e,t){return e.style.getPropertyValue(t)||e6(e).getComputedStyle(e,null).getPropertyValue(t)}function uoe(e){return function(){delete this[e]}}function doe(e,t){return function(){this[e]=t}}function foe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function poe(e,t){return arguments.length>1?this.each((t==null?uoe:typeof t==`function`?foe:doe)(e,t)):this.node()[e]}function n6(e){return e.trim().split(/^|\s+/)}function r6(e){return e.classList||new i6(e)}function i6(e){this._node=e,this._names=n6(e.getAttribute(`class`)||``)}i6.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function a6(e,t){for(var n=r6(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function o6(e,t){for(var n=r6(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function moe(e){return function(){a6(this,e)}}function hoe(e){return function(){o6(this,e)}}function goe(e,t){return function(){(t.apply(this,arguments)?a6:o6)(this,e)}}function _oe(e,t){var n=n6(e+``);if(arguments.length<2){for(var r=r6(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?goe:t?moe:hoe)(n,t))}function voe(){this.textContent=``}function yoe(e){return function(){this.textContent=e}}function boe(e){return function(){this.textContent=e.apply(this,arguments)??``}}function xoe(e){return arguments.length?this.each(e==null?voe:(typeof e==`function`?boe:yoe)(e)):this.node().textContent}function Soe(){this.innerHTML=``}function Coe(e){return function(){this.innerHTML=e}}function woe(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function Toe(e){return arguments.length?this.each(e==null?Soe:(typeof e==`function`?woe:Coe)(e)):this.node().innerHTML}function Eoe(){this.nextSibling&&this.parentNode.appendChild(this)}function Doe(){return this.each(Eoe)}function Ooe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function koe(){return this.each(Ooe)}function Aoe(e){var t=typeof e==`function`?e:U3(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function joe(){return null}function Moe(e,t){var n=typeof e==`function`?e:U3(e),r=t==null?joe:typeof t==`function`?t:G3(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Noe(){var e=this.parentNode;e&&e.removeChild(this)}function Poe(){return this.each(Noe)}function Foe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ioe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Loe(e){return this.select(e?Ioe:Foe)}function Roe(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function zoe(e){return function(t){e.call(this,t,this.__data__)}}function Boe(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Voe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Hoe(e,t,n){return function(){var r=this.__on,i,a=zoe(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Uoe(e,t,n){var r=Boe(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?Hoe:Voe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function s6(e,t,n){var r=e6(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Woe(e,t){return function(){return s6(this,e,t)}}function Goe(e,t){return function(){return s6(this,e,t.apply(this,arguments))}}function Koe(e,t){return this.each((typeof t==`function`?Goe:Woe)(e,t))}function*qoe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var c6=[null];function l6(e,t){this._groups=e,this._parents=t}function u6(){return new l6([[document.documentElement]],c6)}function Joe(){return this}l6.prototype=u6.prototype={constructor:l6,select:K3,selectAll:wae,selectChild:Oae,selectChildren:Mae,filter:Nae,data:zae,enter:Pae,exit:Vae,join:Hae,merge:Uae,selection:Joe,order:Wae,sort:Gae,call:qae,nodes:Jae,node:Yae,size:Xae,empty:Zae,each:Qae,attr:aoe,style:loe,property:poe,classed:_oe,text:xoe,html:Toe,raise:Doe,lower:koe,append:Aoe,insert:Moe,remove:Poe,clone:Loe,datum:Roe,on:Uoe,dispatch:Koe,[Symbol.iterator]:qoe};function d6(e){return typeof e==`string`?new l6([[document.querySelector(e)]],[document.documentElement]):new l6([[e]],c6)}function Yoe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function f6(e,t){if(e=Yoe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var Xoe={passive:!1},p6={capture:!0,passive:!1};function m6(e){e.stopImmediatePropagation()}function h6(e){e.preventDefault(),e.stopImmediatePropagation()}function g6(e){var t=e.document.documentElement,n=d6(e).on(`dragstart.drag`,h6,p6);`onselectstart`in t?n.on(`selectstart.drag`,h6,p6):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function _6(e,t){var n=e.document.documentElement,r=d6(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,h6,p6),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var v6=e=>()=>e;function y6(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}y6.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Zoe(e){return!e.ctrlKey&&!e.button}function Qoe(){return this.parentNode}function $oe(e,t){return t??{x:e.x,y:e.y}}function ese(){return navigator.maxTouchPoints||`ontouchstart`in this}function b6(){var e=Zoe,t=Qoe,n=$oe,r=ese,i={},a=P3(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Xoe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(d6(n.view).on(`mousemove.drag`,m,p6).on(`mouseup.drag`,h,p6),g6(n.view),m6(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(h6(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){d6(e.view).on(`mousemove.drag mouseup.drag`,null),_6(e.view,l),h6(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(m6(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(h6(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(m6(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=f6(l||r,t),p,m,h;if((h=n.call(e,new y6(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=f6(l||a,t),_=o;break}u.call(r,e,new y6(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:v6(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:v6(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:v6(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:v6(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}var x6=0,S6=0,C6=0,w6=1e3,T6,E6,D6=0,O6=0,k6=0,A6=typeof performance==`object`&&performance.now?performance:Date,j6=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function M6(){return O6||=(j6(tse),A6.now()+k6)}function tse(){O6=0}function N6(){this._call=this._time=this._next=null}N6.prototype=P6.prototype={constructor:N6,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?M6():+n)+(t==null?0:+t),!this._next&&E6!==this&&(E6?E6._next=this:T6=this,E6=this),this._call=e,this._time=n,I6()},stop:function(){this._call&&(this._call=null,this._time=1/0,I6())}};function P6(e,t,n){var r=new N6;return r.restart(e,t,n),r}function nse(){M6(),++x6;for(var e=T6,t;e;)(t=O6-e._time)>=0&&e._call.call(void 0,t),e=e._next;--x6}function F6(){O6=(D6=A6.now())+k6,x6=S6=0;try{nse()}finally{x6=0,ise(),O6=0}}function rse(){var e=A6.now(),t=e-D6;t>w6&&(k6-=t,D6=e)}function ise(){for(var e,t=T6,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:T6=n);E6=e,I6(r)}function I6(e){x6||(S6&&=clearTimeout(S6),e-O6>24?(e<1/0&&(S6=setTimeout(F6,e-A6.now()-k6)),C6&&=clearInterval(C6)):(C6||=(D6=A6.now(),setInterval(rse,w6)),x6=1,j6(F6)))}function L6(e,t,n){var r=new N6;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var ase=P3(`start`,`end`,`cancel`,`interrupt`),ose=[];function R6(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;sse(e,n,{name:t,index:r,group:i,on:ase,tween:ose,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function z6(e,t){var n=V6(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function B6(e,t){var n=V6(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function V6(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function sse(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=P6(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return L6(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(L6(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function H6(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function cse(e){return this.each(function(){H6(this,e)})}function lse(e,t){var n,r;return function(){var i=B6(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function use(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=B6(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function dse(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=V6(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?lse:use)(n,e,t))}function U6(e,t,n){var r=e._id;return e.each(function(){var e=B6(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return V6(e,r).value[t]}}function W6(e,t){var n;return(typeof t==`number`?TI:t instanceof XF?bI:(n=XF(t))?(t=n,bI):jI)(e,t)}function fse(e){return function(){this.removeAttribute(e)}}function pse(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mse(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function hse(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function gse(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function _se(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function vse(e,t){var n=B3(e),r=n===`transform`?HI:W6;return this.attrTween(e,typeof t==`function`?(n.local?_se:gse)(n,r,U6(this,`attr.`+e,t)):t==null?(n.local?pse:fse)(n):(n.local?hse:mse)(n,r,t))}function yse(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function bse(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function xse(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&bse(e,i)),n}return i._value=t,i}function Sse(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&yse(e,i)),n}return i._value=t,i}function Cse(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=B3(e);return this.tween(n,(r.local?xse:Sse)(r,t))}function wse(e,t){return function(){z6(this,e).delay=+t.apply(this,arguments)}}function Tse(e,t){return t=+t,function(){z6(this,e).delay=t}}function Ese(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?wse:Tse)(t,e)):V6(this.node(),t).delay}function Dse(e,t){return function(){B6(this,e).duration=+t.apply(this,arguments)}}function Ose(e,t){return t=+t,function(){B6(this,e).duration=t}}function kse(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Dse:Ose)(t,e)):V6(this.node(),t).duration}function Ase(e,t){if(typeof t!=`function`)throw Error();return function(){B6(this,e).ease=t}}function jse(e){var t=this._id;return arguments.length?this.each(Ase(t,e)):V6(this.node(),t).ease}function Mse(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();B6(this,e).ease=n}}function Nse(e){if(typeof e!=`function`)throw Error();return this.each(Mse(this._id,e))}function Pse(e){typeof e!=`function`&&(e=X3(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new K6(r,this._parents,this._name,this._id)}function Fse(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new K6(o,this._parents,this._name,this._id)}function Ise(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function Lse(e,t,n){var r,i,a=Ise(t)?z6:B6;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Rse(e,t){var n=this._id;return arguments.length<2?V6(this.node(),n).on.on(e):this.each(Lse(n,e,t))}function zse(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Bse(){return this.on(`end.remove`,zse(this._id))}function Vse(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=G3(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,R6(l[f],t,n,f,l,V6(u,n)));return new K6(a,this._parents,t,n)}function Hse(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Y3(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=V6(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&R6(p,t,n,h,f,m);a.push(f),o.push(u)}return new K6(a,o,t,n)}var Use=u6.prototype.constructor;function Wse(){return new Use(this._groups,this._parents)}function Gse(e,t){var n,r,i;return function(){var a=t6(this,e),o=(this.style.removeProperty(e),t6(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function G6(e){return function(){this.style.removeProperty(e)}}function Kse(e,t,n){var r,i=n+``,a;return function(){var o=t6(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function qse(e,t,n){var r,i,a;return function(){var o=t6(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),t6(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Jse(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=B6(this,e),l=c.on,u=c.value[a]==null?s||=G6(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Yse(e,t,n){var r=(e+=``)==`transform`?VI:W6;return t==null?this.styleTween(e,Gse(e,r)).on(`end.style.`+e,G6(e)):typeof t==`function`?this.styleTween(e,qse(e,r,U6(this,`style.`+e,t))).each(Jse(this._id,e)):this.styleTween(e,Kse(e,r,t),n).on(`end.style.`+e,null)}function Xse(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Zse(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Xse(e,a,n)),r}return a._value=t,a}function Qse(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Zse(e,t,n??``))}function $se(e){return function(){this.textContent=e}}function ece(e){return function(){this.textContent=e(this)??``}}function tce(e){return this.tween(`text`,typeof e==`function`?ece(U6(this,`text`,e)):$se(e==null?``:e+``))}function nce(e){return function(t){this.textContent=e.call(this,t)}}function rce(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&nce(r)),t}return r._value=e,r}function ice(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,rce(e))}function ace(){for(var e=this._name,t=this._id,n=q6(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=V6(c,t);R6(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new K6(r,this._parents,e,n)}function oce(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=B6(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var sce=0;function K6(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function cce(e){return u6().transition(e)}function q6(){return++sce}var J6=u6.prototype;K6.prototype=cce.prototype={constructor:K6,select:Vse,selectAll:Hse,selectChild:J6.selectChild,selectChildren:J6.selectChildren,filter:Pse,merge:Fse,selection:Wse,transition:ace,call:J6.call,nodes:J6.nodes,node:J6.node,size:J6.size,empty:J6.empty,each:J6.each,on:Rse,attr:vse,attrTween:Cse,style:Yse,styleTween:Qse,text:tce,textTween:ice,remove:Bse,tween:dse,delay:Ese,duration:kse,ease:jse,easeVarying:Nse,end:oce,[Symbol.iterator]:J6[Symbol.iterator]};function lce(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var uce={time:null,delay:0,duration:250,ease:lce};function dce(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function fce(e){var t,n;e instanceof K6?(t=e._id,e=e._name):(t=q6(),(n=uce).time=M6(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&R6(c,e,t,l,o,n||dce(c,t));return new K6(r,this._parents,e,t)}u6.prototype.interrupt=cse,u6.prototype.transition=fce;var Y6=e=>()=>e;function pce(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function X6(e,t,n){this.k=e,this.x=t,this.y=n}X6.prototype={constructor:X6,scale:function(e){return e===1?this:new X6(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new X6(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Z6=new X6(1,0,0);Q6.prototype=X6.prototype;function Q6(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Z6;return e.__zoom}function $6(e){e.stopImmediatePropagation()}function e8(e){e.preventDefault(),e.stopImmediatePropagation()}function mce(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function hce(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function t8(){return this.__zoom||Z6}function gce(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _ce(){return navigator.maxTouchPoints||`ontouchstart`in this}function vce(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function n8(){var e=mce,t=hce,n=vce,r=gce,i=_ce,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=qI,l=P3(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,t8).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,t8),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Z6.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new X6(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new X6(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new X6(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=d6(this.that).datum();l.call(e,this.that,new pce(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=f6(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],H6(this),s.start();e8(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=d6(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=f6(t,i),l=t.clientX,u=t.clientY;g6(t.view),$6(t),a.mouse=[c,this.__zoom.invert(c)],H6(this),a.start();function d(e){if(e8(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=f6(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),_6(e.view,a.moved),e8(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=f6(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);e8(r),s>0?d6(this).transition().duration(s).call(x,d,c,r):d6(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for($6(t),s=0;s<i;++s)c=r[s],l=f6(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),H6(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(e8(e),s=0;s<a;++s)c=i[s],l=f6(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for($6(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=f6(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=d6(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Y6(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Y6(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Y6(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Y6([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var r8={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`},i8=[[-1/0,-1/0],[1/0,1/0]],a8=[`Enter`,` `,`Escape`],o8={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},s8;(function(e){e.Strict=`strict`,e.Loose=`loose`})(s8||={});var c8;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(c8||={});var l8;(function(e){e.Partial=`partial`,e.Full=`full`})(l8||={});var u8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},d8;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(d8||={});var f8;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(f8||={});var p8;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(p8||={});var m8={[p8.Left]:p8.Right,[p8.Right]:p8.Left,[p8.Top]:p8.Bottom,[p8.Bottom]:p8.Top};function h8(e){return e===null?null:e?`valid`:`invalid`}var g8=e=>`id`in e&&`source`in e&&`target`in e,yce=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),_8=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),v8=(e,t=[0,0])=>{let{width:n,height:r}=U8(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},bce=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:k8(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):_8(n)?n:t.nodeLookup.get(n.id)),D8(e,i?j8(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),y8=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=D8(n,j8(e)),r=!0)}),r?k8(n):{x:0,y:0,width:0,height:0}},b8=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...L8(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??null,l=e.height??t.height??t.initialHeight??null,u=N8(s,A8(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},xce=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Sce(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Cce({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=B8(y8(Sce(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)}function x8({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,r8.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&H8(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=H8(d)?C8(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,r8.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function wce({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=xce(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var S8=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),C8=(e={x:0,y:0},t,n)=>({x:S8(e.x,t[0][0],t[1][0]-(n?.width??0)),y:S8(e.y,t[0][1],t[1][1]-(n?.height??0))});function w8(e,t,n){let{width:r,height:i}=U8(n),{x:a,y:o}=n.internals.positionAbsolute;return C8(e,[[a,o],[a+r,o+i]],t)}var T8=(e,t,n)=>e<t?S8(Math.abs(e-t),1,t)/t:e>n?-S8(Math.abs(e-n),1,t)/t:0,E8=(e,t,n=15,r=40)=>[T8(e.x,r,t.width-r)*n,T8(e.y,r,t.height-r)*n],D8=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),O8=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),k8=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),A8=(e,t=[0,0])=>{let{x:n,y:r}=_8(e)?e.internals.positionAbsolute:v8(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},j8=(e,t=[0,0])=>{let{x:n,y:r}=_8(e)?e.internals.positionAbsolute:v8(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},M8=(e,t)=>k8(D8(O8(e),O8(t))),N8=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},P8=e=>F8(e.width)&&F8(e.height)&&F8(e.x)&&F8(e.y),F8=e=>!isNaN(e)&&isFinite(e),Tce=(e,t)=>{},I8=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),L8=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?I8(s,o):s},R8=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function z8(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ece(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=z8(e,n),i=z8(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=z8(e.top??e.y??0,n),i=z8(e.bottom??e.y??0,n),a=z8(e.left??e.x??0,t),o=z8(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Dce(e,t,n,r,i,a){let{x:o,y:s}=R8(e,[t,n,r]),{x:c,y:l}=R8({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var B8=(e,t,n,r,i,a)=>{let o=Ece(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=S8(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=Dce(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},V8=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function H8(e){return e!=null&&e!==`parent`}function U8(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function W8(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function G8(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function K8(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Oce(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function kce(e){return{...o8,...e||{}}}function q8(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Q8(e),s=L8({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?I8(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var J8=e=>({width:e.offsetWidth,height:e.offsetHeight}),Y8=e=>e?.getRootNode?.()||window?.document,Ace=[`INPUT`,`SELECT`,`TEXTAREA`];function X8(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Ace.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Z8=e=>`clientX`in e,Q8=(e,t)=>{let n=Z8(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},$8=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...J8(t)}})};function e5({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function t5(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function n5({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case p8.Left:return[t-t5(t-r,a),n];case p8.Right:return[t+t5(r-t,a),n];case p8.Top:return[t,n-t5(n-i,a)];case p8.Bottom:return[t,n+t5(i-n,a)]}}function r5({sourceX:e,sourceY:t,sourcePosition:n=p8.Bottom,targetX:r,targetY:i,targetPosition:a=p8.Top,curvature:o=.25}){let[s,c]=n5({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=n5({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=e5({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function i5({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function jce({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function Mce({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=D8(j8(e),j8(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),N8({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},k8(a))>0}var Nce=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Pce=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Fce=(e,t,n={})=>{if(!e.source||!e.target)return r8.error006(),t;let r=n.getEdgeId||Nce,i;return i=g8(e)?{...e}:{...e,id:r(e)},Pce(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function a5({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=i5({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var o5={[p8.Left]:{x:-1,y:0},[p8.Right]:{x:1,y:0},[p8.Top]:{x:0,y:-1},[p8.Bottom]:{x:0,y:1}},Ice=({source:e,sourcePosition:t=p8.Bottom,target:n})=>t===p8.Left||t===p8.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},s5=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Lce({source:e,sourcePosition:t=p8.Bottom,target:n,targetPosition:r=p8.Top,center:i,offset:a,stepPosition:o}){let s=o5[t],c=o5[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Ice({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=i5({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Rce(e,t,n,r){let i=Math.min(s5(e,t)/2,s5(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function c5({sourceX:e,sourceY:t,sourcePosition:n=p8.Bottom,targetX:r,targetY:i,targetPosition:a=p8.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Lce({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=Rce(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function l5(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function zce(e){let{sourceNode:t,targetNode:n}=e;if(!l5(t)||!l5(n))return null;let r=t.internals.handleBounds||u5(t.handles),i=n.internals.handleBounds||u5(n.handles),a=f5(r?.source??[],e.sourceHandle),o=f5(e.connectionMode===s8.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,r8.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||p8.Bottom,c=o?.position||p8.Top,l=d5(t,a,s),u=d5(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function u5(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function d5(e,t,n=p8.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??U8(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case p8.Top:return{x:i+o/2,y:a};case p8.Right:return{x:i+o,y:a+s/2};case p8.Bottom:return{x:i+o/2,y:a+s};case p8.Left:return{x:i,y:a+s/2}}}function f5(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function p5(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Bce(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=p5(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var m5=1e3,Vce=10,h5={nodeOrigin:[0,0],nodeExtent:i8,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Hce={...h5,checkEquality:!0};function g5(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Uce(e,t,n){let r=g5(h5,n);for(let n of e.values())if(n.parentId)y5(n,e,t,r);else{let e=C8(v8(n,r.nodeOrigin),H8(n.extent)?n.extent:r.nodeExtent,U8(n));n.internals.positionAbsolute=e}}function Wce(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function _5(e){return e===`manual`}function v5(e,t,n,r={}){let i=g5(Hce,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!_5(i.zIndexMode)?m5:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=C8(v8(u,i.nodeOrigin),H8(u.extent)?u.extent:i.nodeExtent,U8(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Wce(u,e),z:b5(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&y5(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Gce(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function y5(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=g5(h5,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Gce(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Vce),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Kce(e,u,o,s,a&&!_5(c)?m5:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function b5(e,t,n){let r=F8(e.zIndex)?e.zIndex:0;return _5(n)?r:r+(e.selected?t:0)}function Kce(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=U8(e),l=v8(e,n),u=H8(e.extent)?C8(l,e.extent,c):l,d=C8({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=w8(d,c,t));let f=b5(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function x5(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=M8(a.get(n.parentId)?.expandedRect??A8(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=U8(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function qce(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=J8(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=H8(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=w8(h,s,t.get(e.parentId)):m&&(h=C8(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:$8(`source`,r.nodeElement,p,d,e.id),target:$8(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&y5(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:A8(g,i)}))}}if(f.length>0){let e=x5(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Jce({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r),s=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(s)}function S5(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function C5(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;S5(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),S5(`target`,s,c,e,i,o),t.set(r.id,r)}}function w5(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:w5(n,t):!1}function T5(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Yce(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!w5(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function E5({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Xce({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=I8(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Zce({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=d6(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?O8(y8(s)):null,x=v&&l?Xce({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:I8(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=x8({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=E5({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=E8(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=q8(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Yce(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=E5({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=b6().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=q8(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Q8(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=q8(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Q8(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Q8(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!(!d||p)&&(c=!1,d=!1,cancelAnimationFrame(o),s.size>0)){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=E5({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!T5(t,`.${g}`,v))&&(!_||T5(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Qce(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())N8(i,A8(e))>0&&r.push(e);return r}var $ce=250;function ele(e,t,n,r){let i=[],a=1/0,o=Qce(e,n,t+$ce);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=d5(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function D5(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...d5(o,c,c.position,!0)}:c}function O5(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function tle(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var k5=()=>!0;function nle(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=k5,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Y8(e.target),E=0,D,{x:O,y:k}=Q8(e),A=O5(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=D5(i,A,r,c,t);if(!N)return;let ee=Q8(e,j),te=!1,P=null,ne=!1,re=null;function ie(){if(!u||!j)return;let[e,t]=E8(ee,j,S);f({x:e,y:t}),E=requestAnimationFrame(ie)}let ae={...N,nodeId:i,type:A,position:N.position},F=c.get(i),I={inProgress:!0,isValid:null,from:d5(F,ae,p8.Left,!0),fromHandle:ae,fromPosition:ae.position,fromNode:F,to:ee,toHandle:null,toPosition:m8[ae.position],toNode:null,pointer:ee};function oe(){M=!0,y(I),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&oe();function se(e){if(!M){let{x:t,y:n}=Q8(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;oe()}if(!x()||!ae){ce(e);return}let a=b();ee=Q8(e,j),D=ele(L8(ee,a,!1,[1,1]),n,c,ae),te||=(ie(),!0);let s=A5(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});re=s.handleDomNode,P=s.connection,ne=tle(!!D,s.isValid);let u=c.get(i),f=u?d5(u,ae,p8.Left,!0):I.from,p={...I,from:f,isValid:ne,to:s.toHandle&&ne?R8({x:s.toHandle.x,y:s.toHandle.y},a):ee,toHandle:s.toHandle,toPosition:ne&&s.toHandle?s.toHandle.position:m8[ae.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:ee};y(p),I=p}function ce(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||re)&&P&&ne&&h?.(P);let{inProgress:t,...n}=I,r={...n,toPosition:I.toHandle?I.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),te=!1,ne=!1,P=null,re=null,T.removeEventListener(`mousemove`,se),T.removeEventListener(`mouseup`,ce),T.removeEventListener(`touchmove`,se),T.removeEventListener(`touchend`,ce)}}T.addEventListener(`mousemove`,se),T.addEventListener(`mouseup`,ce),T.addEventListener(`touchmove`,se),T.addEventListener(`touchend`,ce)}function A5(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=k5,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Q8(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=O5(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===s8.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=D5(t,e,a,u,n,!0)}return _}var j5={onPointerDown:nle,isValid:A5};function rle({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=d6(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&V8()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=n8().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:f6}}var M5=e=>({x:e.x,y:e.y,zoom:e.k}),N5=({x:e,y:t,zoom:n})=>Z6.translate(e,t).scale(n),P5=(e,t)=>e.target.closest(`.${t}`),F5=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ile=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,I5=(e,t=0,n=ile,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},L5=e=>{let t=e.ctrlKey&&V8()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function ale({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(P5(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=f6(u),t=d*2**L5(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===c8.Vertical?0:u.deltaX*f,m=i===c8.Horizontal?0:u.deltaY*f;!V8()&&u.shiftKey&&i!==c8.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=M5(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function ole({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=P5(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function sle({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=M5(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function cle({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&F5(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,M5(a.transform))}}function lle({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&F5(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=M5(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function ule({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(P5(d,`${l}-flow__node`)||P5(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||P5(d,s)&&m||P5(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function dle({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=n8().scaleExtent([t,n]).translateExtent(r),f=d6(e).call(d);v({x:i.x,y:i.y,zoom:S8(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(L5);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?MI:qI).transform(I5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!F8(E)||E<0?0:E);let k=O?ale({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):ole({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=sle({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=cle({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=lle({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=ule({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(A),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=N5(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=N5(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=N5(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?Q6(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?MI:qI).scaleTo(I5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?MI:qI).scaleBy(I5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!F8(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var R5;(function(e){e.Line=`line`,e.Handle=`handle`})(R5||={});function fle({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function z5(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function B5(e,t){return Math.max(0,t-e)}function V5(e,t){return Math.max(0,e-t)}function H5(e,t,n){return Math.max(0,t-e,e-n)}function U5(e,t){return e?!t:t}function ple(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=H5(E,h,g),j=H5(D,_,v);if(o){let e=0,t=0;c&&w<0?e=B5(y+w+O,o[0][0]):!c&&w>0&&(e=V5(y+E+O,o[1][0])),l&&T<0?t=B5(b+T+k,o[0][1]):!l&&T>0&&(t=V5(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=V5(y+w,s[0][0]):!c&&w<0&&(e=B5(y+E,s[1][0])),l&&T>0?t=V5(b+T,s[0][1]):!l&&T<0&&(t=B5(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=H5(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?V5(b+k+E/C,o[1][1])*C:B5(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?B5(b+E/C,s[1][1])*C:V5(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=H5(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?V5(y+D*C+O,o[1][0])/C:B5(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?B5(y+D*C,s[1][0])/C:V5(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(U5(c,l)?-w:w)/C:w=(U5(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var W5={width:0,height:0,x:0,y:0},mle={...W5,pointerX:0,pointerY:0,aspectRatio:1};function hle(e){return[[0,0],[e.measured.width,e.measured.height]]}function gle(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function _le({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=d6(e),o={controlDirection:z5(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...W5},h={...mle};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:z5(e)};let g,_=null,v=[],y,b,x,S=!1,C=b6().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=q8(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId),b=y&&g.extent===`parent`?hle(y):void 0),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=gle(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=q8(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=ple(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,ee=A!==f&&M;if(!N&&!ee&&!j&&!M)return;if((N||ee||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=ee?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let te=fle({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),P={...m,direction:te};p?.(e,P)!==!1&&(S=!0,d?.(e,P),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var G5=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},vle=e=>e?G5(e):G5,{useDebugValue:yle}=L.default,{useSyncExternalStoreWithSelector:ble}=rT.default,xle=e=>e;function K5(e,t=xle,n){let r=ble(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return yle(r),r}var q5=(e,t)=>{let n=vle(e),r=(e,r=t)=>K5(n,e,r);return Object.assign(r,n),r},Sle=(e,t)=>e?q5(e,t):q5;function J5(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Y5=(0,L.createContext)(null),Cle=Y5.Provider,X5=r8.error001();function Z5(e,t){let n=(0,L.useContext)(Y5);if(n===null)throw Error(X5);return K5(n,e,t)}function Q5(){let e=(0,L.useContext)(Y5);if(e===null)throw Error(X5);return(0,L.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var $5={display:`none`},wle={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},e7=`react-flow__node-desc`,t7=`react-flow__edge-desc`,Tle=`react-flow__aria-live`,Ele=e=>e.ariaLiveMessage,Dle=e=>e.ariaLabelConfig;function Ole({rfId:e}){let t=Z5(Ele);return(0,R.jsx)(`div`,{id:`${Tle}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:wle,children:t})}function kle({rfId:e,disableKeyboardA11y:t}){let n=Z5(Dle);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{id:`${e7}-${e}`,style:$5,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,R.jsx)(`div`,{id:`${t7}-${e}`,style:$5,children:n[`edge.a11yDescription.default`]}),!t&&(0,R.jsx)(Ole,{rfId:e})]})}var n7=(0,L.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,R.jsx)(`div`,{className:M3([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));n7.displayName=`Panel`;function Ale({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,R.jsx)(n7,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev`,children:(0,R.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var jle=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},r7=e=>e.id;function Mle(e,t){return J5(e.selectedNodes.map(r7),t.selectedNodes.map(r7))&&J5(e.selectedEdges.map(r7),t.selectedEdges.map(r7))}function Nle({onSelectionChange:e}){let t=Q5(),{selectedNodes:n,selectedEdges:r}=Z5(jle,Mle);return(0,L.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Ple=e=>!!e.onSelectionChangeHandlers;function Fle({onSelectionChange:e}){let t=Z5(Ple);return e||t?(0,R.jsx)(Nle,{onSelectionChange:e}):null}var i7=typeof window<`u`?L.useLayoutEffect:L.useEffect,a7=[0,0],Ile={x:0,y:0,zoom:1},o7=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],Lle=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),s7={translateExtent:i8,nodeOrigin:a7,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Rle(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=Z5(Lle,J5),l=Q5();i7(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=s7,s()}),[]);let u=(0,L.useRef)(s7);return i7(()=>{for(let s of o7){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:kce(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},o7.map(t=>e[t])),null}function c7(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function zle(e){let[t,n]=(0,L.useState)(e===`system`?null:e);return(0,L.useEffect)(()=>{if(e!==`system`){n(e);return}let t=c7(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?c7()?.matches?`dark`:`light`:t}var l7=typeof document<`u`?document:null;function u7(e=null,t={target:l7,actInsideInputWithModifier:!0}){let[n,r]=(0,L.useState)(!1),i=(0,L.useRef)(!1),a=(0,L.useRef)(new Set([])),[o,s]=(0,L.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
71
75
  `).replace(`
72
76
 
73
77
  `,`