@winspan/claude-forge 1.23.0 → 1.23.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/daemon/handlers/pre-tool-use-handler.d.ts.map +1 -1
- package/dist/daemon/handlers/pre-tool-use-handler.js +5 -0
- package/dist/daemon/handlers/pre-tool-use-handler.js.map +1 -1
- package/dist/daemon/server.d.ts +5 -0
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js.map +1 -1
- package/dist/hooks/pre-tool-use.sh +12 -2
- package/dist/web-static/assets/{index-CJOVpN6F.js → index-B78dZJAZ.js} +3 -3
- package/dist/web-static/index.html +1 -1
- 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=No(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&ss.assertOptions(n,{silentJSONParsing:cs.transitional(cs.boolean),forcedJSONParsing:cs.transitional(cs.boolean),clarifyTimeoutError:cs.transitional(cs.boolean),legacyInterceptorReqResOrdering:cs.transitional(cs.boolean)},!1),r!=null&&(V.isFunction(r)?t.paramsSerializer={serialize:r}:ss.assertOptions(r,{encode:cs.function,serialize:cs.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),ss.assertOptions(t,{baseUrl:cs.spelling(`baseURL`),withXsrfToken:cs.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&V.merge(i.common,i[t.method]);i&&V.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=go.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||Ba;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=[ns.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=ns.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=No(this.defaults,e),Ra(jo(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};V.forEach([`delete`,`get`,`head`,`options`],function(e){ls.prototype[e]=function(t,n){return this.request(No(n||{},{method:e,url:t,data:(n||{}).data}))}}),V.forEach([`post`,`put`,`patch`],function(e){function t(t){return function(n,r,i){return this.request(No(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}ls.prototype[e]=t(),ls.prototype[e+`Form`]=t(!0)});var us=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 yo(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 ds(e){return function(t){return e.apply(null,t)}}function fs(e){return V.isObject(e)&&e.isAxiosError===!0}var ps={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(ps).forEach(([e,t])=>{ps[t]=e});function ms(e){let t=new ls(e),n=_i(ls.prototype.request,t);return V.extend(n,ls.prototype,t,{allOwnKeys:!0}),V.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return ms(No(e,t))},n}var hs=ms(to);hs.Axios=ls,hs.CanceledError=yo,hs.CancelToken=us,hs.isCancel=vo,hs.VERSION=rs,hs.toFormData=Na,hs.AxiosError=H,hs.Cancel=hs.CanceledError,hs.all=function(e){return Promise.all(e)},hs.spread=ds,hs.isAxiosError=fs,hs.mergeConfig=No,hs.AxiosHeaders=go,hs.formToJSON=e=>Qa(V.isHTMLForm(e)?new FormData(e):e),hs.getAdapter=es.getAdapter,hs.HttpStatusCode=ps,hs.default=hs;var gs=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),_s=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),vs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ys=e=>{let t=vs(e);return t.charAt(0).toUpperCase()+t.slice(1)},bs={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`},xs=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ss=(0,z.createContext)({}),Cs=()=>(0,z.useContext)(Ss),ws=(0,z.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=``}=Cs()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,z.createElement)(`svg`,{ref:c,...bs,width:t??l??bs.width,height:t??l??bs.height,stroke:e??f,strokeWidth:m,className:gs(`lucide`,p,i),...!a&&!xs(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,z.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),U=(e,t)=>{let n=(0,z.forwardRef)(({className:n,...r},i)=>(0,z.createElement)(ws,{ref:i,iconNode:t,className:gs(`lucide-${_s(ys(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ys(e),n},Ts=U(`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`}]]),Es=U(`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`}]]),Ds=U(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Os=U(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ks=U(`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`}]]),As=U(`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`}]]),js=U(`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`}]]),Ms=U(`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`}]]),Ns=U(`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`}]]),Ps=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Fs=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Is=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ls=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Rs=U(`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`}]]),zs=U(`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`}]]),Bs=U(`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`}]]),Vs=U(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Hs=U(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Us=U(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ws=U(`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`}]]),Gs=U(`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`}]]),Ks=U(`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`}]]),qs=U(`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`}]]),Js=U(`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`}]]),Ys=U(`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`}]]),Xs=U(`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`}]]),Zs=U(`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`}]]),Qs=U(`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`}]]),$s=U(`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`}]]),ec=U(`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`}]]),tc=U(`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`}]]),nc=U(`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`}]]),rc=U(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ic=U(`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`}]]),ac=U(`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`}]]),oc=U(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),sc=U(`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`}]]),cc=U(`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`}]]),lc=U(`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`}]]),uc=U(`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`}]]),dc=U(`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`}]]),fc=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),pc=U(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),mc=U(`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`}]]),hc=U(`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`}]]),gc=U(`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`}]]),_c=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),vc=U(`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`}]]),yc=U(`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=U(`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`}]]),xc=U(`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`}]]),Sc=U(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Cc=U(`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`}]]),wc=U(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Tc=U(`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`}]]),Ec=U(`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`}]]),Dc=U(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),Oc=U(`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`}]]),kc=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ac=U(`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`}]]),jc=u(y(),1),Mc=u(_(),1),Nc=(0,z.createContext)({toast:()=>{}}),Pc=()=>{};function Fc(e,t=`error`){Pc(e,t)}function Ic({children:e}){let[t,n]=(0,z.useState)([]),r={current:0},i=(0,z.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,z.useEffect)(()=>{Pc=i},[i]);let a={success:zs,error:Bs,warning:Tc},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,B.jsxs)(Nc.Provider,{value:{toast:i},children:[e,(0,Mc.createPortal)((0,B.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,B.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3 rounded-lg border shadow-lg text-sm ${o[e.type]}`,children:[(0,B.jsx)(t,{className:`h-4 w-4 mt-0.5 flex-shrink-0 ${s[e.type]}`}),(0,B.jsx)(`span`,{className:`flex-1`,children:e.message}),(0,B.jsx)(`button`,{onClick:()=>n(t=>t.filter(t=>t.id!==e.id)),children:(0,B.jsx)(kc,{className:`h-3.5 w-3.5 opacity-60 hover:opacity-100`})})]},e.id)})}),document.body)]})}var W=hs.create({baseURL:`/api`,timeout:3e4});W.interceptors.response.use(e=>e,e=>(Fc(e.response?.data?.error||e.response?.data?.message||e.message||`请求失败`,`error`),Promise.reject(e)));var Lc=()=>W.get(`/health`),Rc=()=>W.get(`/config`),zc=e=>W.put(`/config`,e),Bc=()=>W.get(`/config/history`),Vc=e=>W.get(`/sessions`,{params:e}),Hc=e=>W.get(`/sessions/${e}`),Uc=e=>W.delete(`/sessions/${e}`),Wc=e=>W.delete(`/sessions`,{data:{ids:e}}),Gc=e=>W.get(`/events`,{params:e}),Kc=e=>W.get(`/events/stats`,{params:{project_path:e}}),qc=e=>W.get(`/pipelines`,{params:e}),Jc=e=>W.get(`/pipelines/${e}`),Yc=e=>W.get(`/quality/history`,{params:e}),Xc=e=>W.get(`/quality/unresolved`,{params:{project_path:e}}),Zc=()=>W.get(`/stats/roi`),Qc=()=>W.get(`/stats/overview`),$c=(e,t)=>W.get(`/knowledge/search`,{params:{q:e,project_path:t}}),el=e=>W.get(`/knowledge/overview`,{params:{project_path:e}}),tl=(e,t)=>W.get(`/knowledge/neighbors`,{params:{node_id:e,project_path:t}}),nl=e=>W.get(`/knowledge/graph`,{params:{project_path:e}}),rl=e=>W.post(`/knowledge/nodes`,e),il=(e,t)=>W.put(`/knowledge/nodes/${e}`,t),al=e=>W.delete(`/knowledge/nodes/${e}`),ol=e=>W.post(`/pipelines/${e}/close`),sl=e=>W.post(`/pipelines/batch-close`,{ids:e}),cl=()=>W.post(`/pipelines/close-expired`),ll=()=>W.get(`/pipelines/active`),ul=(e,t)=>W.post(`/pipelines/tasks/${e}/status`,{status:t}),dl=e=>W.post(`/pipelines/${e}/resume`),fl=e=>W.get(`/projects`,{params:e}),pl=e=>W.get(`/projects/${e}`),ml=e=>W.delete(`/projects/${e}`),hl=e=>W.get(`/convention/${e}`),gl=(e,t,n,r)=>W.put(`/convention/${e}/${t}`,{name:n,content:r}),_l=(e,t)=>W.delete(`/convention/${e}/${t}`),vl=(e,t)=>W.post(`/convention/${e}/evolve`,{id:t}),yl=e=>W.post(`/convention/init`,{path:e},{timeout:18e4}),bl=e=>W.get(`/claudemd/${e}`),xl=(e,t)=>W.put(`/claudemd/${e}`,{content:t}),Sl=e=>W.get(`/claudemd/${e}/profile`),Cl=e=>W.get(`/claudemd/${e}/modules`),wl=e=>W.post(`/claudemd/${e}/distill`,void 0,{timeout:18e4}),Tl=e=>W.post(`/claudemd/${e}/init`,void 0,{timeout:18e4}),El=e=>W.post(`/quality/${e}/resolve`),Dl=e=>W.post(`/quality/${e}/dismiss`),Ol=()=>W.post(`/quality/resolve-all`),kl=e=>W.post(`/quality/${e}/auto-fix`,{},{timeout:6e4}),Al=()=>W.get(`/daemon/status`),jl=()=>W.post(`/daemon/restart`),Ml=()=>W.get(`/daemon/diagnose`),Nl=()=>W.post(`/daemon/repair`),Pl=()=>W.post(`/config/backup`),Fl=()=>W.get(`/config/backups`),Il=e=>W.post(`/events/purge`,{retentionDays:e}),Ll=e=>W.get(`/stats/api-usage`,{params:{days:e}});function Rl(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=Rl(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function zl(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Rl(e))&&(r&&(r+=` `),r+=t);return r}var Bl=(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},Vl=(e,t)=>({classGroupId:e,validator:t}),Hl=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ul=`-`,Wl=[],Gl=`arbitrary..`,Kl=e=>{let t=Yl(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Jl(e);let n=e.split(Ul);return ql(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Bl(i,t):t:i||Wl}return n[e]||Wl}}},ql=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=ql(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Ul):e.slice(t).join(Ul),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Jl=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?Gl+r:void 0})(),Yl=e=>{let{theme:t,classGroups:n}=e;return Xl(n,t)},Xl=(e,t)=>{let n=Hl();for(let r in e){let i=e[r];Zl(i,n,r,t)}return n},Zl=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Ql(i,t,n,r)}},Ql=(e,t,n,r)=>{if(typeof e==`string`){$l(e,t,n);return}if(typeof e==`function`){eu(e,t,n,r);return}tu(e,t,n,r)},$l=(e,t,n)=>{let r=e===``?t:nu(t,e);r.classGroupId=n},eu=(e,t,n,r)=>{if(ru(e)){Zl(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Vl(n,e))},tu=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Zl(o,nu(t,a),n,r)}},nu=(e,t)=>{let n=e,r=t.split(Ul),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Hl(),n.nextPart.set(t,i)),n=i}return n},ru=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,iu=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)}}},au=`!`,ou=`:`,su=[],cu=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),lu=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===ou){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(au)?(c=s.slice(0,-1),l=!0):s.startsWith(au)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return cu(t,l,c,u)};if(t){let e=t+ou,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):cu(su,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},uu=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}},du=e=>({cache:iu(e.cacheSize),parseClassName:lu(e),sortModifiers:uu(e),...Kl(e)}),fu=/\s+/,pu=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(fu),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+au: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},mu=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=hu(n))&&(i&&(i+=` `),i+=r);return i},hu=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=hu(e[r]))&&(n&&(n+=` `),n+=t);return n},gu=(e,...t)=>{let n,r,i,a,o=o=>(n=du(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=pu(e,n);return i(e,a),a};return a=o,(...e)=>a(mu(...e))},_u=[],vu=e=>{let t=t=>t[e]||_u;return t.isThemeGetter=!0,t},yu=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bu=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xu=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Su=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cu=/\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$/,wu=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Tu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Eu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Du=e=>xu.test(e),Ou=e=>!!e&&!Number.isNaN(Number(e)),ku=e=>!!e&&Number.isInteger(Number(e)),Au=e=>e.endsWith(`%`)&&Ou(e.slice(0,-1)),ju=e=>Su.test(e),Mu=()=>!0,Nu=e=>Cu.test(e)&&!wu.test(e),Pu=()=>!1,Fu=e=>Tu.test(e),Iu=e=>Eu.test(e),Lu=e=>!G(e)&&!K(e),Ru=e=>$u(e,rd,Pu),G=e=>yu.test(e),zu=e=>$u(e,id,Nu),Bu=e=>$u(e,ad,Ou),Vu=e=>$u(e,sd,Mu),Hu=e=>$u(e,od,Pu),Uu=e=>$u(e,td,Pu),Wu=e=>$u(e,nd,Iu),Gu=e=>$u(e,cd,Fu),K=e=>bu.test(e),Ku=e=>ed(e,id),qu=e=>ed(e,od),Ju=e=>ed(e,td),Yu=e=>ed(e,rd),Xu=e=>ed(e,nd),Zu=e=>ed(e,cd,!0),Qu=e=>ed(e,sd,!0),$u=(e,t,n)=>{let r=yu.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ed=(e,t,n=!1)=>{let r=bu.exec(e);return r?r[1]?t(r[1]):n:!1},td=e=>e===`position`||e===`percentage`,nd=e=>e===`image`||e===`url`,rd=e=>e===`length`||e===`size`||e===`bg-size`,id=e=>e===`length`,ad=e=>e===`number`,od=e=>e===`family-name`,sd=e=>e===`number`||e===`weight`,cd=e=>e===`shadow`,ld=gu(()=>{let e=vu(`color`),t=vu(`font`),n=vu(`text`),r=vu(`font-weight`),i=vu(`tracking`),a=vu(`leading`),o=vu(`breakpoint`),s=vu(`container`),c=vu(`spacing`),l=vu(`radius`),u=vu(`shadow`),d=vu(`inset-shadow`),f=vu(`text-shadow`),p=vu(`drop-shadow`),m=vu(`blur`),h=vu(`perspective`),g=vu(`aspect`),_=vu(`ease`),v=vu(`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=()=>[Du,`full`,`auto`,...w()],E=()=>[ku,`none`,`subgrid`,K,G],D=()=>[`auto`,{span:[`full`,ku,K,G]},ku,K,G],O=()=>[ku,`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=()=>[Du,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[Du,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],P=()=>[Du,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,K,G],I=()=>[...b(),Ju,Uu,{position:[K,G]}],L=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],te=()=>[`auto`,`cover`,`contain`,Yu,Ru,{size:[K,G]}],ne=()=>[Au,Ku,zu],re=()=>[``,`none`,`full`,l,K,G],R=()=>[``,Ou,Ku,zu],ie=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],oe=()=>[Ou,Au,Ju,Uu],se=()=>[``,`none`,m,K,G],ce=()=>[`none`,Ou,K,G],le=()=>[`none`,Ou,K,G],ue=()=>[Ou,K,G],de=()=>[Du,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[ju],breakpoint:[ju],color:[Mu],container:[ju],"drop-shadow":[ju],ease:[`in`,`out`,`in-out`],font:[Lu],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[ju],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[ju],shadow:[ju],spacing:[`px`,Ou],text:[ju],"text-shadow":[ju],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Du,G,K,g]}],container:[`container`],columns:[{columns:[Ou,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:[ku,`auto`,K,G]}],basis:[{basis:[Du,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Ou,Du,`auto`,`initial`,`none`,G]}],grow:[{grow:[``,Ou,K,G]}],shrink:[{shrink:[``,Ou,K,G]}],order:[{order:[ku,`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`,...P()]}],"min-block-size":[{"min-block":[`auto`,...P()]}],"max-block-size":[{"max-block":[`none`,...P()]}],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,Ku,zu]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Qu,Vu]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Au,G]}],"font-family":[{font:[qu,Hu,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":[Ou,`none`,K,Bu]}],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:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ie(),`wavy`]}],"text-decoration-thickness":[{decoration:[Ou,`from-font`,`auto`,K,zu]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Ou,`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:I()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:te()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ku,K,G],radial:[``,K,G],conic:[ku,K,G]},Xu,Wu]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ie(),`hidden`,`none`]}],"divide-style":[{divide:[...ie(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ie(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Ou,K,G]}],"outline-w":[{outline:[``,Ou,Ku,zu]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,Zu,Gu]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,Zu,Gu]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Ou,zu]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,Zu,Gu]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Ou,K,G]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"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":[Ou]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[K,G]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":[Ou]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,K,G]}],filter:[{filter:[``,`none`,K,G]}],blur:[{blur:se()}],brightness:[{brightness:[Ou,K,G]}],contrast:[{contrast:[Ou,K,G]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Zu,Gu]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,Ou,K,G]}],"hue-rotate":[{"hue-rotate":[Ou,K,G]}],invert:[{invert:[``,Ou,K,G]}],saturate:[{saturate:[Ou,K,G]}],sepia:[{sepia:[``,Ou,K,G]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,K,G]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[Ou,K,G]}],"backdrop-contrast":[{"backdrop-contrast":[Ou,K,G]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Ou,K,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ou,K,G]}],"backdrop-invert":[{"backdrop-invert":[``,Ou,K,G]}],"backdrop-opacity":[{"backdrop-opacity":[Ou,K,G]}],"backdrop-saturate":[{"backdrop-saturate":[Ou,K,G]}],"backdrop-sepia":[{"backdrop-sepia":[``,Ou,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:[Ou,`initial`,K,G]}],ease:[{ease:[`linear`,`initial`,_,K,G]}],delay:[{delay:[Ou,K,G]}],animate:[{animate:[`none`,v,K,G]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,K,G]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":[`scale-3d`],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[K,G,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":[`translate-none`],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"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`,...F()]}],"stroke-w":[{stroke:[Ou,Ku,zu,Bu]}],stroke:[{stroke:[`none`,...F()]}],"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 ud(...e){return ld(zl(e))}function dd(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 fd(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 pd(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 md(e){return e?e.endsWith(`Z`)||/[+-]\d{2}:\d{2}$/.test(e)?new Date(e):new Date(e+`Z`):new Date}var hd=[{path:`/dashboard`,label:`仪表盘`,icon:ic},{path:`/projects`,label:`项目管理`,icon:$s},{path:`/sessions`,label:`会话管理`,icon:Ts},{path:`/events`,label:`事件流`,icon:Ms},{path:`/pipelines`,label:`流水线`,icon:tc},{path:`/quality`,label:`质量门禁`,icon:yc},{path:`/knowledge`,label:`知识图谱`,icon:js},{path:`/analytics`,label:`数据分析`,icon:Ns},{path:`/config`,label:`系统配置`,icon:vc}];function gd({children:e}){let[t,n]=(0,z.useState)(()=>localStorage.getItem(`sidebar-collapsed`)===`true`),r=jn();(0,z.useEffect)(()=>{localStorage.setItem(`sidebar-collapsed`,String(t))},[t]);let{data:i}=ct({queryKey:[`health`],queryFn:()=>Lc().then(e=>e.data),refetchInterval:15e3}),a=hd.find(e=>r.pathname.startsWith(e.path));return(0,B.jsxs)(`div`,{className:`flex min-h-screen bg-gray-50`,children:[(0,B.jsxs)(`aside`,{className:ud(`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,B.jsxs)(`div`,{className:ud(`flex items-center border-b border-white/10 h-16`,t?`justify-center px-2`:`justify-between px-5`),children:[!t&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,B.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,B.jsx)(Ac,{className:`h-5 w-5 text-white`})}),(0,B.jsx)(`span`,{className:`text-white font-bold text-lg tracking-tight`,children:`Forge`})]}),(0,B.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,B.jsx)(oc,{className:`h-5 w-5`}):(0,B.jsx)(Is,{className:`h-5 w-5`})})]}),(0,B.jsx)(`nav`,{className:`flex-1 py-4 space-y-1 px-2`,children:hd.map(e=>(0,B.jsxs)(ei,{to:e.path,className:({isActive:e})=>ud(`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,B.jsx)(e.icon,{className:`h-5 w-5 flex-shrink-0`}),!t&&(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:e.label})]},e.path))}),(0,B.jsx)(`div`,{className:ud(`border-t border-white/10 py-4`,t?`px-2`:`px-5`),children:(0,B.jsxs)(`div`,{className:ud(`flex items-center gap-2`,t?`justify-center`:``),children:[(0,B.jsx)(`div`,{className:ud(`w-2 h-2 rounded-full`,i?.status===`ok`?`bg-green-400 animate-pulse`:`bg-red-400`)}),!t&&(0,B.jsx)(`span`,{className:`text-xs text-white/40`,children:i?.status===`ok`?`Daemon 运行中`:`连接断开`})]})})]}),(0,B.jsxs)(`main`,{className:ud(`flex-1 transition-all duration-300`,t?`ml-16`:`ml-60`),children:[(0,B.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,B.jsx)(`h1`,{className:`text-xl font-semibold text-gray-900`,children:a?.label||`Claude Forge`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.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,B.jsx)(Ws,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:`命令面板`}),(0,B.jsx)(`kbd`,{className:`px-2 py-0.5 text-xs bg-gray-100 rounded border border-gray-200`,children:`⌘K`})]}),(0,B.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[`v`,`1.23.0`]}),(0,B.jsxs)(`div`,{className:ud(`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,B.jsx)(`div`,{className:ud(`w-1.5 h-1.5 rounded-full`,i?.status===`ok`?`bg-green-500`:`bg-red-500`)}),i?.status===`ok`?`在线`:`离线`]})]})]}),(0,B.jsx)(`div`,{className:`p-8`,children:e})]})]})}var _d=(0,z.createContext)({});function vd(e){let t=(0,z.useRef)(null);return t.current===null&&(t.current=e()),t.current}var yd=typeof window<`u`?z.useLayoutEffect:z.useEffect,bd=(0,z.createContext)(null);function xd(e,t){e.indexOf(t)===-1&&e.push(t)}function Sd(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Cd=(e,t,n)=>n>t?t:n<e?e:n,wd={},Td=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ed(e){return typeof e==`object`&&!!e}var Dd=e=>/^0[^.\s]+$/u.test(e);function Od(e){let t;return()=>(t===void 0&&(t=e()),t)}var kd=e=>e,Ad=(e,t)=>n=>t(e(n)),jd=(...e)=>e.reduce(Ad),Md=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Nd=class{constructor(){this.subscriptions=[]}add(e){return xd(this.subscriptions,e),()=>Sd(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}},Pd=e=>e*1e3,Fd=e=>e/1e3;function Id(e,t){return t?1e3/t*e:0}var Ld=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Rd=1e-7,zd=12;function Bd(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Ld(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Rd&&++s<zd);return o}function Vd(e,t,n,r){if(e===t&&n===r)return kd;let i=t=>Bd(t,0,1,e,n);return e=>e===0||e===1?e:Ld(i(e),t,r)}var Hd=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ud=e=>t=>1-e(1-t),Wd=Vd(.33,1.53,.69,.99),Gd=Ud(Wd),Kd=Hd(Gd),qd=e=>e>=1?1:(e*=2)<1?.5*Gd(e):.5*(2-2**(-10*(e-1))),Jd=e=>1-Math.sin(Math.acos(e)),Yd=Ud(Jd),Xd=Hd(Jd),Zd=Vd(.42,0,1,1),Qd=Vd(0,0,.58,1),$d=Vd(.42,0,.58,1),ef=e=>Array.isArray(e)&&typeof e[0]!=`number`,tf=e=>Array.isArray(e)&&typeof e[0]==`number`,nf={linear:kd,easeIn:Zd,easeInOut:$d,easeOut:Qd,circIn:Jd,circInOut:Xd,circOut:Yd,backIn:Gd,backInOut:Kd,backOut:Wd,anticipate:qd},rf=e=>typeof e==`string`,af=e=>{if(tf(e)){e.length;let[t,n,r,i]=e;return Vd(t,n,r,i)}else if(rf(e))return nf[e],`${e}`,nf[e];return e},of=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],sf={value:null,addProjectionMetrics:null};function cf(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&&sf.value&&sf.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var lf=40;function uf(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=of.reduce((e,n)=>(e[n]=cf(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=wd.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,lf),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:of.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<of.length;t++)o[of[t]].cancel(e)},state:i,steps:o}}var{schedule:df,cancel:ff,state:pf,steps:mf}=uf(typeof requestAnimationFrame<`u`?requestAnimationFrame:kd,!0),hf;function gf(){hf=void 0}var _f={now:()=>(hf===void 0&&_f.set(pf.isProcessing||wd.useManualTiming?pf.timestamp:performance.now()),hf),set:e=>{hf=e,queueMicrotask(gf)}},vf={layout:0,mainThread:0,waapi:0},yf=e=>t=>typeof t==`string`&&t.startsWith(e),bf=yf(`--`),xf=yf(`var(--`),Sf=e=>xf(e)?Cf.test(e.split(`/*`)[0].trim()):!1,Cf=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function wf(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Tf={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Ef={...Tf,transform:e=>Cd(0,1,e)},Df={...Tf,default:1},Of=e=>Math.round(e*1e5)/1e5,kf=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Af(e){return e==null}var jf=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Mf=(e,t)=>n=>!!(typeof n==`string`&&jf.test(n)&&n.startsWith(e)||t&&!Af(n)&&Object.prototype.hasOwnProperty.call(n,t)),Nf=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(kf);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Pf=e=>Cd(0,255,e),Ff={...Tf,transform:e=>Math.round(Pf(e))},If={test:Mf(`rgb`,`red`),parse:Nf(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Ff.transform(e)+`, `+Ff.transform(t)+`, `+Ff.transform(n)+`, `+Of(Ef.transform(r))+`)`};function Lf(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 Rf={test:Mf(`#`),parse:Lf,transform:If.transform},zf=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Bf=zf(`deg`),Vf=zf(`%`),q=zf(`px`),Hf=zf(`vh`),Uf=zf(`vw`),Wf={...Vf,parse:e=>Vf.parse(e)/100,transform:e=>Vf.transform(e*100)},Gf={test:Mf(`hsl`,`hue`),parse:Nf(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Vf.transform(Of(t))+`, `+Vf.transform(Of(n))+`, `+Of(Ef.transform(r))+`)`},Kf={test:e=>If.test(e)||Rf.test(e)||Gf.test(e),parse:e=>If.test(e)?If.parse(e):Gf.test(e)?Gf.parse(e):Rf.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?If.transform(e):Gf.transform(e),getAnimatableNone:e=>{let t=Kf.parse(e);return t.alpha=0,Kf.transform(t)}},qf=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Jf(e){return isNaN(e)&&typeof e==`string`&&(e.match(kf)?.length||0)+(e.match(qf)?.length||0)>0}var Yf=`number`,Xf=`color`,Zf=`var`,Qf=`var(`,$f="${}",ep=/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 tp(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(ep,e=>(Kf.test(e)?(r.color.push(a),i.push(Xf),n.push(Kf.parse(e))):e.startsWith(Qf)?(r.var.push(a),i.push(Zf),n.push(e)):(r.number.push(a),i.push(Yf),n.push(parseFloat(e))),++a,$f)).split($f),indexes:r,types:i}}function np(e){return tp(e).values}function rp({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===Yf?i+=Of(r[a]):e===Xf?i+=Kf.transform(r[a]):i+=r[a]}return i}}function ip(e){return rp(tp(e))}var ap=e=>typeof e==`number`?0:Kf.test(e)?Kf.getAnimatableNone(e):e,op=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:ap(e);function sp(e){let t=tp(e);return rp(t)(t.values.map((e,n)=>op(e,t.split[n])))}var cp={test:Jf,parse:np,createTransformer:ip,getAnimatableNone:sp};function lp(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 up({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=lp(s,r,e+1/3),a=lp(s,r,e),o=lp(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function dp(e,t){return n=>n>0?t:e}var fp=(e,t,n)=>e+(t-e)*n,pp=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},mp=[Rf,If,Gf],hp=e=>mp.find(t=>t.test(e));function gp(e){let t=hp(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Gf&&(n=up(n)),n}var _p=(e,t)=>{let n=gp(e),r=gp(t);if(!n||!r)return dp(e,t);let i={...n};return e=>(i.red=pp(n.red,r.red,e),i.green=pp(n.green,r.green,e),i.blue=pp(n.blue,r.blue,e),i.alpha=fp(n.alpha,r.alpha,e),If.transform(i))},vp=new Set([`none`,`hidden`]);function yp(e,t){return vp.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function bp(e,t){return n=>fp(e,t,n)}function xp(e){return typeof e==`number`?bp:typeof e==`string`?Sf(e)?dp:Kf.test(e)?_p:Tp:Array.isArray(e)?Sp:typeof e==`object`?Kf.test(e)?_p:Cp:dp}function Sp(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>xp(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Cp(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=xp(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function wp(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 Tp=(e,t)=>{let n=cp.createTransformer(t),r=tp(e),i=tp(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?vp.has(e)&&!i.values.length||vp.has(t)&&!r.values.length?yp(e,t):jd(Sp(wp(r,i),i.values),n):(`${e}${t}`,dp(e,t))};function Ep(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?fp(e,t,n):xp(e)(e,t)}var Dp=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>df.update(t,e),stop:()=>ff(t),now:()=>pf.isProcessing?pf.timestamp:_f.now()}},Op=(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)})`},kp=2e4;function Ap(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 jp(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Ap(r),kp);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Fd(i)}}var Mp={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 Np(e,t){return e*Math.sqrt(1-t*t)}var Pp=12;function Fp(e,t,n){let r=n;for(let n=1;n<Pp;n++)r-=e(r)/t(r);return r}var Ip=.001;function Lp({duration:e=Mp.duration,bounce:t=Mp.bounce,velocity:n=Mp.velocity,mass:r=Mp.mass}){let i,a;Mp.maxDuration;let o=1-t;o=Cd(Mp.minDamping,Mp.maxDamping,o),e=Cd(Mp.minDuration,Mp.maxDuration,Fd(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Np(t,o),c=Math.exp(-i);return Ip-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=Np(t**2,o);return(-i(t)+Ip>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ip+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Fp(i,a,s);if(e=Pd(e),isNaN(c))return{stiffness:Mp.stiffness,damping:Mp.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Rp=[`duration`,`bounce`],zp=[`stiffness`,`damping`,`mass`];function Bp(e,t){return t.some(t=>e[t]!==void 0)}function Vp(e){let t={velocity:Mp.velocity,stiffness:Mp.stiffness,damping:Mp.damping,mass:Mp.mass,isResolvedFromDuration:!1,...e};if(!Bp(e,zp)&&Bp(e,Rp))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Cd(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Mp.mass,stiffness:i,damping:a}}else{let n=Lp({...e,velocity:0});t={...t,...n,mass:Mp.mass},t.isResolvedFromDuration=!0}return t}function Hp(e=Mp.visualDuration,t=Mp.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}=Vp({...n,velocity:-Fd(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Fd(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Mp.restSpeed.granular:Mp.restSpeed.default,i||=v?Mp.restDelta.granular:Mp.restDelta.default;let y,b,x,S,C,w;if(h<1)x=Np(_,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=>Pd(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=Pd(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=Pd(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(Ap(T),kp),t=Op(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Hp.applyToOptions=e=>{let t=jp(e,100,Hp);return e.ease=t.ease,e.duration=Pd(t.duration),e.type=`keyframes`,e};var Up=5;function Wp(e,t,n){let r=Math.max(t-Up,0);return Id(n-e(r),t-r)}function Gp({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=Hp({keyframes:[f.value,m(f.value)],velocity:Wp(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 eee(e,t,n){let r=[],i=n||wd.mix||Ep,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=jd(Array.isArray(t)?t[n]||kd:t,a)),r.push(a)}return r}function tee(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=eee(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=Md(e[r],e[r+1],n);return s[r](i)};return n?t=>l(Cd(e[0],e[a-1],t)):l}function Kp(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Md(0,t,r);e.push(fp(n,1,i))}}function qp(e){let t=[0];return Kp(t,e.length-1),t}function Jp(e,t){return e.map(e=>e*t)}function Yp(e,t){return e.map(()=>t||$d).splice(0,e.length-1)}function Xp({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ef(r)?r.map(af):af(r),a={done:!1,value:t[0]},o=tee(Jp(n&&n.length===t.length?n:qp(t),e),t,{ease:Array.isArray(i)?i:Yp(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var nee=e=>e!==null;function Zp(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(nee),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Qp={decay:Gp,inertia:Gp,tween:Xp,keyframes:Xp,spring:Hp};function $p(e){typeof e.type==`string`&&(e.type=Qp[e.type])}var em=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)}},tm=e=>e/100,nm=class extends em{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!==_f.now()&&this.tick(_f.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},vf.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;$p(e);let{type:t=Xp,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Xp;s!==Xp&&typeof o[0]!=`number`&&(this.mixKeyframes=jd(tm,Ep(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=Ap(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=Cd(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!==Gp&&(b.value=Zp(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 Fd(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Fd(e)}get time(){return Fd(this.currentTime)}set time(e){e=Pd(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 Wp(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(_f.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Fd(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Dp,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(_f.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,vf.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 rm(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var im=e=>e*180/Math.PI,am=e=>om(im(Math.atan2(e[1],e[0]))),ree={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:am,rotateZ:am,skewX:e=>im(Math.atan(e[1])),skewY:e=>im(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},om=e=>(e%=360,e<0&&(e+=360),e),sm=am,cm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),lm=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),um={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:cm,scaleY:lm,scale:e=>(cm(e)+lm(e))/2,rotateX:e=>om(im(Math.atan2(e[6],e[5]))),rotateY:e=>om(im(Math.atan2(-e[2],e[0]))),rotateZ:sm,rotate:sm,skewX:e=>im(Math.atan(e[4])),skewY:e=>im(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function dm(e){return+!!e.includes(`scale`)}function fm(e,t){if(!e||e===`none`)return dm(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=um,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=ree,i=t}if(!i)return dm(t);let a=r[t],o=i[1].split(`,`).map(mm);return typeof a==`function`?a(o):o[a]}var pm=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return fm(n,t)};function mm(e){return parseFloat(e.trim())}var hm=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],gm=new Set(hm),_m=e=>e===Tf||e===q,vm=new Set([`x`,`y`,`z`]),ym=hm.filter(e=>!vm.has(e));function bm(e){let t=[];return ym.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var xm={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})=>fm(t,`x`),y:(e,{transform:t})=>fm(t,`y`)};xm.translateX=xm.x,xm.translateY=xm.y;var Sm=new Set,Cm=!1,wm=!1,Tm=!1;function Em(){if(wm){let e=Array.from(Sm).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=bm(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)})}wm=!1,Cm=!1,Sm.forEach(e=>e.complete(Tm)),Sm.clear()}function Dm(){Sm.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(wm=!0)})}function Om(){Tm=!0,Dm(),Em(),Tm=!1}var km=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?(Sm.add(this),Cm||(Cm=!0,df.read(Dm),df.resolveKeyframes(Em))):(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])}rm(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Sm.delete(this)}cancel(){this.state===`scheduled`&&(Sm.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Am=e=>e.startsWith(`--`);function jm(e,t,n){Am(t)?e.style.setProperty(t,n):e.style[t]=n}var Mm={};function Nm(e,t){let n=Od(e);return()=>Mm[t]??n()}var Pm=Nm(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Fm=Nm(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Im=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Lm={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Im([0,.65,.55,1]),circOut:Im([.55,0,1,.45]),backIn:Im([.31,.01,.66,-.59]),backOut:Im([.33,1.53,.69,.99])};function Rm(e,t){if(e)return typeof e==`function`?Fm()?Op(e,t):`ease-out`:tf(e)?Im(e):Array.isArray(e)?e.map(e=>Rm(e,t)||Lm.easeOut):Lm[e]}function zm(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=Rm(s,i);Array.isArray(d)&&(u.easing=d),sf.value&&vf.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 sf.value&&p.finished.finally(()=>{vf.waapi--}),p}function Bm(e){return typeof e==`function`&&`applyToOptions`in e}function Vm({type:e,...t}){return Bm(e)&&Fm()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Hm=class extends em{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=Vm(e);this.animation=zm(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Zp(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),jm(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 Fd(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Fd(e)}get time(){return Fd(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Pd(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&&Pm()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),kd):r(this)}},Um={anticipate:qd,backInOut:Kd,circInOut:Xd};function Wm(e){return e in Um}function iee(e){typeof e.ease==`string`&&Wm(e.ease)&&(e.ease=Um[e.ease])}var Gm=10,aee=class extends Hm{constructor(e){iee(e),$p(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 nm({...a,autoplay:!1}),s=Math.max(Gm,_f.now()-this.startTime),c=Cd(0,Gm,s-Gm),l=o.sample(s).value,{name:u}=this.options;i&&u&&jm(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},Km=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(cp.test(e)||e===`0`)&&!e.startsWith(`url(`));function oee(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 see(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=Km(i,t),s=Km(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:oee(e)||(n===`spring`||Bm(n))&&r}function qm(e){e.duration=0,e.type=`keyframes`}var Jm=new Set([`opacity`,`clipPath`,`filter`,`transform`]),cee=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function lee(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&cee.test(e[t]))return!0;return!1}var uee=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),Ym=Od(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Xm(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 Ym()&&n&&(Jm.has(n)||uee.has(n)&&lee(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Zm=40,Qm=class extends em{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=_f.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||km)(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=_f.now();let u=!0;see(e,i,a,o)||(u=!1,(wd.instantAnimations||!s)&&l?.(Zp(e,n,t)),e[0]=e[e.length-1],qm(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Zm?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Xm(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new aee({...d,element:p})}catch{m=new nm(d)}else m=new nm(d);m.finished.then(()=>{this.notifyFinished()}).catch(kd),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(),Om()),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 $m(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 eh=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function th(e){let t=eh.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function nh(e,t,n=1){`${e}`;let[r,i]=th(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Td(e)?parseFloat(e):e}return Sf(i)?nh(i,t,n+1):i}var rh={type:`spring`,stiffness:500,damping:25,restSpeed:10},ih=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ah={type:`keyframes`,duration:.8},oh={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},sh=(e,{keyframes:t})=>t.length>2?ah:gm.has(e)?e.startsWith(`scale`)?ih(t[1]):rh:oh;function ch(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function lh(e,t){let n=e?.[t]??e?.default??e;return n===e?n:ch(n,e)}var uh=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function dh(e){for(let t in e)if(!uh.has(t))return!0;return!1}var fh=(e,t,n,r={},i,a)=>o=>{let s=lh(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Pd(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};dh(s)||Object.assign(u,sh(e,u)),u.duration&&=Pd(u.duration),u.repeatDelay&&=Pd(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(qm(u),u.delay===0&&(d=!0)),(wd.instantAnimations||wd.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,qm(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Zp(u.keyframes,s);if(e!==void 0){df.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new nm(u):new Qm(u)};function ph(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function mh(e,t,n,r){if(typeof t==`function`){let[i,a]=ph(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]=ph(r);t=t(n===void 0?e.custom:n,i,a)}return t}function hh(e,t,n){let r=e.getProps();return mh(r,t,n===void 0?r.custom:n,e)}var gh=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...hm]),_h=30,vh=e=>!isNaN(parseFloat(e)),yh={current:void 0},bh=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=_f.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=_f.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=vh(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 Nd);let n=this.events[e].add(t);return e===`change`?()=>{n(),df.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 yh.current&&yh.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=_f.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>_h)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,_h);return Id(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 xh(e,t){return new bh(e,t)}var Sh=e=>Array.isArray(e);function Ch(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,xh(n))}function wh(e){return Sh(e)?e[e.length-1]||0:e}function Th(e,t){let{transitionEnd:n={},transition:r={},...i}=hh(e,t)||{};i={...i,...n};for(let t in i)Ch(e,t,wh(i[t]))}var Eh=e=>!!(e&&e.getVelocity);function Dh(e){return!!(Eh(e)&&e.add)}function Oh(e,t){let n=e.getValue(`willChange`);if(Dh(n))return n.add(t);if(!n&&wd.WillChange){let n=new wd.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function kh(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Ah=`data-`+kh(`framerAppearId`);function jh(e){return e.props[Ah]}function Mh({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Nh(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?ch(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&&Mh(d,t))continue;let o={delay:n,...lh(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){df.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=jh(e);if(n){let e=window.MotionHandoffAnimation(n,t,df);e!==null&&(o.startTime=e,f=!0)}}Oh(e,t);let p=l??e.shouldReduceMotion;r.start(fh(t,r,i,p&&gh.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>df.update(()=>{o&&Th(e,o)});u.length?Promise.all(u).then(t):t()}return u}function Ph(e,t,n={}){let r=hh(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(Nh(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Fh(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 Fh(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(Ph(c,t,{...o,delay:n+(typeof r==`function`?0:r)+$m(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Ih(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Ph(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Ph(e,t,n);else{let i=typeof t==`function`?hh(e,t,n.custom):t;r=Promise.all(Nh(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var dee={test:e=>e===`auto`,parse:e=>e},Lh=e=>t=>t.test(e),Rh=[Tf,q,Vf,Bf,Uf,Hf,dee],zh=e=>Rh.find(Lh(e));function fee(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Dd(e)}var pee=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function mee(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(kf)||[];if(!r)return e;let i=n.replace(r,``),a=+!!pee.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var hee=/\b([a-z-]*)\(.*?\)/gu,Bh={...cp,getAnimatableNone:e=>{let t=e.match(hee);return t?t.map(mee).join(` `):e}},Vh={...cp,getAnimatableNone:e=>{let t=cp.parse(e);return cp.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Hh={...Tf,transform:Math.round},Uh={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,inset:q,insetBlock:q,insetBlockStart:q,insetBlockEnd:q,insetInline:q,insetInlineStart:q,insetInlineEnd:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,paddingBlock:q,paddingBlockStart:q,paddingBlockEnd:q,paddingInline:q,paddingInlineStart:q,paddingInlineEnd:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,marginBlock:q,marginBlockStart:q,marginBlockEnd:q,marginInline:q,marginInlineStart:q,marginInlineEnd:q,fontSize:q,backgroundPositionX:q,backgroundPositionY:q,rotate:Bf,rotateX:Bf,rotateY:Bf,rotateZ:Bf,scale:Df,scaleX:Df,scaleY:Df,scaleZ:Df,skew:Bf,skewX:Bf,skewY:Bf,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Ef,originX:Wf,originY:Wf,originZ:q,zIndex:Hh,fillOpacity:Ef,strokeOpacity:Ef,numOctaves:Hh},gee={...Uh,color:Kf,backgroundColor:Kf,outlineColor:Kf,fill:Kf,stroke:Kf,borderColor:Kf,borderTopColor:Kf,borderRightColor:Kf,borderBottomColor:Kf,borderLeftColor:Kf,filter:Bh,WebkitFilter:Bh,mask:Vh,WebkitMask:Vh},Wh=e=>gee[e],_ee=new Set([Bh,Vh]);function Gh(e,t){let n=Wh(e);return _ee.has(n)||(n=cp),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var vee=new Set([`auto`,`none`,`0`]);function yee(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!vee.has(t)&&tp(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Gh(n,i)}var bee=class extends km{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(),Sf(r))){let i=nh(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!gh.has(n)||e.length!==2)return;let[r,i]=e,a=zh(r),o=zh(i);if(wf(r)!==wf(i)&&xm[n]){this.needsMeasurement=!0;return}if(a!==o)if(_m(a)&&_m(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else xm[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||fee(e[t]))&&n.push(t);n.length&&yee(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=xm[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]=xm[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 Kh(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 qh=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Jh(e){return Ed(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Yh,cancel:xee}=uf(queueMicrotask,!1),Xh={x:!1,y:!1};function Zh(){return Xh.x||Xh.y}function Qh(e){return e===`x`||e===`y`?Xh[e]?null:(Xh[e]=!0,()=>{Xh[e]=!1}):Xh.x||Xh.y?null:(Xh.x=Xh.y=!0,()=>{Xh.x=Xh.y=!1})}function $h(e,t){let n=Kh(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function eg(e){return!(e.pointerType===`touch`||Zh())}function tg(e,t,n={}){let[r,i,a]=$h(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(!eg(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 ng=(e,t)=>t?e===t?!0:ng(e,t.parentElement):!1,rg=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,ig=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function ag(e){return ig.has(e.tagName)||e.isContentEditable===!0}var og=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function sg(e){return og.has(e.tagName)||e.isContentEditable===!0}var cg=new WeakSet;function lg(e){return t=>{t.key===`Enter`&&e(t)}}function ug(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var dg=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=lg(()=>{if(cg.has(n))return;ug(n,`down`);let e=lg(()=>{ug(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>ug(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function fg(e){return rg(e)&&!Zh()}var pg=new WeakSet;function mg(e,t,n={}){let[r,i,a]=$h(e,n),o=e=>{let r=e.currentTarget;if(!fg(e)||pg.has(e))return;cg.add(r),n.stopPropagation&&pg.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),cg.has(r)&&cg.delete(r),fg(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||ng(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),Jh(e)&&(e.addEventListener(`focus`,e=>dg(e,i)),!ag(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function hg(e){return Ed(e)&&`ownerSVGElement`in e}var gg=new WeakMap,_g,vg=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:hg(r)&&`getBBox`in r?r.getBBox()[t]:r[n],yg=vg(`inline`,`width`,`offsetWidth`),bg=vg(`block`,`height`,`offsetHeight`);function xg({target:e,borderBoxSize:t}){gg.get(e)?.forEach(n=>{n(e,{get width(){return yg(e,t)},get height(){return bg(e,t)}})})}function Sg(e){e.forEach(xg)}function Cg(){typeof ResizeObserver>`u`||(_g=new ResizeObserver(Sg))}function wg(e,t){_g||Cg();let n=Kh(e);return n.forEach(e=>{let n=gg.get(e);n||(n=new Set,gg.set(e,n)),n.add(t),_g?.observe(e)}),()=>{n.forEach(e=>{let n=gg.get(e);n?.delete(t),n?.size||_g?.unobserve(e)})}}var Tg=new Set,Eg;function Dg(){Eg=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Tg.forEach(t=>t(e))},window.addEventListener(`resize`,Eg)}function Og(e){return Tg.add(e),Eg||Dg(),()=>{Tg.delete(e),!Tg.size&&typeof Eg==`function`&&(window.removeEventListener(`resize`,Eg),Eg=void 0)}}function kg(e,t){return typeof e==`function`?Og(e):wg(e,t)}function Ag(e){return hg(e)&&e.tagName===`svg`}var jg=[...Rh,Kf,cp],Mg=e=>jg.find(Lh(e)),Ng=()=>({translate:0,scale:1,origin:0,originPoint:0}),Pg=()=>({x:Ng(),y:Ng()}),Fg=()=>({min:0,max:0}),Ig=()=>({x:Fg(),y:Fg()}),Lg=new WeakMap;function Rg(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function zg(e){return typeof e==`string`||Array.isArray(e)}var Bg=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Vg=[`initial`,...Bg];function Hg(e){return Rg(e.animate)||Vg.some(t=>zg(e[t]))}function Ug(e){return!!(Hg(e)||e.variants)}function Wg(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Eh(i))e.addValue(r,i);else if(Eh(a))e.addValue(r,xh(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,xh(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Gg={current:null},Kg={current:!1},qg=typeof window<`u`;function Jg(){if(Kg.current=!0,qg)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Gg.current=e.matches;e.addEventListener(`change`,t),t()}else Gg.current=!1}var Yg=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Xg={};function Zg(e){Xg=e}function Qg(){return Xg}var $g=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=km,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=_f.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,df.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=Hg(t),this.isVariantNode=Ug(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&&Eh(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,Lg.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:(Kg.current||Jg(),this.shouldReduceMotion=Gg.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(),ff(this.notifyUpdate),ff(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&&Jm.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Hm({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Pd(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=gm.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&df.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 Xg){let t=Xg[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):Ig()}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<Yg.length;t++){let n=Yg[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=Wg(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=xh(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`&&(Td(n)||Dd(n))?n=parseFloat(n):!Mg(n)&&cp.test(t)&&(n=Gh(e,t)),this.setBaseTarget(e,Eh(n)?n.get():n)),Eh(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=mh(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&&!Eh(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 Nd),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Yh.render(this.render)}},e_=class extends $g{constructor(){super(...arguments),this.KeyframeResolver=bee}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;Eh(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},t_=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function n_({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function r_({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function i_(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 a_(e){return e===void 0||e===1}function o_({scale:e,scaleX:t,scaleY:n}){return!a_(e)||!a_(t)||!a_(n)}function s_(e){return o_(e)||c_(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function c_(e){return l_(e.x)||l_(e.y)}function l_(e){return e&&e!==`0%`}function u_(e,t,n){return n+t*(e-n)}function d_(e,t,n,r,i){return i!==void 0&&(e=u_(e,i,r)),u_(e,n,r)+t}function f_(e,t=0,n=1,r,i){e.min=d_(e.min,t,n,r,i),e.max=d_(e.max,t,n,r,i)}function p_(e,{x:t,y:n}){f_(e.x,t.translate,t.scale,t.originPoint),f_(e.y,n.translate,n.scale,n.originPoint)}var m_=.999999999999,h_=1.0000000000001;function See(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&&(g_(e.x,-a.scroll.offset.x),g_(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,p_(e,o)),r&&s_(a.latestValues)&&y_(e,a.latestValues,a.layout?.layoutBox))}t.x<h_&&t.x>m_&&(t.x=1),t.y<h_&&t.y>m_&&(t.y=1)}function g_(e,t){e.min+=t,e.max+=t}function __(e,t,n,r,i=.5){f_(e,t,n,fp(e.min,e.max,i),r)}function v_(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function y_(e,t,n){let r=n??e;__(e.x,v_(t.x,r.x),t.scaleX,t.scale,t.originX),__(e.y,v_(t.y,r.y),t.scaleY,t.scale,t.originY)}function b_(e,t){return n_(i_(e.getBoundingClientRect(),t))}function Cee(e,t,n){let r=b_(e,n),{scroll:i}=t;return i&&(g_(r.x,i.offset.x),g_(r.y,i.offset.y)),r}var wee={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Tee=hm.length;function Eee(e,t,n){let r=``,i=!0;for(let a=0;a<Tee;a++){let o=hm[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=qh(s,Uh[o]);if(!c){i=!1;let t=wee[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function x_(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(gm.has(e)){o=!0;continue}else if(bf(e)){i[e]=n;continue}else{let t=qh(n,Uh[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Eee(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 S_(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 C_(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var w_={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(q.test(e))e=parseFloat(e);else return e;return`${C_(e,t.target.x)}% ${C_(e,t.target.y)}%`}},Dee={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=cp.parse(e);if(i.length>5)return r;let a=cp.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=fp(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},T_={borderRadius:{...w_,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:w_,borderTopRightRadius:w_,borderBottomLeftRadius:w_,borderBottomRightRadius:w_,boxShadow:Dee};function E_(e,{layout:t,layoutId:n}){return gm.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!T_[e]||e===`opacity`)}function D_(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Eh(r[t])||i&&Eh(i[t])||E_(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Oee(e){return window.getComputedStyle(e)}var kee=class extends e_{constructor(){super(...arguments),this.type=`html`,this.renderInstance=S_}readValueFromInstance(e,t){if(gm.has(t))return this.projection?.isProjecting?dm(t):pm(e,t);{let n=Oee(e),r=(bf(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return b_(e,t)}build(e,t,n){x_(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return D_(e,t,n)}},Aee={offset:`stroke-dashoffset`,array:`stroke-dasharray`},jee={offset:`strokeDashoffset`,array:`strokeDasharray`};function Mee(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Aee:jee;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Nee=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function O_(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(x_(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 Nee)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&&Mee(d,i,a,o,!1)}var k_=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`]),A_=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Pee(e,t,n,r){S_(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(k_.has(n)?n:kh(n),t.attrs[n])}function j_(e,t,n){let r=D_(e,t,n);for(let n in e)if(Eh(e[n])||Eh(t[n])){let t=hm.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var M_=class extends e_{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Ig}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(gm.has(t)){let e=Wh(t);return e&&e.default||0}return t=k_.has(t)?t:kh(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return j_(e,t,n)}build(e,t,n){O_(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Pee(e,t,n,r)}mount(e){this.isSVGTag=A_(e.tagName),super.mount(e)}},N_=Vg.length;function P_(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&P_(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<N_;n++){let r=Vg[n],i=e.props[r];(zg(i)||i===!1)&&(t[r]=i)}return t}function F_(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 I_=[...Bg].reverse(),L_=Bg.length;function R_(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Ih(e,t,n)))}function z_(e){let t=R_(e),n=H_(),r=!0,i=!1,a=t=>(n,r)=>{let i=hh(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=P_(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<L_;t++){let p=I_[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=zg(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||Rg(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=B_(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=Sh(t)&&Sh(n)?!F_(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=hh(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=$m(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=hh(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=H_(),i=!0}}}function B_(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!F_(t,e):!1}function V_(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function H_(){return{animate:V_(!0),whileInView:V_(),whileHover:V_(),whileTap:V_(),whileDrag:V_(),whileFocus:V_(),exit:V_()}}function U_(e,t){e.min=t.min,e.max=t.max}function W_(e,t){U_(e.x,t.x),U_(e.y,t.y)}function G_(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var K_=1e-4,q_=1-K_,J_=1+K_,Y_=.01,X_=0-Y_,Z_=0+Y_;function Q_(e){return e.max-e.min}function $_(e,t,n){return Math.abs(e-t)<=n}function ev(e,t,n,r=.5){e.origin=r,e.originPoint=fp(t.min,t.max,e.origin),e.scale=Q_(n)/Q_(t),e.translate=fp(n.min,n.max,e.origin)-e.originPoint,(e.scale>=q_&&e.scale<=J_||isNaN(e.scale))&&(e.scale=1),(e.translate>=X_&&e.translate<=Z_||isNaN(e.translate))&&(e.translate=0)}function tv(e,t,n,r){ev(e.x,t.x,n.x,r?r.originX:void 0),ev(e.y,t.y,n.y,r?r.originY:void 0)}function nv(e,t,n,r=0){e.min=(r?fp(n.min,n.max,r):n.min)+t.min,e.max=e.min+Q_(t)}function rv(e,t,n,r){nv(e.x,t.x,n.x,r?.x),nv(e.y,t.y,n.y,r?.y)}function iv(e,t,n,r=0){let i=r?fp(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Q_(t)}function av(e,t,n,r){iv(e.x,t.x,n.x,r?.x),iv(e.y,t.y,n.y,r?.y)}function ov(e,t,n,r,i){return e-=t,e=u_(e,1/n,r),i!==void 0&&(e=u_(e,1/i,r)),e}function sv(e,t=0,n=1,r=.5,i,a=e,o=e){if(Vf.test(t)&&(t=parseFloat(t),t=fp(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=fp(a.min,a.max,r);e===a&&(s-=t),e.min=ov(e.min,t,n,s,i),e.max=ov(e.max,t,n,s,i)}function cv(e,t,[n,r,i],a,o){sv(e,t[n],t[r],t[i],t.scale,a,o)}var lv=[`x`,`scaleX`,`originX`],uv=[`y`,`scaleY`,`originY`];function dv(e,t,n,r){cv(e.x,t,lv,n?n.x:void 0,r?r.x:void 0),cv(e.y,t,uv,n?n.y:void 0,r?r.y:void 0)}function fv(e){return e.translate===0&&e.scale===1}function pv(e){return fv(e.x)&&fv(e.y)}function mv(e,t){return e.min===t.min&&e.max===t.max}function hv(e,t){return mv(e.x,t.x)&&mv(e.y,t.y)}function gv(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function _v(e,t){return gv(e.x,t.x)&&gv(e.y,t.y)}function vv(e){return Q_(e.x)/Q_(e.y)}function yv(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function bv(e){return[e(`x`),e(`y`)]}function xv(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 Sv=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],Cv=Sv.length,wv=e=>typeof e==`string`?parseFloat(e):e,Tv=e=>typeof e==`number`||q.test(e);function Ev(e,t,n,r,i,a){i?(e.opacity=fp(0,n.opacity??1,Ov(r)),e.opacityExit=fp(t.opacity??1,0,kv(r))):a&&(e.opacity=fp(t.opacity??1,n.opacity??1,r));for(let i=0;i<Cv;i++){let a=Sv[i],o=Dv(t,a),s=Dv(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Tv(o)===Tv(s)?(e[a]=Math.max(fp(wv(o),wv(s),r),0),(Vf.test(s)||Vf.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=fp(t.rotate||0,n.rotate||0,r))}function Dv(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Ov=Av(0,.5,Yd),kv=Av(.5,.95,kd);function Av(e,t,n){return r=>r<e?0:r>t?1:n(Md(e,t,r))}function jv(e,t,n){let r=Eh(e)?e:xh(e);return r.start(fh(``,r,t,n)),r.animation}function Mv(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Nv=(e,t)=>e.depth-t.depth,Pv=class{constructor(){this.children=[],this.isDirty=!1}add(e){xd(this.children,e),this.isDirty=!0}remove(e){Sd(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Nv),this.isDirty=!1,this.children.forEach(e)}};function Fv(e,t){let n=_f.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(ff(r),e(a-t))};return df.setup(r,!0),()=>ff(r)}function Iv(e){return Eh(e)?e.get():e}var Lv=class{constructor(){this.members=[]}add(e){xd(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&&(Sd(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Sd(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)}},Rv={hasAnimatedSinceResize:!0,hasEverUpdated:!1},zv={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Bv=[``,`X`,`Y`,`Z`],Vv=1e3,Hv=0;function Uv(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Wv(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=jh(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,df,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Wv(r)}function Gv({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=Hv++,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,sf.value&&(zv.nodes=zv.calculatedTargetDeltas=zv.calculatedProjections=0),this.nodes.forEach(Jv),this.nodes.forEach(ry),this.nodes.forEach(iy),this.nodes.forEach(Yv),sf.addProjectionMetrics&&sf.addProjectionMetrics(zv)},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 Pv)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Nd),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=hg(t)&&!Ag(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;df.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Fv(i,250),Rv.hasAnimatedSinceResize&&(Rv.hasAnimatedSinceResize=!1,this.nodes.forEach(ny)))})}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()||dy,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!_v(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={...lh(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||ny(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(),ff(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(ay),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&&Wv(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(Qv),this.nodes.forEach(Zv);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach($v);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ey),this.nodes.forEach(ty),this.nodes.forEach(Kv),this.nodes.forEach(qv)):this.nodes.forEach($v),this.clearAllSnapshots();let e=_f.now();pf.delta=Cd(0,1e3/60,e-pf.timestamp),pf.timestamp=e,pf.isProcessing=!0,mf.update.process(pf),mf.preRender.process(pf),mf.render.process(pf),pf.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Yh.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Xv),this.sharedNodes.forEach(oy)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,df.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){df.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Q_(this.snapshot.measuredBox.x)&&!Q_(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||=Ig(),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&&!pv(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||s_(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)),hy(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Ig();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(_y))){let{scroll:e}=this.root;e&&(g_(t.x,e.offset.x),g_(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Ig();if(W_(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&&W_(t,e),g_(t.x,i.offset.x),g_(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Ig();W_(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&&(g_(r.x,-n.scroll.offset.x),g_(r.y,-n.scroll.offset.y)),s_(n.latestValues)&&y_(r,n.latestValues,n.layout?.layoutBox)}return s_(this.latestValues)&&y_(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Ig();W_(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!s_(n.latestValues))continue;let r;n.instance&&(o_(n.latestValues)&&n.updateSnapshot(),r=Ig(),W_(r,n.measurePageBox())),dv(t,n.latestValues,n.snapshot?.layoutBox,r)}return s_(this.latestValues)&&dv(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!==pf.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=pf.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=Ig(),this.targetWithTransforms=Ig()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),rv(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):W_(this.target,this.layout.layoutBox),p_(this.target,this.targetDelta)):W_(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),sf.value&&zv.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||o_(this.parent.latestValues)||c_(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=Ig(),this.relativeTargetOrigin=Ig(),av(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),W_(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===pf.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;W_(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;See(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=Ig());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(G_(this.prevProjectionDelta.x,this.projectionDelta.x),G_(this.prevProjectionDelta.y,this.projectionDelta.y)),tv(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!yv(this.projectionDelta.x,this.prevProjectionDelta.x)||!yv(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),sf.value&&zv.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=Pg(),this.projectionDelta=Pg(),this.projectionDeltaWithTransform=Pg()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=Pg();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=Ig(),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(uy));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;sy(a.x,e.x,n),sy(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(av(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),ly(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&hv(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=Ig(),W_(d,this.relativeTarget)),s&&(this.animationValues=i,Ev(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&&=(ff(this.pendingAnimation),void 0),this.pendingAnimation=df.update(()=>{Rv.hasAnimatedSinceResize=!0,vf.layout++,this.motionValue||=xh(0),this.motionValue.jump(0,!1),this.currentAnimation=jv(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{vf.layout--},onComplete:()=>{vf.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(Vv),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&&gy(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Ig();let t=Q_(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Q_(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}W_(t,n),y_(t,i),tv(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Lv),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&&Uv(`z`,e,r,this.animationValues);for(let t=0;t<Bv.length;t++)Uv(`rotate${Bv[t]}`,e,r,this.animationValues),Uv(`skew${Bv[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=Iv(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=Iv(t?.pointerEvents)||``),this.hasProjected&&!s_(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=xv(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 T_){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=T_[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?Iv(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(Zv),this.root.sharedNodes.clear()}}}function Kv(e){e.updateLayout()}function qv(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`)bv(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Q_(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;U_(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else gy(i,t.layoutBox,n)&&bv(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Q_(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=Pg();tv(o,n,t.layoutBox);let s=Pg();a?tv(s,e.applyTransform(r,!0),t.measuredBox):tv(s,n,t.layoutBox);let c=!pv(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=Ig();av(s,t.layoutBox,i.layoutBox,o);let c=Ig();av(c,n,a.layoutBox,o),_v(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 Jv(e){sf.value&&zv.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 Yv(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Xv(e){e.clearSnapshot()}function Zv(e){e.clearMeasurements()}function Qv(e){e.isLayoutDirty=!0,e.updateLayout()}function $v(e){e.isLayoutDirty=!1}function ey(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function ty(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function ny(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ry(e){e.resolveTargetDelta()}function iy(e){e.calcProjection()}function ay(e){e.resetSkewAndRotation()}function oy(e){e.removeLeadSnapshot()}function sy(e,t,n){e.translate=fp(t.translate,0,n),e.scale=fp(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function cy(e,t,n,r){e.min=fp(t.min,n.min,r),e.max=fp(t.max,n.max,r)}function ly(e,t,n,r){cy(e.x,t.x,n.x,r),cy(e.y,t.y,n.y,r)}function uy(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var dy={duration:.45,ease:[.4,0,.1,1]},fy=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),py=fy(`applewebkit/`)&&!fy(`chrome/`)?Math.round:kd;function my(e){e.min=py(e.min),e.max=py(e.max)}function hy(e){my(e.x),my(e.y)}function gy(e,t,n){return e===`position`||e===`preserve-aspect`&&!$_(vv(t),vv(n),.2)}function _y(e){return e!==e.root&&e.scroll?.wasRoot}var vy=Gv({attachResizeListener:(e,t)=>Mv(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),yy={current:void 0},by=Gv({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!yy.current){let e=new vy({});e.mount(window),e.setOptions({layoutScroll:!0}),yy.current=e}return yy.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),xy=(0,z.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Sy(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Cy(...e){return t=>{let n=!1,r=e.map(e=>{let r=Sy(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():Sy(e[t],null)}}}}function wy(...e){return z.useCallback(Cy(...e),e)}var Ty=class extends z.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Jh(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Jh(e)&&e.offsetWidth||0,r=Jh(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 Ey({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,z.useId)(),s=(0,z.useRef)(null),c=(0,z.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:l}=(0,z.useContext)(xy),u=wy(s,e.props?.ref??e?.ref);return(0,z.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=No(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&ss.assertOptions(n,{silentJSONParsing:cs.transitional(cs.boolean),forcedJSONParsing:cs.transitional(cs.boolean),clarifyTimeoutError:cs.transitional(cs.boolean),legacyInterceptorReqResOrdering:cs.transitional(cs.boolean)},!1),r!=null&&(V.isFunction(r)?t.paramsSerializer={serialize:r}:ss.assertOptions(r,{encode:cs.function,serialize:cs.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),ss.assertOptions(t,{baseUrl:cs.spelling(`baseURL`),withXsrfToken:cs.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&V.merge(i.common,i[t.method]);i&&V.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`common`],e=>{delete i[e]}),t.headers=go.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||Ba;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=[ns.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=ns.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=No(this.defaults,e),Ra(jo(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};V.forEach([`delete`,`get`,`head`,`options`],function(e){ls.prototype[e]=function(t,n){return this.request(No(n||{},{method:e,url:t,data:(n||{}).data}))}}),V.forEach([`post`,`put`,`patch`],function(e){function t(t){return function(n,r,i){return this.request(No(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}ls.prototype[e]=t(),ls.prototype[e+`Form`]=t(!0)});var us=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 yo(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 ds(e){return function(t){return e.apply(null,t)}}function fs(e){return V.isObject(e)&&e.isAxiosError===!0}var ps={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(ps).forEach(([e,t])=>{ps[t]=e});function ms(e){let t=new ls(e),n=_i(ls.prototype.request,t);return V.extend(n,ls.prototype,t,{allOwnKeys:!0}),V.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return ms(No(e,t))},n}var hs=ms(to);hs.Axios=ls,hs.CanceledError=yo,hs.CancelToken=us,hs.isCancel=vo,hs.VERSION=rs,hs.toFormData=Na,hs.AxiosError=H,hs.Cancel=hs.CanceledError,hs.all=function(e){return Promise.all(e)},hs.spread=ds,hs.isAxiosError=fs,hs.mergeConfig=No,hs.AxiosHeaders=go,hs.formToJSON=e=>Qa(V.isHTMLForm(e)?new FormData(e):e),hs.getAdapter=es.getAdapter,hs.HttpStatusCode=ps,hs.default=hs;var gs=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),_s=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),vs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ys=e=>{let t=vs(e);return t.charAt(0).toUpperCase()+t.slice(1)},bs={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`},xs=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ss=(0,z.createContext)({}),Cs=()=>(0,z.useContext)(Ss),ws=(0,z.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=``}=Cs()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,z.createElement)(`svg`,{ref:c,...bs,width:t??l??bs.width,height:t??l??bs.height,stroke:e??f,strokeWidth:m,className:gs(`lucide`,p,i),...!a&&!xs(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,z.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),U=(e,t)=>{let n=(0,z.forwardRef)(({className:n,...r},i)=>(0,z.createElement)(ws,{ref:i,iconNode:t,className:gs(`lucide-${_s(ys(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ys(e),n},Ts=U(`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`}]]),Es=U(`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`}]]),Ds=U(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Os=U(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ks=U(`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`}]]),As=U(`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`}]]),js=U(`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`}]]),Ms=U(`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`}]]),Ns=U(`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`}]]),Ps=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Fs=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Is=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ls=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Rs=U(`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`}]]),zs=U(`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`}]]),Bs=U(`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`}]]),Vs=U(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Hs=U(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Us=U(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ws=U(`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`}]]),Gs=U(`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`}]]),Ks=U(`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`}]]),qs=U(`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`}]]),Js=U(`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`}]]),Ys=U(`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`}]]),Xs=U(`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`}]]),Zs=U(`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`}]]),Qs=U(`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`}]]),$s=U(`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`}]]),ec=U(`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`}]]),tc=U(`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`}]]),nc=U(`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`}]]),rc=U(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ic=U(`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`}]]),ac=U(`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`}]]),oc=U(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),sc=U(`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`}]]),cc=U(`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`}]]),lc=U(`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`}]]),uc=U(`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`}]]),dc=U(`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`}]]),fc=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),pc=U(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),mc=U(`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`}]]),hc=U(`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`}]]),gc=U(`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`}]]),_c=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),vc=U(`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`}]]),yc=U(`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=U(`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`}]]),xc=U(`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`}]]),Sc=U(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Cc=U(`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`}]]),wc=U(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Tc=U(`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`}]]),Ec=U(`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`}]]),Dc=U(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),Oc=U(`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`}]]),kc=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ac=U(`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`}]]),jc=u(y(),1),Mc=u(_(),1),Nc=(0,z.createContext)({toast:()=>{}}),Pc=()=>{};function Fc(e,t=`error`){Pc(e,t)}function Ic({children:e}){let[t,n]=(0,z.useState)([]),r={current:0},i=(0,z.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,z.useEffect)(()=>{Pc=i},[i]);let a={success:zs,error:Bs,warning:Tc},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,B.jsxs)(Nc.Provider,{value:{toast:i},children:[e,(0,Mc.createPortal)((0,B.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,B.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3 rounded-lg border shadow-lg text-sm ${o[e.type]}`,children:[(0,B.jsx)(t,{className:`h-4 w-4 mt-0.5 flex-shrink-0 ${s[e.type]}`}),(0,B.jsx)(`span`,{className:`flex-1`,children:e.message}),(0,B.jsx)(`button`,{onClick:()=>n(t=>t.filter(t=>t.id!==e.id)),children:(0,B.jsx)(kc,{className:`h-3.5 w-3.5 opacity-60 hover:opacity-100`})})]},e.id)})}),document.body)]})}var W=hs.create({baseURL:`/api`,timeout:3e4});W.interceptors.response.use(e=>e,e=>(Fc(e.response?.data?.error||e.response?.data?.message||e.message||`请求失败`,`error`),Promise.reject(e)));var Lc=()=>W.get(`/health`),Rc=()=>W.get(`/config`),zc=e=>W.put(`/config`,e),Bc=()=>W.get(`/config/history`),Vc=e=>W.get(`/sessions`,{params:e}),Hc=e=>W.get(`/sessions/${e}`),Uc=e=>W.delete(`/sessions/${e}`),Wc=e=>W.delete(`/sessions`,{data:{ids:e}}),Gc=e=>W.get(`/events`,{params:e}),Kc=e=>W.get(`/events/stats`,{params:{project_path:e}}),qc=e=>W.get(`/pipelines`,{params:e}),Jc=e=>W.get(`/pipelines/${e}`),Yc=e=>W.get(`/quality/history`,{params:e}),Xc=e=>W.get(`/quality/unresolved`,{params:{project_path:e}}),Zc=()=>W.get(`/stats/roi`),Qc=()=>W.get(`/stats/overview`),$c=(e,t)=>W.get(`/knowledge/search`,{params:{q:e,project_path:t}}),el=e=>W.get(`/knowledge/overview`,{params:{project_path:e}}),tl=(e,t)=>W.get(`/knowledge/neighbors`,{params:{node_id:e,project_path:t}}),nl=e=>W.get(`/knowledge/graph`,{params:{project_path:e}}),rl=e=>W.post(`/knowledge/nodes`,e),il=(e,t)=>W.put(`/knowledge/nodes/${e}`,t),al=e=>W.delete(`/knowledge/nodes/${e}`),ol=e=>W.post(`/pipelines/${e}/close`),sl=e=>W.post(`/pipelines/batch-close`,{ids:e}),cl=()=>W.post(`/pipelines/close-expired`),ll=()=>W.get(`/pipelines/active`),ul=(e,t)=>W.post(`/pipelines/tasks/${e}/status`,{status:t}),dl=e=>W.post(`/pipelines/${e}/resume`),fl=e=>W.get(`/projects`,{params:e}),pl=e=>W.get(`/projects/${e}`),ml=e=>W.delete(`/projects/${e}`),hl=e=>W.get(`/convention/${e}`),gl=(e,t,n,r)=>W.put(`/convention/${e}/${t}`,{name:n,content:r}),_l=(e,t)=>W.delete(`/convention/${e}/${t}`),vl=(e,t)=>W.post(`/convention/${e}/evolve`,{id:t}),yl=e=>W.post(`/convention/init`,{path:e},{timeout:18e4}),bl=e=>W.get(`/claudemd/${e}`),xl=(e,t)=>W.put(`/claudemd/${e}`,{content:t}),Sl=e=>W.get(`/claudemd/${e}/profile`),Cl=e=>W.get(`/claudemd/${e}/modules`),wl=e=>W.post(`/claudemd/${e}/distill`,void 0,{timeout:18e4}),Tl=e=>W.post(`/claudemd/${e}/init`,void 0,{timeout:18e4}),El=e=>W.post(`/quality/${e}/resolve`),Dl=e=>W.post(`/quality/${e}/dismiss`),Ol=()=>W.post(`/quality/resolve-all`),kl=e=>W.post(`/quality/${e}/auto-fix`,{},{timeout:6e4}),Al=()=>W.get(`/daemon/status`),jl=()=>W.post(`/daemon/restart`),Ml=()=>W.get(`/daemon/diagnose`),Nl=()=>W.post(`/daemon/repair`),Pl=()=>W.post(`/config/backup`),Fl=()=>W.get(`/config/backups`),Il=e=>W.post(`/events/purge`,{retentionDays:e}),Ll=e=>W.get(`/stats/api-usage`,{params:{days:e}});function Rl(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=Rl(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function zl(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Rl(e))&&(r&&(r+=` `),r+=t);return r}var Bl=(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},Vl=(e,t)=>({classGroupId:e,validator:t}),Hl=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ul=`-`,Wl=[],Gl=`arbitrary..`,Kl=e=>{let t=Yl(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Jl(e);let n=e.split(Ul);return ql(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Bl(i,t):t:i||Wl}return n[e]||Wl}}},ql=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=ql(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Ul):e.slice(t).join(Ul),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Jl=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?Gl+r:void 0})(),Yl=e=>{let{theme:t,classGroups:n}=e;return Xl(n,t)},Xl=(e,t)=>{let n=Hl();for(let r in e){let i=e[r];Zl(i,n,r,t)}return n},Zl=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Ql(i,t,n,r)}},Ql=(e,t,n,r)=>{if(typeof e==`string`){$l(e,t,n);return}if(typeof e==`function`){eu(e,t,n,r);return}tu(e,t,n,r)},$l=(e,t,n)=>{let r=e===``?t:nu(t,e);r.classGroupId=n},eu=(e,t,n,r)=>{if(ru(e)){Zl(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Vl(n,e))},tu=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Zl(o,nu(t,a),n,r)}},nu=(e,t)=>{let n=e,r=t.split(Ul),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Hl(),n.nextPart.set(t,i)),n=i}return n},ru=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,iu=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)}}},au=`!`,ou=`:`,su=[],cu=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),lu=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===ou){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(au)?(c=s.slice(0,-1),l=!0):s.startsWith(au)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return cu(t,l,c,u)};if(t){let e=t+ou,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):cu(su,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},uu=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}},du=e=>({cache:iu(e.cacheSize),parseClassName:lu(e),sortModifiers:uu(e),...Kl(e)}),fu=/\s+/,pu=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(fu),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+au: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},mu=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=hu(n))&&(i&&(i+=` `),i+=r);return i},hu=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=hu(e[r]))&&(n&&(n+=` `),n+=t);return n},gu=(e,...t)=>{let n,r,i,a,o=o=>(n=du(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=pu(e,n);return i(e,a),a};return a=o,(...e)=>a(mu(...e))},_u=[],vu=e=>{let t=t=>t[e]||_u;return t.isThemeGetter=!0,t},yu=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bu=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xu=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Su=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cu=/\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$/,wu=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Tu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Eu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Du=e=>xu.test(e),Ou=e=>!!e&&!Number.isNaN(Number(e)),ku=e=>!!e&&Number.isInteger(Number(e)),Au=e=>e.endsWith(`%`)&&Ou(e.slice(0,-1)),ju=e=>Su.test(e),Mu=()=>!0,Nu=e=>Cu.test(e)&&!wu.test(e),Pu=()=>!1,Fu=e=>Tu.test(e),Iu=e=>Eu.test(e),Lu=e=>!G(e)&&!K(e),Ru=e=>$u(e,rd,Pu),G=e=>yu.test(e),zu=e=>$u(e,id,Nu),Bu=e=>$u(e,ad,Ou),Vu=e=>$u(e,sd,Mu),Hu=e=>$u(e,od,Pu),Uu=e=>$u(e,td,Pu),Wu=e=>$u(e,nd,Iu),Gu=e=>$u(e,cd,Fu),K=e=>bu.test(e),Ku=e=>ed(e,id),qu=e=>ed(e,od),Ju=e=>ed(e,td),Yu=e=>ed(e,rd),Xu=e=>ed(e,nd),Zu=e=>ed(e,cd,!0),Qu=e=>ed(e,sd,!0),$u=(e,t,n)=>{let r=yu.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ed=(e,t,n=!1)=>{let r=bu.exec(e);return r?r[1]?t(r[1]):n:!1},td=e=>e===`position`||e===`percentage`,nd=e=>e===`image`||e===`url`,rd=e=>e===`length`||e===`size`||e===`bg-size`,id=e=>e===`length`,ad=e=>e===`number`,od=e=>e===`family-name`,sd=e=>e===`number`||e===`weight`,cd=e=>e===`shadow`,ld=gu(()=>{let e=vu(`color`),t=vu(`font`),n=vu(`text`),r=vu(`font-weight`),i=vu(`tracking`),a=vu(`leading`),o=vu(`breakpoint`),s=vu(`container`),c=vu(`spacing`),l=vu(`radius`),u=vu(`shadow`),d=vu(`inset-shadow`),f=vu(`text-shadow`),p=vu(`drop-shadow`),m=vu(`blur`),h=vu(`perspective`),g=vu(`aspect`),_=vu(`ease`),v=vu(`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=()=>[Du,`full`,`auto`,...w()],E=()=>[ku,`none`,`subgrid`,K,G],D=()=>[`auto`,{span:[`full`,ku,K,G]},ku,K,G],O=()=>[ku,`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=()=>[Du,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[Du,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],P=()=>[Du,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,K,G],I=()=>[...b(),Ju,Uu,{position:[K,G]}],L=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],te=()=>[`auto`,`cover`,`contain`,Yu,Ru,{size:[K,G]}],ne=()=>[Au,Ku,zu],re=()=>[``,`none`,`full`,l,K,G],R=()=>[``,Ou,Ku,zu],ie=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],oe=()=>[Ou,Au,Ju,Uu],se=()=>[``,`none`,m,K,G],ce=()=>[`none`,Ou,K,G],le=()=>[`none`,Ou,K,G],ue=()=>[Ou,K,G],de=()=>[Du,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[ju],breakpoint:[ju],color:[Mu],container:[ju],"drop-shadow":[ju],ease:[`in`,`out`,`in-out`],font:[Lu],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[ju],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[ju],shadow:[ju],spacing:[`px`,Ou],text:[ju],"text-shadow":[ju],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Du,G,K,g]}],container:[`container`],columns:[{columns:[Ou,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:[ku,`auto`,K,G]}],basis:[{basis:[Du,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Ou,Du,`auto`,`initial`,`none`,G]}],grow:[{grow:[``,Ou,K,G]}],shrink:[{shrink:[``,Ou,K,G]}],order:[{order:[ku,`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`,...P()]}],"min-block-size":[{"min-block":[`auto`,...P()]}],"max-block-size":[{"max-block":[`none`,...P()]}],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,Ku,zu]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Qu,Vu]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Au,G]}],"font-family":[{font:[qu,Hu,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":[Ou,`none`,K,Bu]}],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:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ie(),`wavy`]}],"text-decoration-thickness":[{decoration:[Ou,`from-font`,`auto`,K,zu]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Ou,`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:I()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:te()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ku,K,G],radial:[``,K,G],conic:[ku,K,G]},Xu,Wu]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ie(),`hidden`,`none`]}],"divide-style":[{divide:[...ie(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ie(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Ou,K,G]}],"outline-w":[{outline:[``,Ou,Ku,zu]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,Zu,Gu]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,Zu,Gu]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Ou,zu]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,Zu,Gu]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Ou,K,G]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"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":[Ou]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[K,G]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":[Ou]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,K,G]}],filter:[{filter:[``,`none`,K,G]}],blur:[{blur:se()}],brightness:[{brightness:[Ou,K,G]}],contrast:[{contrast:[Ou,K,G]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Zu,Gu]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,Ou,K,G]}],"hue-rotate":[{"hue-rotate":[Ou,K,G]}],invert:[{invert:[``,Ou,K,G]}],saturate:[{saturate:[Ou,K,G]}],sepia:[{sepia:[``,Ou,K,G]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,K,G]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[Ou,K,G]}],"backdrop-contrast":[{"backdrop-contrast":[Ou,K,G]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Ou,K,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ou,K,G]}],"backdrop-invert":[{"backdrop-invert":[``,Ou,K,G]}],"backdrop-opacity":[{"backdrop-opacity":[Ou,K,G]}],"backdrop-saturate":[{"backdrop-saturate":[Ou,K,G]}],"backdrop-sepia":[{"backdrop-sepia":[``,Ou,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:[Ou,`initial`,K,G]}],ease:[{ease:[`linear`,`initial`,_,K,G]}],delay:[{delay:[Ou,K,G]}],animate:[{animate:[`none`,v,K,G]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,K,G]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":[`scale-3d`],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[K,G,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":[`translate-none`],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"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`,...F()]}],"stroke-w":[{stroke:[Ou,Ku,zu,Bu]}],stroke:[{stroke:[`none`,...F()]}],"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 ud(...e){return ld(zl(e))}function dd(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 fd(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 pd(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 md(e){return e?e.endsWith(`Z`)||/[+-]\d{2}:\d{2}$/.test(e)?new Date(e):new Date(e+`Z`):new Date}var hd=[{path:`/dashboard`,label:`仪表盘`,icon:ic},{path:`/projects`,label:`项目管理`,icon:$s},{path:`/sessions`,label:`会话管理`,icon:Ts},{path:`/events`,label:`事件流`,icon:Ms},{path:`/pipelines`,label:`流水线`,icon:tc},{path:`/quality`,label:`质量门禁`,icon:yc},{path:`/knowledge`,label:`知识图谱`,icon:js},{path:`/analytics`,label:`数据分析`,icon:Ns},{path:`/config`,label:`系统配置`,icon:vc}];function gd({children:e}){let[t,n]=(0,z.useState)(()=>localStorage.getItem(`sidebar-collapsed`)===`true`),r=jn();(0,z.useEffect)(()=>{localStorage.setItem(`sidebar-collapsed`,String(t))},[t]);let{data:i}=ct({queryKey:[`health`],queryFn:()=>Lc().then(e=>e.data),refetchInterval:15e3}),a=hd.find(e=>r.pathname.startsWith(e.path));return(0,B.jsxs)(`div`,{className:`flex min-h-screen bg-gray-50`,children:[(0,B.jsxs)(`aside`,{className:ud(`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,B.jsxs)(`div`,{className:ud(`flex items-center border-b border-white/10 h-16`,t?`justify-center px-2`:`justify-between px-5`),children:[!t&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,B.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,B.jsx)(Ac,{className:`h-5 w-5 text-white`})}),(0,B.jsx)(`span`,{className:`text-white font-bold text-lg tracking-tight`,children:`Forge`})]}),(0,B.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,B.jsx)(oc,{className:`h-5 w-5`}):(0,B.jsx)(Is,{className:`h-5 w-5`})})]}),(0,B.jsx)(`nav`,{className:`flex-1 py-4 space-y-1 px-2`,children:hd.map(e=>(0,B.jsxs)(ei,{to:e.path,className:({isActive:e})=>ud(`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,B.jsx)(e.icon,{className:`h-5 w-5 flex-shrink-0`}),!t&&(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:e.label})]},e.path))}),(0,B.jsx)(`div`,{className:ud(`border-t border-white/10 py-4`,t?`px-2`:`px-5`),children:(0,B.jsxs)(`div`,{className:ud(`flex items-center gap-2`,t?`justify-center`:``),children:[(0,B.jsx)(`div`,{className:ud(`w-2 h-2 rounded-full`,i?.status===`ok`?`bg-green-400 animate-pulse`:`bg-red-400`)}),!t&&(0,B.jsx)(`span`,{className:`text-xs text-white/40`,children:i?.status===`ok`?`Daemon 运行中`:`连接断开`})]})})]}),(0,B.jsxs)(`main`,{className:ud(`flex-1 transition-all duration-300`,t?`ml-16`:`ml-60`),children:[(0,B.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,B.jsx)(`h1`,{className:`text-xl font-semibold text-gray-900`,children:a?.label||`Claude Forge`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.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,B.jsx)(Ws,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:`命令面板`}),(0,B.jsx)(`kbd`,{className:`px-2 py-0.5 text-xs bg-gray-100 rounded border border-gray-200`,children:`⌘K`})]}),(0,B.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[`v`,`1.23.3`]}),(0,B.jsxs)(`div`,{className:ud(`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,B.jsx)(`div`,{className:ud(`w-1.5 h-1.5 rounded-full`,i?.status===`ok`?`bg-green-500`:`bg-red-500`)}),i?.status===`ok`?`在线`:`离线`]})]})]}),(0,B.jsx)(`div`,{className:`p-8`,children:e})]})]})}var _d=(0,z.createContext)({});function vd(e){let t=(0,z.useRef)(null);return t.current===null&&(t.current=e()),t.current}var yd=typeof window<`u`?z.useLayoutEffect:z.useEffect,bd=(0,z.createContext)(null);function xd(e,t){e.indexOf(t)===-1&&e.push(t)}function Sd(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Cd=(e,t,n)=>n>t?t:n<e?e:n,wd={},Td=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Ed(e){return typeof e==`object`&&!!e}var Dd=e=>/^0[^.\s]+$/u.test(e);function Od(e){let t;return()=>(t===void 0&&(t=e()),t)}var kd=e=>e,Ad=(e,t)=>n=>t(e(n)),jd=(...e)=>e.reduce(Ad),Md=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Nd=class{constructor(){this.subscriptions=[]}add(e){return xd(this.subscriptions,e),()=>Sd(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}},Pd=e=>e*1e3,Fd=e=>e/1e3;function Id(e,t){return t?1e3/t*e:0}var Ld=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Rd=1e-7,zd=12;function Bd(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Ld(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Rd&&++s<zd);return o}function Vd(e,t,n,r){if(e===t&&n===r)return kd;let i=t=>Bd(t,0,1,e,n);return e=>e===0||e===1?e:Ld(i(e),t,r)}var Hd=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ud=e=>t=>1-e(1-t),Wd=Vd(.33,1.53,.69,.99),Gd=Ud(Wd),Kd=Hd(Gd),qd=e=>e>=1?1:(e*=2)<1?.5*Gd(e):.5*(2-2**(-10*(e-1))),Jd=e=>1-Math.sin(Math.acos(e)),Yd=Ud(Jd),Xd=Hd(Jd),Zd=Vd(.42,0,1,1),Qd=Vd(0,0,.58,1),$d=Vd(.42,0,.58,1),ef=e=>Array.isArray(e)&&typeof e[0]!=`number`,tf=e=>Array.isArray(e)&&typeof e[0]==`number`,nf={linear:kd,easeIn:Zd,easeInOut:$d,easeOut:Qd,circIn:Jd,circInOut:Xd,circOut:Yd,backIn:Gd,backInOut:Kd,backOut:Wd,anticipate:qd},rf=e=>typeof e==`string`,af=e=>{if(tf(e)){e.length;let[t,n,r,i]=e;return Vd(t,n,r,i)}else if(rf(e))return nf[e],`${e}`,nf[e];return e},of=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],sf={value:null,addProjectionMetrics:null};function cf(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&&sf.value&&sf.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var lf=40;function uf(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=of.reduce((e,n)=>(e[n]=cf(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=wd.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,lf),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:of.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<of.length;t++)o[of[t]].cancel(e)},state:i,steps:o}}var{schedule:df,cancel:ff,state:pf,steps:mf}=uf(typeof requestAnimationFrame<`u`?requestAnimationFrame:kd,!0),hf;function gf(){hf=void 0}var _f={now:()=>(hf===void 0&&_f.set(pf.isProcessing||wd.useManualTiming?pf.timestamp:performance.now()),hf),set:e=>{hf=e,queueMicrotask(gf)}},vf={layout:0,mainThread:0,waapi:0},yf=e=>t=>typeof t==`string`&&t.startsWith(e),bf=yf(`--`),xf=yf(`var(--`),Sf=e=>xf(e)?Cf.test(e.split(`/*`)[0].trim()):!1,Cf=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function wf(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Tf={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Ef={...Tf,transform:e=>Cd(0,1,e)},Df={...Tf,default:1},Of=e=>Math.round(e*1e5)/1e5,kf=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Af(e){return e==null}var jf=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Mf=(e,t)=>n=>!!(typeof n==`string`&&jf.test(n)&&n.startsWith(e)||t&&!Af(n)&&Object.prototype.hasOwnProperty.call(n,t)),Nf=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(kf);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Pf=e=>Cd(0,255,e),Ff={...Tf,transform:e=>Math.round(Pf(e))},If={test:Mf(`rgb`,`red`),parse:Nf(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Ff.transform(e)+`, `+Ff.transform(t)+`, `+Ff.transform(n)+`, `+Of(Ef.transform(r))+`)`};function Lf(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 Rf={test:Mf(`#`),parse:Lf,transform:If.transform},zf=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Bf=zf(`deg`),Vf=zf(`%`),q=zf(`px`),Hf=zf(`vh`),Uf=zf(`vw`),Wf={...Vf,parse:e=>Vf.parse(e)/100,transform:e=>Vf.transform(e*100)},Gf={test:Mf(`hsl`,`hue`),parse:Nf(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Vf.transform(Of(t))+`, `+Vf.transform(Of(n))+`, `+Of(Ef.transform(r))+`)`},Kf={test:e=>If.test(e)||Rf.test(e)||Gf.test(e),parse:e=>If.test(e)?If.parse(e):Gf.test(e)?Gf.parse(e):Rf.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?If.transform(e):Gf.transform(e),getAnimatableNone:e=>{let t=Kf.parse(e);return t.alpha=0,Kf.transform(t)}},qf=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Jf(e){return isNaN(e)&&typeof e==`string`&&(e.match(kf)?.length||0)+(e.match(qf)?.length||0)>0}var Yf=`number`,Xf=`color`,Zf=`var`,Qf=`var(`,$f="${}",ep=/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 tp(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(ep,e=>(Kf.test(e)?(r.color.push(a),i.push(Xf),n.push(Kf.parse(e))):e.startsWith(Qf)?(r.var.push(a),i.push(Zf),n.push(e)):(r.number.push(a),i.push(Yf),n.push(parseFloat(e))),++a,$f)).split($f),indexes:r,types:i}}function np(e){return tp(e).values}function rp({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===Yf?i+=Of(r[a]):e===Xf?i+=Kf.transform(r[a]):i+=r[a]}return i}}function ip(e){return rp(tp(e))}var ap=e=>typeof e==`number`?0:Kf.test(e)?Kf.getAnimatableNone(e):e,op=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:ap(e);function sp(e){let t=tp(e);return rp(t)(t.values.map((e,n)=>op(e,t.split[n])))}var cp={test:Jf,parse:np,createTransformer:ip,getAnimatableNone:sp};function lp(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 up({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=lp(s,r,e+1/3),a=lp(s,r,e),o=lp(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function dp(e,t){return n=>n>0?t:e}var fp=(e,t,n)=>e+(t-e)*n,pp=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},mp=[Rf,If,Gf],hp=e=>mp.find(t=>t.test(e));function gp(e){let t=hp(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Gf&&(n=up(n)),n}var _p=(e,t)=>{let n=gp(e),r=gp(t);if(!n||!r)return dp(e,t);let i={...n};return e=>(i.red=pp(n.red,r.red,e),i.green=pp(n.green,r.green,e),i.blue=pp(n.blue,r.blue,e),i.alpha=fp(n.alpha,r.alpha,e),If.transform(i))},vp=new Set([`none`,`hidden`]);function yp(e,t){return vp.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function bp(e,t){return n=>fp(e,t,n)}function xp(e){return typeof e==`number`?bp:typeof e==`string`?Sf(e)?dp:Kf.test(e)?_p:Tp:Array.isArray(e)?Sp:typeof e==`object`?Kf.test(e)?_p:Cp:dp}function Sp(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>xp(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Cp(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=xp(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function wp(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 Tp=(e,t)=>{let n=cp.createTransformer(t),r=tp(e),i=tp(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?vp.has(e)&&!i.values.length||vp.has(t)&&!r.values.length?yp(e,t):jd(Sp(wp(r,i),i.values),n):(`${e}${t}`,dp(e,t))};function Ep(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?fp(e,t,n):xp(e)(e,t)}var Dp=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>df.update(t,e),stop:()=>ff(t),now:()=>pf.isProcessing?pf.timestamp:_f.now()}},Op=(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)})`},kp=2e4;function Ap(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 jp(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Ap(r),kp);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Fd(i)}}var Mp={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 Np(e,t){return e*Math.sqrt(1-t*t)}var Pp=12;function Fp(e,t,n){let r=n;for(let n=1;n<Pp;n++)r-=e(r)/t(r);return r}var Ip=.001;function Lp({duration:e=Mp.duration,bounce:t=Mp.bounce,velocity:n=Mp.velocity,mass:r=Mp.mass}){let i,a;Mp.maxDuration;let o=1-t;o=Cd(Mp.minDamping,Mp.maxDamping,o),e=Cd(Mp.minDuration,Mp.maxDuration,Fd(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Np(t,o),c=Math.exp(-i);return Ip-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=Np(t**2,o);return(-i(t)+Ip>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Ip+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Fp(i,a,s);if(e=Pd(e),isNaN(c))return{stiffness:Mp.stiffness,damping:Mp.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Rp=[`duration`,`bounce`],zp=[`stiffness`,`damping`,`mass`];function Bp(e,t){return t.some(t=>e[t]!==void 0)}function Vp(e){let t={velocity:Mp.velocity,stiffness:Mp.stiffness,damping:Mp.damping,mass:Mp.mass,isResolvedFromDuration:!1,...e};if(!Bp(e,zp)&&Bp(e,Rp))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Cd(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Mp.mass,stiffness:i,damping:a}}else{let n=Lp({...e,velocity:0});t={...t,...n,mass:Mp.mass},t.isResolvedFromDuration=!0}return t}function Hp(e=Mp.visualDuration,t=Mp.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}=Vp({...n,velocity:-Fd(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Fd(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Mp.restSpeed.granular:Mp.restSpeed.default,i||=v?Mp.restDelta.granular:Mp.restDelta.default;let y,b,x,S,C,w;if(h<1)x=Np(_,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=>Pd(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=Pd(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=Pd(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(Ap(T),kp),t=Op(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Hp.applyToOptions=e=>{let t=jp(e,100,Hp);return e.ease=t.ease,e.duration=Pd(t.duration),e.type=`keyframes`,e};var Up=5;function Wp(e,t,n){let r=Math.max(t-Up,0);return Id(n-e(r),t-r)}function Gp({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=Hp({keyframes:[f.value,m(f.value)],velocity:Wp(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 eee(e,t,n){let r=[],i=n||wd.mix||Ep,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=jd(Array.isArray(t)?t[n]||kd:t,a)),r.push(a)}return r}function tee(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=eee(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=Md(e[r],e[r+1],n);return s[r](i)};return n?t=>l(Cd(e[0],e[a-1],t)):l}function Kp(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Md(0,t,r);e.push(fp(n,1,i))}}function qp(e){let t=[0];return Kp(t,e.length-1),t}function Jp(e,t){return e.map(e=>e*t)}function Yp(e,t){return e.map(()=>t||$d).splice(0,e.length-1)}function Xp({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ef(r)?r.map(af):af(r),a={done:!1,value:t[0]},o=tee(Jp(n&&n.length===t.length?n:qp(t),e),t,{ease:Array.isArray(i)?i:Yp(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var nee=e=>e!==null;function Zp(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(nee),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Qp={decay:Gp,inertia:Gp,tween:Xp,keyframes:Xp,spring:Hp};function $p(e){typeof e.type==`string`&&(e.type=Qp[e.type])}var em=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)}},tm=e=>e/100,nm=class extends em{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!==_f.now()&&this.tick(_f.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},vf.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;$p(e);let{type:t=Xp,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Xp;s!==Xp&&typeof o[0]!=`number`&&(this.mixKeyframes=jd(tm,Ep(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=Ap(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=Cd(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!==Gp&&(b.value=Zp(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 Fd(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Fd(e)}get time(){return Fd(this.currentTime)}set time(e){e=Pd(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 Wp(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(_f.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Fd(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Dp,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(_f.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,vf.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 rm(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var im=e=>e*180/Math.PI,am=e=>om(im(Math.atan2(e[1],e[0]))),ree={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:am,rotateZ:am,skewX:e=>im(Math.atan(e[1])),skewY:e=>im(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},om=e=>(e%=360,e<0&&(e+=360),e),sm=am,cm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),lm=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),um={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:cm,scaleY:lm,scale:e=>(cm(e)+lm(e))/2,rotateX:e=>om(im(Math.atan2(e[6],e[5]))),rotateY:e=>om(im(Math.atan2(-e[2],e[0]))),rotateZ:sm,rotate:sm,skewX:e=>im(Math.atan(e[4])),skewY:e=>im(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function dm(e){return+!!e.includes(`scale`)}function fm(e,t){if(!e||e===`none`)return dm(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=um,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=ree,i=t}if(!i)return dm(t);let a=r[t],o=i[1].split(`,`).map(mm);return typeof a==`function`?a(o):o[a]}var pm=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return fm(n,t)};function mm(e){return parseFloat(e.trim())}var hm=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],gm=new Set(hm),_m=e=>e===Tf||e===q,vm=new Set([`x`,`y`,`z`]),ym=hm.filter(e=>!vm.has(e));function bm(e){let t=[];return ym.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var xm={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})=>fm(t,`x`),y:(e,{transform:t})=>fm(t,`y`)};xm.translateX=xm.x,xm.translateY=xm.y;var Sm=new Set,Cm=!1,wm=!1,Tm=!1;function Em(){if(wm){let e=Array.from(Sm).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=bm(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)})}wm=!1,Cm=!1,Sm.forEach(e=>e.complete(Tm)),Sm.clear()}function Dm(){Sm.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(wm=!0)})}function Om(){Tm=!0,Dm(),Em(),Tm=!1}var km=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?(Sm.add(this),Cm||(Cm=!0,df.read(Dm),df.resolveKeyframes(Em))):(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])}rm(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Sm.delete(this)}cancel(){this.state===`scheduled`&&(Sm.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Am=e=>e.startsWith(`--`);function jm(e,t,n){Am(t)?e.style.setProperty(t,n):e.style[t]=n}var Mm={};function Nm(e,t){let n=Od(e);return()=>Mm[t]??n()}var Pm=Nm(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Fm=Nm(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Im=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Lm={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Im([0,.65,.55,1]),circOut:Im([.55,0,1,.45]),backIn:Im([.31,.01,.66,-.59]),backOut:Im([.33,1.53,.69,.99])};function Rm(e,t){if(e)return typeof e==`function`?Fm()?Op(e,t):`ease-out`:tf(e)?Im(e):Array.isArray(e)?e.map(e=>Rm(e,t)||Lm.easeOut):Lm[e]}function zm(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=Rm(s,i);Array.isArray(d)&&(u.easing=d),sf.value&&vf.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 sf.value&&p.finished.finally(()=>{vf.waapi--}),p}function Bm(e){return typeof e==`function`&&`applyToOptions`in e}function Vm({type:e,...t}){return Bm(e)&&Fm()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Hm=class extends em{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=Vm(e);this.animation=zm(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Zp(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),jm(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 Fd(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Fd(e)}get time(){return Fd(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Pd(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&&Pm()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),kd):r(this)}},Um={anticipate:qd,backInOut:Kd,circInOut:Xd};function Wm(e){return e in Um}function iee(e){typeof e.ease==`string`&&Wm(e.ease)&&(e.ease=Um[e.ease])}var Gm=10,aee=class extends Hm{constructor(e){iee(e),$p(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 nm({...a,autoplay:!1}),s=Math.max(Gm,_f.now()-this.startTime),c=Cd(0,Gm,s-Gm),l=o.sample(s).value,{name:u}=this.options;i&&u&&jm(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},Km=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(cp.test(e)||e===`0`)&&!e.startsWith(`url(`));function oee(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 see(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=Km(i,t),s=Km(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:oee(e)||(n===`spring`||Bm(n))&&r}function qm(e){e.duration=0,e.type=`keyframes`}var Jm=new Set([`opacity`,`clipPath`,`filter`,`transform`]),cee=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function lee(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&cee.test(e[t]))return!0;return!1}var uee=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),Ym=Od(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Xm(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 Ym()&&n&&(Jm.has(n)||uee.has(n)&&lee(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Zm=40,Qm=class extends em{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=_f.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||km)(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=_f.now();let u=!0;see(e,i,a,o)||(u=!1,(wd.instantAnimations||!s)&&l?.(Zp(e,n,t)),e[0]=e[e.length-1],qm(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Zm?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Xm(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new aee({...d,element:p})}catch{m=new nm(d)}else m=new nm(d);m.finished.then(()=>{this.notifyFinished()}).catch(kd),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(),Om()),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 $m(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 eh=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function th(e){let t=eh.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function nh(e,t,n=1){`${e}`;let[r,i]=th(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Td(e)?parseFloat(e):e}return Sf(i)?nh(i,t,n+1):i}var rh={type:`spring`,stiffness:500,damping:25,restSpeed:10},ih=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ah={type:`keyframes`,duration:.8},oh={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},sh=(e,{keyframes:t})=>t.length>2?ah:gm.has(e)?e.startsWith(`scale`)?ih(t[1]):rh:oh;function ch(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function lh(e,t){let n=e?.[t]??e?.default??e;return n===e?n:ch(n,e)}var uh=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function dh(e){for(let t in e)if(!uh.has(t))return!0;return!1}var fh=(e,t,n,r={},i,a)=>o=>{let s=lh(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Pd(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};dh(s)||Object.assign(u,sh(e,u)),u.duration&&=Pd(u.duration),u.repeatDelay&&=Pd(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(qm(u),u.delay===0&&(d=!0)),(wd.instantAnimations||wd.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,qm(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Zp(u.keyframes,s);if(e!==void 0){df.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new nm(u):new Qm(u)};function ph(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function mh(e,t,n,r){if(typeof t==`function`){let[i,a]=ph(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]=ph(r);t=t(n===void 0?e.custom:n,i,a)}return t}function hh(e,t,n){let r=e.getProps();return mh(r,t,n===void 0?r.custom:n,e)}var gh=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...hm]),_h=30,vh=e=>!isNaN(parseFloat(e)),yh={current:void 0},bh=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=_f.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=_f.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=vh(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 Nd);let n=this.events[e].add(t);return e===`change`?()=>{n(),df.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 yh.current&&yh.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=_f.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>_h)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,_h);return Id(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 xh(e,t){return new bh(e,t)}var Sh=e=>Array.isArray(e);function Ch(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,xh(n))}function wh(e){return Sh(e)?e[e.length-1]||0:e}function Th(e,t){let{transitionEnd:n={},transition:r={},...i}=hh(e,t)||{};i={...i,...n};for(let t in i)Ch(e,t,wh(i[t]))}var Eh=e=>!!(e&&e.getVelocity);function Dh(e){return!!(Eh(e)&&e.add)}function Oh(e,t){let n=e.getValue(`willChange`);if(Dh(n))return n.add(t);if(!n&&wd.WillChange){let n=new wd.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function kh(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Ah=`data-`+kh(`framerAppearId`);function jh(e){return e.props[Ah]}function Mh({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Nh(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?ch(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&&Mh(d,t))continue;let o={delay:n,...lh(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){df.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=jh(e);if(n){let e=window.MotionHandoffAnimation(n,t,df);e!==null&&(o.startTime=e,f=!0)}}Oh(e,t);let p=l??e.shouldReduceMotion;r.start(fh(t,r,i,p&&gh.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>df.update(()=>{o&&Th(e,o)});u.length?Promise.all(u).then(t):t()}return u}function Ph(e,t,n={}){let r=hh(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(Nh(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Fh(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 Fh(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(Ph(c,t,{...o,delay:n+(typeof r==`function`?0:r)+$m(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Ih(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Ph(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Ph(e,t,n);else{let i=typeof t==`function`?hh(e,t,n.custom):t;r=Promise.all(Nh(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var dee={test:e=>e===`auto`,parse:e=>e},Lh=e=>t=>t.test(e),Rh=[Tf,q,Vf,Bf,Uf,Hf,dee],zh=e=>Rh.find(Lh(e));function fee(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Dd(e)}var pee=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function mee(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(kf)||[];if(!r)return e;let i=n.replace(r,``),a=+!!pee.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var hee=/\b([a-z-]*)\(.*?\)/gu,Bh={...cp,getAnimatableNone:e=>{let t=e.match(hee);return t?t.map(mee).join(` `):e}},Vh={...cp,getAnimatableNone:e=>{let t=cp.parse(e);return cp.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Hh={...Tf,transform:Math.round},Uh={borderWidth:q,borderTopWidth:q,borderRightWidth:q,borderBottomWidth:q,borderLeftWidth:q,borderRadius:q,borderTopLeftRadius:q,borderTopRightRadius:q,borderBottomRightRadius:q,borderBottomLeftRadius:q,width:q,maxWidth:q,height:q,maxHeight:q,top:q,right:q,bottom:q,left:q,inset:q,insetBlock:q,insetBlockStart:q,insetBlockEnd:q,insetInline:q,insetInlineStart:q,insetInlineEnd:q,padding:q,paddingTop:q,paddingRight:q,paddingBottom:q,paddingLeft:q,paddingBlock:q,paddingBlockStart:q,paddingBlockEnd:q,paddingInline:q,paddingInlineStart:q,paddingInlineEnd:q,margin:q,marginTop:q,marginRight:q,marginBottom:q,marginLeft:q,marginBlock:q,marginBlockStart:q,marginBlockEnd:q,marginInline:q,marginInlineStart:q,marginInlineEnd:q,fontSize:q,backgroundPositionX:q,backgroundPositionY:q,rotate:Bf,rotateX:Bf,rotateY:Bf,rotateZ:Bf,scale:Df,scaleX:Df,scaleY:Df,scaleZ:Df,skew:Bf,skewX:Bf,skewY:Bf,distance:q,translateX:q,translateY:q,translateZ:q,x:q,y:q,z:q,perspective:q,transformPerspective:q,opacity:Ef,originX:Wf,originY:Wf,originZ:q,zIndex:Hh,fillOpacity:Ef,strokeOpacity:Ef,numOctaves:Hh},gee={...Uh,color:Kf,backgroundColor:Kf,outlineColor:Kf,fill:Kf,stroke:Kf,borderColor:Kf,borderTopColor:Kf,borderRightColor:Kf,borderBottomColor:Kf,borderLeftColor:Kf,filter:Bh,WebkitFilter:Bh,mask:Vh,WebkitMask:Vh},Wh=e=>gee[e],_ee=new Set([Bh,Vh]);function Gh(e,t){let n=Wh(e);return _ee.has(n)||(n=cp),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var vee=new Set([`auto`,`none`,`0`]);function yee(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!vee.has(t)&&tp(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Gh(n,i)}var bee=class extends km{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(),Sf(r))){let i=nh(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!gh.has(n)||e.length!==2)return;let[r,i]=e,a=zh(r),o=zh(i);if(wf(r)!==wf(i)&&xm[n]){this.needsMeasurement=!0;return}if(a!==o)if(_m(a)&&_m(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else xm[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||fee(e[t]))&&n.push(t);n.length&&yee(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=xm[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]=xm[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 Kh(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 qh=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Jh(e){return Ed(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Yh,cancel:xee}=uf(queueMicrotask,!1),Xh={x:!1,y:!1};function Zh(){return Xh.x||Xh.y}function Qh(e){return e===`x`||e===`y`?Xh[e]?null:(Xh[e]=!0,()=>{Xh[e]=!1}):Xh.x||Xh.y?null:(Xh.x=Xh.y=!0,()=>{Xh.x=Xh.y=!1})}function $h(e,t){let n=Kh(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function eg(e){return!(e.pointerType===`touch`||Zh())}function tg(e,t,n={}){let[r,i,a]=$h(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(!eg(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 ng=(e,t)=>t?e===t?!0:ng(e,t.parentElement):!1,rg=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,ig=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function ag(e){return ig.has(e.tagName)||e.isContentEditable===!0}var og=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function sg(e){return og.has(e.tagName)||e.isContentEditable===!0}var cg=new WeakSet;function lg(e){return t=>{t.key===`Enter`&&e(t)}}function ug(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var dg=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=lg(()=>{if(cg.has(n))return;ug(n,`down`);let e=lg(()=>{ug(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>ug(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function fg(e){return rg(e)&&!Zh()}var pg=new WeakSet;function mg(e,t,n={}){let[r,i,a]=$h(e,n),o=e=>{let r=e.currentTarget;if(!fg(e)||pg.has(e))return;cg.add(r),n.stopPropagation&&pg.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),cg.has(r)&&cg.delete(r),fg(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||ng(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),Jh(e)&&(e.addEventListener(`focus`,e=>dg(e,i)),!ag(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function hg(e){return Ed(e)&&`ownerSVGElement`in e}var gg=new WeakMap,_g,vg=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:hg(r)&&`getBBox`in r?r.getBBox()[t]:r[n],yg=vg(`inline`,`width`,`offsetWidth`),bg=vg(`block`,`height`,`offsetHeight`);function xg({target:e,borderBoxSize:t}){gg.get(e)?.forEach(n=>{n(e,{get width(){return yg(e,t)},get height(){return bg(e,t)}})})}function Sg(e){e.forEach(xg)}function Cg(){typeof ResizeObserver>`u`||(_g=new ResizeObserver(Sg))}function wg(e,t){_g||Cg();let n=Kh(e);return n.forEach(e=>{let n=gg.get(e);n||(n=new Set,gg.set(e,n)),n.add(t),_g?.observe(e)}),()=>{n.forEach(e=>{let n=gg.get(e);n?.delete(t),n?.size||_g?.unobserve(e)})}}var Tg=new Set,Eg;function Dg(){Eg=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Tg.forEach(t=>t(e))},window.addEventListener(`resize`,Eg)}function Og(e){return Tg.add(e),Eg||Dg(),()=>{Tg.delete(e),!Tg.size&&typeof Eg==`function`&&(window.removeEventListener(`resize`,Eg),Eg=void 0)}}function kg(e,t){return typeof e==`function`?Og(e):wg(e,t)}function Ag(e){return hg(e)&&e.tagName===`svg`}var jg=[...Rh,Kf,cp],Mg=e=>jg.find(Lh(e)),Ng=()=>({translate:0,scale:1,origin:0,originPoint:0}),Pg=()=>({x:Ng(),y:Ng()}),Fg=()=>({min:0,max:0}),Ig=()=>({x:Fg(),y:Fg()}),Lg=new WeakMap;function Rg(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function zg(e){return typeof e==`string`||Array.isArray(e)}var Bg=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Vg=[`initial`,...Bg];function Hg(e){return Rg(e.animate)||Vg.some(t=>zg(e[t]))}function Ug(e){return!!(Hg(e)||e.variants)}function Wg(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Eh(i))e.addValue(r,i);else if(Eh(a))e.addValue(r,xh(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,xh(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Gg={current:null},Kg={current:!1},qg=typeof window<`u`;function Jg(){if(Kg.current=!0,qg)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Gg.current=e.matches;e.addEventListener(`change`,t),t()}else Gg.current=!1}var Yg=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Xg={};function Zg(e){Xg=e}function Qg(){return Xg}var $g=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=km,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=_f.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,df.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=Hg(t),this.isVariantNode=Ug(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&&Eh(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,Lg.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:(Kg.current||Jg(),this.shouldReduceMotion=Gg.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(),ff(this.notifyUpdate),ff(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&&Jm.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Hm({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Pd(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=gm.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&df.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 Xg){let t=Xg[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):Ig()}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<Yg.length;t++){let n=Yg[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=Wg(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=xh(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`&&(Td(n)||Dd(n))?n=parseFloat(n):!Mg(n)&&cp.test(t)&&(n=Gh(e,t)),this.setBaseTarget(e,Eh(n)?n.get():n)),Eh(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=mh(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&&!Eh(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 Nd),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Yh.render(this.render)}},e_=class extends $g{constructor(){super(...arguments),this.KeyframeResolver=bee}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;Eh(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},t_=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function n_({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function r_({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function i_(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 a_(e){return e===void 0||e===1}function o_({scale:e,scaleX:t,scaleY:n}){return!a_(e)||!a_(t)||!a_(n)}function s_(e){return o_(e)||c_(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function c_(e){return l_(e.x)||l_(e.y)}function l_(e){return e&&e!==`0%`}function u_(e,t,n){return n+t*(e-n)}function d_(e,t,n,r,i){return i!==void 0&&(e=u_(e,i,r)),u_(e,n,r)+t}function f_(e,t=0,n=1,r,i){e.min=d_(e.min,t,n,r,i),e.max=d_(e.max,t,n,r,i)}function p_(e,{x:t,y:n}){f_(e.x,t.translate,t.scale,t.originPoint),f_(e.y,n.translate,n.scale,n.originPoint)}var m_=.999999999999,h_=1.0000000000001;function See(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&&(g_(e.x,-a.scroll.offset.x),g_(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,p_(e,o)),r&&s_(a.latestValues)&&y_(e,a.latestValues,a.layout?.layoutBox))}t.x<h_&&t.x>m_&&(t.x=1),t.y<h_&&t.y>m_&&(t.y=1)}function g_(e,t){e.min+=t,e.max+=t}function __(e,t,n,r,i=.5){f_(e,t,n,fp(e.min,e.max,i),r)}function v_(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function y_(e,t,n){let r=n??e;__(e.x,v_(t.x,r.x),t.scaleX,t.scale,t.originX),__(e.y,v_(t.y,r.y),t.scaleY,t.scale,t.originY)}function b_(e,t){return n_(i_(e.getBoundingClientRect(),t))}function Cee(e,t,n){let r=b_(e,n),{scroll:i}=t;return i&&(g_(r.x,i.offset.x),g_(r.y,i.offset.y)),r}var wee={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Tee=hm.length;function Eee(e,t,n){let r=``,i=!0;for(let a=0;a<Tee;a++){let o=hm[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=qh(s,Uh[o]);if(!c){i=!1;let t=wee[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function x_(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(gm.has(e)){o=!0;continue}else if(bf(e)){i[e]=n;continue}else{let t=qh(n,Uh[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Eee(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 S_(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 C_(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var w_={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(q.test(e))e=parseFloat(e);else return e;return`${C_(e,t.target.x)}% ${C_(e,t.target.y)}%`}},Dee={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=cp.parse(e);if(i.length>5)return r;let a=cp.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=fp(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},T_={borderRadius:{...w_,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:w_,borderTopRightRadius:w_,borderBottomLeftRadius:w_,borderBottomRightRadius:w_,boxShadow:Dee};function E_(e,{layout:t,layoutId:n}){return gm.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!T_[e]||e===`opacity`)}function D_(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Eh(r[t])||i&&Eh(i[t])||E_(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Oee(e){return window.getComputedStyle(e)}var kee=class extends e_{constructor(){super(...arguments),this.type=`html`,this.renderInstance=S_}readValueFromInstance(e,t){if(gm.has(t))return this.projection?.isProjecting?dm(t):pm(e,t);{let n=Oee(e),r=(bf(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return b_(e,t)}build(e,t,n){x_(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return D_(e,t,n)}},Aee={offset:`stroke-dashoffset`,array:`stroke-dasharray`},jee={offset:`strokeDashoffset`,array:`strokeDasharray`};function Mee(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Aee:jee;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Nee=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function O_(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(x_(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 Nee)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&&Mee(d,i,a,o,!1)}var k_=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`]),A_=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Pee(e,t,n,r){S_(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(k_.has(n)?n:kh(n),t.attrs[n])}function j_(e,t,n){let r=D_(e,t,n);for(let n in e)if(Eh(e[n])||Eh(t[n])){let t=hm.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var M_=class extends e_{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Ig}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(gm.has(t)){let e=Wh(t);return e&&e.default||0}return t=k_.has(t)?t:kh(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return j_(e,t,n)}build(e,t,n){O_(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Pee(e,t,n,r)}mount(e){this.isSVGTag=A_(e.tagName),super.mount(e)}},N_=Vg.length;function P_(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&P_(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<N_;n++){let r=Vg[n],i=e.props[r];(zg(i)||i===!1)&&(t[r]=i)}return t}function F_(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 I_=[...Bg].reverse(),L_=Bg.length;function R_(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Ih(e,t,n)))}function z_(e){let t=R_(e),n=H_(),r=!0,i=!1,a=t=>(n,r)=>{let i=hh(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=P_(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<L_;t++){let p=I_[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=zg(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||Rg(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=B_(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=Sh(t)&&Sh(n)?!F_(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=hh(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=$m(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=hh(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=H_(),i=!0}}}function B_(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!F_(t,e):!1}function V_(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function H_(){return{animate:V_(!0),whileInView:V_(),whileHover:V_(),whileTap:V_(),whileDrag:V_(),whileFocus:V_(),exit:V_()}}function U_(e,t){e.min=t.min,e.max=t.max}function W_(e,t){U_(e.x,t.x),U_(e.y,t.y)}function G_(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var K_=1e-4,q_=1-K_,J_=1+K_,Y_=.01,X_=0-Y_,Z_=0+Y_;function Q_(e){return e.max-e.min}function $_(e,t,n){return Math.abs(e-t)<=n}function ev(e,t,n,r=.5){e.origin=r,e.originPoint=fp(t.min,t.max,e.origin),e.scale=Q_(n)/Q_(t),e.translate=fp(n.min,n.max,e.origin)-e.originPoint,(e.scale>=q_&&e.scale<=J_||isNaN(e.scale))&&(e.scale=1),(e.translate>=X_&&e.translate<=Z_||isNaN(e.translate))&&(e.translate=0)}function tv(e,t,n,r){ev(e.x,t.x,n.x,r?r.originX:void 0),ev(e.y,t.y,n.y,r?r.originY:void 0)}function nv(e,t,n,r=0){e.min=(r?fp(n.min,n.max,r):n.min)+t.min,e.max=e.min+Q_(t)}function rv(e,t,n,r){nv(e.x,t.x,n.x,r?.x),nv(e.y,t.y,n.y,r?.y)}function iv(e,t,n,r=0){let i=r?fp(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Q_(t)}function av(e,t,n,r){iv(e.x,t.x,n.x,r?.x),iv(e.y,t.y,n.y,r?.y)}function ov(e,t,n,r,i){return e-=t,e=u_(e,1/n,r),i!==void 0&&(e=u_(e,1/i,r)),e}function sv(e,t=0,n=1,r=.5,i,a=e,o=e){if(Vf.test(t)&&(t=parseFloat(t),t=fp(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=fp(a.min,a.max,r);e===a&&(s-=t),e.min=ov(e.min,t,n,s,i),e.max=ov(e.max,t,n,s,i)}function cv(e,t,[n,r,i],a,o){sv(e,t[n],t[r],t[i],t.scale,a,o)}var lv=[`x`,`scaleX`,`originX`],uv=[`y`,`scaleY`,`originY`];function dv(e,t,n,r){cv(e.x,t,lv,n?n.x:void 0,r?r.x:void 0),cv(e.y,t,uv,n?n.y:void 0,r?r.y:void 0)}function fv(e){return e.translate===0&&e.scale===1}function pv(e){return fv(e.x)&&fv(e.y)}function mv(e,t){return e.min===t.min&&e.max===t.max}function hv(e,t){return mv(e.x,t.x)&&mv(e.y,t.y)}function gv(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function _v(e,t){return gv(e.x,t.x)&&gv(e.y,t.y)}function vv(e){return Q_(e.x)/Q_(e.y)}function yv(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function bv(e){return[e(`x`),e(`y`)]}function xv(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 Sv=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],Cv=Sv.length,wv=e=>typeof e==`string`?parseFloat(e):e,Tv=e=>typeof e==`number`||q.test(e);function Ev(e,t,n,r,i,a){i?(e.opacity=fp(0,n.opacity??1,Ov(r)),e.opacityExit=fp(t.opacity??1,0,kv(r))):a&&(e.opacity=fp(t.opacity??1,n.opacity??1,r));for(let i=0;i<Cv;i++){let a=Sv[i],o=Dv(t,a),s=Dv(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Tv(o)===Tv(s)?(e[a]=Math.max(fp(wv(o),wv(s),r),0),(Vf.test(s)||Vf.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=fp(t.rotate||0,n.rotate||0,r))}function Dv(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Ov=Av(0,.5,Yd),kv=Av(.5,.95,kd);function Av(e,t,n){return r=>r<e?0:r>t?1:n(Md(e,t,r))}function jv(e,t,n){let r=Eh(e)?e:xh(e);return r.start(fh(``,r,t,n)),r.animation}function Mv(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Nv=(e,t)=>e.depth-t.depth,Pv=class{constructor(){this.children=[],this.isDirty=!1}add(e){xd(this.children,e),this.isDirty=!0}remove(e){Sd(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Nv),this.isDirty=!1,this.children.forEach(e)}};function Fv(e,t){let n=_f.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(ff(r),e(a-t))};return df.setup(r,!0),()=>ff(r)}function Iv(e){return Eh(e)?e.get():e}var Lv=class{constructor(){this.members=[]}add(e){xd(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&&(Sd(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Sd(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)}},Rv={hasAnimatedSinceResize:!0,hasEverUpdated:!1},zv={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Bv=[``,`X`,`Y`,`Z`],Vv=1e3,Hv=0;function Uv(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Wv(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=jh(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,df,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Wv(r)}function Gv({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=Hv++,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,sf.value&&(zv.nodes=zv.calculatedTargetDeltas=zv.calculatedProjections=0),this.nodes.forEach(Jv),this.nodes.forEach(ry),this.nodes.forEach(iy),this.nodes.forEach(Yv),sf.addProjectionMetrics&&sf.addProjectionMetrics(zv)},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 Pv)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Nd),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=hg(t)&&!Ag(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;df.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Fv(i,250),Rv.hasAnimatedSinceResize&&(Rv.hasAnimatedSinceResize=!1,this.nodes.forEach(ny)))})}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()||dy,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!_v(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={...lh(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||ny(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(),ff(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(ay),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&&Wv(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(Qv),this.nodes.forEach(Zv);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach($v);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ey),this.nodes.forEach(ty),this.nodes.forEach(Kv),this.nodes.forEach(qv)):this.nodes.forEach($v),this.clearAllSnapshots();let e=_f.now();pf.delta=Cd(0,1e3/60,e-pf.timestamp),pf.timestamp=e,pf.isProcessing=!0,mf.update.process(pf),mf.preRender.process(pf),mf.render.process(pf),pf.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Yh.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Xv),this.sharedNodes.forEach(oy)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,df.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){df.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Q_(this.snapshot.measuredBox.x)&&!Q_(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||=Ig(),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&&!pv(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||s_(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)),hy(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Ig();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(_y))){let{scroll:e}=this.root;e&&(g_(t.x,e.offset.x),g_(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Ig();if(W_(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&&W_(t,e),g_(t.x,i.offset.x),g_(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Ig();W_(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&&(g_(r.x,-n.scroll.offset.x),g_(r.y,-n.scroll.offset.y)),s_(n.latestValues)&&y_(r,n.latestValues,n.layout?.layoutBox)}return s_(this.latestValues)&&y_(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Ig();W_(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!s_(n.latestValues))continue;let r;n.instance&&(o_(n.latestValues)&&n.updateSnapshot(),r=Ig(),W_(r,n.measurePageBox())),dv(t,n.latestValues,n.snapshot?.layoutBox,r)}return s_(this.latestValues)&&dv(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!==pf.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=pf.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=Ig(),this.targetWithTransforms=Ig()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),rv(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):W_(this.target,this.layout.layoutBox),p_(this.target,this.targetDelta)):W_(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),sf.value&&zv.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||o_(this.parent.latestValues)||c_(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=Ig(),this.relativeTargetOrigin=Ig(),av(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),W_(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===pf.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;W_(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;See(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=Ig());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(G_(this.prevProjectionDelta.x,this.projectionDelta.x),G_(this.prevProjectionDelta.y,this.projectionDelta.y)),tv(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!yv(this.projectionDelta.x,this.prevProjectionDelta.x)||!yv(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),sf.value&&zv.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=Pg(),this.projectionDelta=Pg(),this.projectionDeltaWithTransform=Pg()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=Pg();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=Ig(),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(uy));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;sy(a.x,e.x,n),sy(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(av(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),ly(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&hv(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=Ig(),W_(d,this.relativeTarget)),s&&(this.animationValues=i,Ev(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&&=(ff(this.pendingAnimation),void 0),this.pendingAnimation=df.update(()=>{Rv.hasAnimatedSinceResize=!0,vf.layout++,this.motionValue||=xh(0),this.motionValue.jump(0,!1),this.currentAnimation=jv(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{vf.layout--},onComplete:()=>{vf.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(Vv),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&&gy(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Ig();let t=Q_(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Q_(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}W_(t,n),y_(t,i),tv(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Lv),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&&Uv(`z`,e,r,this.animationValues);for(let t=0;t<Bv.length;t++)Uv(`rotate${Bv[t]}`,e,r,this.animationValues),Uv(`skew${Bv[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=Iv(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=Iv(t?.pointerEvents)||``),this.hasProjected&&!s_(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=xv(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 T_){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=T_[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?Iv(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(Zv),this.root.sharedNodes.clear()}}}function Kv(e){e.updateLayout()}function qv(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`)bv(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Q_(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;U_(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else gy(i,t.layoutBox,n)&&bv(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Q_(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=Pg();tv(o,n,t.layoutBox);let s=Pg();a?tv(s,e.applyTransform(r,!0),t.measuredBox):tv(s,n,t.layoutBox);let c=!pv(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=Ig();av(s,t.layoutBox,i.layoutBox,o);let c=Ig();av(c,n,a.layoutBox,o),_v(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 Jv(e){sf.value&&zv.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 Yv(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Xv(e){e.clearSnapshot()}function Zv(e){e.clearMeasurements()}function Qv(e){e.isLayoutDirty=!0,e.updateLayout()}function $v(e){e.isLayoutDirty=!1}function ey(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function ty(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function ny(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function ry(e){e.resolveTargetDelta()}function iy(e){e.calcProjection()}function ay(e){e.resetSkewAndRotation()}function oy(e){e.removeLeadSnapshot()}function sy(e,t,n){e.translate=fp(t.translate,0,n),e.scale=fp(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function cy(e,t,n,r){e.min=fp(t.min,n.min,r),e.max=fp(t.max,n.max,r)}function ly(e,t,n,r){cy(e.x,t.x,n.x,r),cy(e.y,t.y,n.y,r)}function uy(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var dy={duration:.45,ease:[.4,0,.1,1]},fy=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),py=fy(`applewebkit/`)&&!fy(`chrome/`)?Math.round:kd;function my(e){e.min=py(e.min),e.max=py(e.max)}function hy(e){my(e.x),my(e.y)}function gy(e,t,n){return e===`position`||e===`preserve-aspect`&&!$_(vv(t),vv(n),.2)}function _y(e){return e!==e.root&&e.scroll?.wasRoot}var vy=Gv({attachResizeListener:(e,t)=>Mv(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),yy={current:void 0},by=Gv({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!yy.current){let e=new vy({});e.mount(window),e.setOptions({layoutScroll:!0}),yy.current=e}return yy.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),xy=(0,z.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Sy(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Cy(...e){return t=>{let n=!1,r=e.map(e=>{let r=Sy(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():Sy(e[t],null)}}}}function wy(...e){return z.useCallback(Cy(...e),e)}var Ty=class extends z.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Jh(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Jh(e)&&e.offsetWidth||0,r=Jh(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 Ey({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,z.useId)(),s=(0,z.useRef)(null),c=(0,z.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:l}=(0,z.useContext)(xy),u=wy(s,e.props?.ref??e?.ref);return(0,z.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,11 +64,11 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
64
64
|
`),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 r4({message:e=`加载失败,请重试`,onRetry:t}){return(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-96 text-center px-4`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-center w-16 h-16 rounded-full bg-red-50 mb-4`,children:(0,B.jsx)(Rs,{className:`h-8 w-8 text-red-500`})}),(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 mb-2`,children:`出错了`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mb-6 max-w-md`,children:e}),t&&(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:mc,onClick:t,children:`重试`})]})}function i4(){let e=qe(),[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(`all`),[l,u]=(0,z.useState)(new Set),[d,f]=(0,z.useState)(1),[p,m]=(0,z.useState)(20),[h,g]=(0,z.useState)(`start_time`),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(!1),[x,S]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),C=Pn(),{data:w,isLoading:T,isError:E,refetch:D}=ct({queryKey:[`sessions`,{limit:1e3,status:r||void 0}],queryFn:()=>Vc({limit:1e3,status:r||void 0}).then(e=>e.data),refetchInterval:1e4}),O=lt({mutationFn:e=>Uc(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}}),k=lt({mutationFn:e=>Wc(e),onSuccess:()=>{u(new Set),e.invalidateQueries({queryKey:[`sessions`]})}}),A=(w?.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)>=Z2(new Date,s===`1d`?1:s===`7d`?7:30);return n&&r&&i})||[]).sort((e,t)=>{let n=0;return h===`start_time`?n=e.start_time.localeCompare(t.start_time):h===`event_count`?n=e.event_count-t.event_count:h===`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)),_?n:-n}),j=Array.from(new Set(w?.items.map(e=>e.project_path.split(`/`).pop()||``).filter(Boolean)||[])),M=e=>{h===e?v(e=>!e):(g(e),v(!1)),f(1)},N=()=>{let e=[`Session ID`,`项目`,`状态`,`开始时间`,`结束时间`,`事件数`],t=A.map(e=>[e.session_id,e.project_path,e.status,e.start_time,e.end_time||``,e.event_count]);n4(`sessions-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},ee=Math.ceil(A.length/p),P=A.slice((d-1)*p,d*p);return T?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})}):E?(0,B.jsx)(r4,{message:`会话数据加载失败`,onRetry:()=>D()}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索会话 ID 或项目...`,value:t,onChange:e=>{n(e.target.value),f(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,B.jsxs)(`button`,{onClick:()=>b(e=>!e),className:ud(`flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border transition-colors`,y||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,B.jsx)(ec,{className:`h-4 w-4`}),`筛选`,(r||a||s!==`all`)&&(0,B.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,B.jsx)(Fs,{className:ud(`h-3.5 w-3.5 transition-transform`,y&&`rotate-180`)})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[l.size>0&&(0,B.jsxs)(J,{variant:`danger`,size:`sm`,icon:Cc,onClick:()=>{S({open:!0,title:`批量删除会话`,description:`确定删除选中的 ${l.size} 个会话吗?此操作不可撤销。`,onConfirm:()=>{k.mutate(Array.from(l)),S(e=>({...e,open:!1}))}})},loading:k.isPending,children:[`删除 (`,l.size,`)`]}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:()=>A.length>0&&N(),children:`导出`}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,onClick:()=>D(),children:`刷新`})]})]}),y&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 pt-2 border-t border-gray-100`,children:[(0,B.jsxs)(`select`,{value:r,onChange:e=>{i(e.target.value),f(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,B.jsx)(`option`,{value:``,children:`全部状态`}),(0,B.jsx)(`option`,{value:`active`,children:`活跃`}),(0,B.jsx)(`option`,{value:`completed`,children:`已完成`}),(0,B.jsx)(`option`,{value:`interrupted`,children:`中断`})]}),(0,B.jsxs)(`select`,{value:a,onChange:e=>{o(e.target.value),f(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,B.jsx)(`option`,{value:``,children:`全部项目`}),j.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden text-sm`,children:[(0,B.jsx)(Ms,{className:`h-3.5 w-3.5 text-gray-400 ml-2`}),[`all`,`1d`,`7d`,`30d`].map(e=>(0,B.jsx)(`button`,{onClick:()=>{c(e),f(1)},className:ud(`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,B.jsxs)(`div`,{className:`flex items-center gap-1 text-sm`,children:[(0,B.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,B.jsxs)(`button`,{onClick:()=>M(e),className:ud(`px-2.5 py-1.5 rounded-lg transition-colors flex items-center gap-1`,h===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:[t,h===e&&(0,B.jsx)(ks,{className:ud(`h-3 w-3`,_&&`rotate-180`)})]},e))]})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-4`,children:[(0,B.jsxs)(Y,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:w?.total||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`总会话数`})]}),(0,B.jsxs)(Y,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-green-600`,children:w?.items.filter(e=>e.status===`active`).length||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`活跃会话`})]}),(0,B.jsxs)(Y,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-purple-600`,children:w?.items.filter(e=>e.status===`completed`).length||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`已完成`})]}),(0,B.jsxs)(Y,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`text-3xl font-bold text-orange-600`,children:Math.round((w?.items.reduce((e,t)=>e+t.event_count,0)||0)/(w?.items.length||1))}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600 mt-1`,children:`平均事件数`})]})]}),(0,B.jsxs)(Y,{title:`会话列表 (${A.length})`,action:A.length>0?(0,B.jsx)(`button`,{onClick:()=>{l.size===P.length?u(new Set):u(new Set(P.map(e=>e.session_id)))},className:`text-xs text-blue-600 hover:underline`,children:l.size===P.length?`取消全选`:`全选当前页`}):void 0,children:[(0,B.jsx)(`div`,{className:`space-y-2`,children:P.map((e,t)=>(0,B.jsxs)(zb.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.03},className:ud(`flex items-center gap-3 p-4 rounded-lg border transition-all cursor-pointer`,l.has(e.session_id)?`border-blue-300 bg-blue-50`:`border-gray-100 hover:border-blue-200 hover:bg-blue-50/50`),onClick:()=>C(`/sessions/${e.session_id}`),children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:l.has(e.session_id),onChange:t=>{t.stopPropagation(),u(t=>{let n=new Set(t);return n.has(e.session_id)?n.delete(e.session_id):n.add(e.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,B.jsxs)(`div`,{className:`flex-1 grid grid-cols-1 md:grid-cols-5 gap-4 items-center`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`font-mono text-sm font-medium text-gray-900`,children:[e.session_id.slice(0,12),`...`]}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500 mt-1`,children:e.project_path.split(`/`).slice(-2).join(`/`)})]}),(0,B.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,B.jsx)(Vb,{variant:e.status===`active`?`success`:e.status===`completed`?`info`:`warning`,children:e.status})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,B.jsx)(Ts,{className:`h-4 w-4`}),e.event_count,` 事件`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,B.jsx)(Hs,{className:`h-4 w-4`}),Y2(md(e.start_time),`MM-dd HH:mm`)]}),(0,B.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ys,children:`查看详情`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Cc,onClick:t=>{t.stopPropagation(),S({open:!0,title:`删除会话`,description:`确认删除此会话及其所有数据?此操作不可撤销。`,onConfirm:()=>{O.mutate(e.session_id),S(e=>({...e,open:!1}))}})},loading:O.isPending&&O.variables===e.session_id})]})]})]},e.session_id))}),A.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(Ts,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,B.jsx)(`p`,{children:`暂无会话记录`}),(0,B.jsx)(`p`,{className:`text-sm mt-1`,children:`使用 Claude Code 开始一个会话后,记录将自动出现在这里`})]}),A.length>0&&(0,B.jsx)(t4,{currentPage:d,totalPages:ee,onPageChange:f,pageSize:p,onPageSizeChange:e=>{m(e),f(1)},totalItems:A.length})]}),(0,B.jsx)(Q2,{open:x.open,title:x.title,description:x.description,variant:`danger`,onConfirm:x.onConfirm,onCancel:()=>S({...x,open:!1})})]})}function a4({items:e}){return(0,B.jsx)(`nav`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:e.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t>0&&(0,B.jsx)(Ls,{className:`h-3.5 w-3.5 text-gray-400`}),e.path?(0,B.jsx)($r,{to:e.path,className:`hover:text-gray-900 transition-colors`,children:e.label}):(0,B.jsx)(`span`,{className:`text-gray-900 font-medium`,children:e.label})]},t))})}function o4(){let{id:e}=In(),t=Pn(),n=jn(),[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(`phases`),s=n.state?.from||`/sessions`,{data:c,isLoading:l}=ct({queryKey:[`session`,e],queryFn:()=>Hc(e).then(e=>e.data),enabled:!!e});if(l||!c)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let{session:u,phases:d,dataFlow:f,timeline:p,stats:m}=c,h=Object.entries(m.toolUsage).sort((e,t)=>t[1]-e[1]).slice(0,12).map(([e,t])=>({name:e,value:t}));return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(a4,{items:[{label:`会话列表`,path:`/sessions`},{label:u.session_id.slice(0,8)+`...`}]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ds,onClick:()=>t(s),children:`返回`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-xl font-bold text-gray-900`,children:`会话详情`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 font-mono`,children:u.session_id})]}),(0,B.jsx)(Vb,{variant:u.status===`active`?`success`:`info`,children:u.status})]}),c.pipeline&&(0,B.jsx)(J,{variant:`secondary`,size:`sm`,onClick:()=>t(`/pipelines/${c.pipeline.id}`,{state:{from:s}}),children:`查看关联 Pipeline`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-4`,children:[(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Hs,{className:`h-5 w-5 text-blue-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-xl font-bold`,children:dd(m.duration)}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`持续时间`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Oc,{className:`h-5 w-5 text-green-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-xl font-bold`,children:m.totalEvents}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`总事件数`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Zs,{className:`h-5 w-5 text-purple-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-xl font-bold`,children:m.writeOps}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`写入操作`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(_c,{className:`h-5 w-5 text-orange-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-xl font-bold`,children:m.readOps}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`读取操作`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Sc,{className:`h-5 w-5 text-red-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-xl font-bold`,children:d.length}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`交互轮次`})]})]}),(0,B.jsx)(Y,{title:`事件密度时间线`,children:(0,B.jsx)(RO,{width:`100%`,height:120,children:(0,B.jsxs)(V0,{data:p,children:[(0,B.jsx)(`defs`,{children:(0,B.jsxs)(`linearGradient`,{id:`timelineGrad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`5%`,stopColor:`#3b82f6`,stopOpacity:.4}),(0,B.jsx)(`stop`,{offset:`95%`,stopColor:`#3b82f6`,stopOpacity:0})]})}),(0,B.jsx)(wX,{strokeDasharray:`3 3`,stroke:`#e5e7eb`}),(0,B.jsx)(C$,{dataKey:`time`,tick:!1}),(0,B.jsx)(R$,{hide:!0}),(0,B.jsx)(hW,{formatter:e=>[`${e} 事件`,`数量`]}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`count`,stroke:`#3b82f6`,fill:`url(#timelineGrad)`})]})})}),(0,B.jsx)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[`phases`,`flow`,`events`].map(e=>(0,B.jsx)(`button`,{onClick:()=>o(e),className:ud(`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,B.jsx)(`div`,{className:`space-y-3`,children:d.map((e,t)=>(0,B.jsx)(zb.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:t*.05},children:(0,B.jsxs)(Y,{className:`!p-0 overflow-hidden`,children:[(0,B.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,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.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,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-semibold text-gray-900`,children:e.name}),(0,B.jsxs)(`div`,{className:`text-sm text-gray-500`,children:[e.toolCalls,` 工具调用 · `,e.writeOps,` 写入 · `,e.artifacts.length,` 产物`]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[e.duration&&(0,B.jsx)(`span`,{className:`text-sm text-gray-500`,children:dd(e.duration)}),(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[e.artifacts.slice(0,3).map((e,t)=>(0,B.jsx)(Vb,{variant:`success`,size:`sm`,children:e},t)),e.artifacts.length>3&&(0,B.jsxs)(Vb,{variant:`default`,size:`sm`,children:[`+`,e.artifacts.length-3]})]}),r===t?(0,B.jsx)(Fs,{className:`h-5 w-5 text-gray-400`}):(0,B.jsx)(Ls,{className:`h-5 w-5 text-gray-400`})]})]}),r===t&&(0,B.jsx)(zb.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},className:`border-t border-gray-100`,children:(0,B.jsx)(`div`,{className:`p-4 max-h-96 overflow-y-auto space-y-2`,children:e.events.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`text-gray-400 font-mono w-20 flex-shrink-0`,children:Y2(md(e.time),`HH:mm:ss`)}),(0,B.jsx)(Vb,{size:`sm`,variant:e.hookType===`PostToolUse`?`success`:e.hookType===`PreToolUse`?`info`:e.hookType===`UserPromptSubmit`?`warning`:`default`,children:e.hookType}),e.toolName&&(0,B.jsx)(`span`,{className:`font-mono text-gray-700 font-medium`,children:e.toolName}),e.input&&(0,B.jsx)(`span`,{className:`text-gray-500 truncate max-w-md`,children:e.input})]},t))})})]})},t))}),a===`flow`&&(0,B.jsx)(Y,{title:`数据流图 (${f.nodes.length} 节点)`,children:(0,B.jsx)(`div`,{className:`space-y-1 max-h-[600px] overflow-y-auto`,children:f.nodes.map((e,t)=>(0,B.jsxs)(zb.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:t*.02},className:`flex items-center gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col items-center w-8`,children:[t>0&&(0,B.jsx)(`div`,{className:`w-0.5 h-3 bg-gray-300`}),(0,B.jsx)(`div`,{className:ud(`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<f.nodes.length-1&&(0,B.jsx)(`div`,{className:`w-0.5 h-3 bg-gray-300`})]}),(0,B.jsxs)(`div`,{className:ud(`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,B.jsx)(`span`,{className:`font-mono text-xs text-gray-400`,children:Y2(md(e.time),`HH:mm:ss`)}),(0,B.jsx)(Vb,{size:`sm`,variant:e.type===`intent`?`info`:e.type===`artifact`?`success`:e.type===`quality`?`warning`:`default`,children:e.label}),e.detail&&(0,B.jsx)(`span`,{className:`text-gray-600 truncate`,children:e.detail})]})]},e.id))})}),a===`events`&&(0,B.jsx)(Y,{title:`全部事件 (${c.events.length})`,children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`类型`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`工具`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`详情`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:c.events.map(e=>(0,B.jsxs)(`tr`,{className:`border-t border-gray-50 hover:bg-gray-50`,children:[(0,B.jsx)(`td`,{className:`py-2 font-mono text-gray-500`,children:Y2(md(e.timestamp),`HH:mm:ss`)}),(0,B.jsx)(`td`,{className:`py-2`,children:(0,B.jsx)(Vb,{size:`sm`,variant:e.hook_type===`PostToolUse`?`success`:e.hook_type===`UserPromptSubmit`?`warning`:`default`,children:e.hook_type})}),(0,B.jsx)(`td`,{className:`py-2 font-mono`,children:e.tool_name||`-`}),(0,B.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,B.jsx)(Y,{title:`工具使用分布`,children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(b0,{data:h,layout:`vertical`,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`,stroke:`#e5e7eb`}),(0,B.jsx)(C$,{type:`number`}),(0,B.jsx)(R$,{dataKey:`name`,type:`category`,width:80,tick:{fontSize:12}}),(0,B.jsx)(hW,{}),(0,B.jsx)(n$,{dataKey:`value`,fill:`#3b82f6`,radius:[0,4,4,0]})]})})})]})}function s4(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o;n.key&&n.debug?.call(n)&&(o=Date.now());let s=e();if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug?.call(n)&&(c=Date.now()),i=t(...s),n.key&&n.debug?.call(n)){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
65
65
|
font-size: .6rem;
|
|
66
66
|
font-weight: bold;
|
|
67
|
-
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 c4(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var l4=(e,t)=>Math.abs(e-t)<1.01,u4=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},d4=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},f4=e=>e,p4=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},m4=(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(d4(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(d4(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},h4={passive:!0},g4=typeof window>`u`?!0:`onscrollend`in window,_4=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&g4?()=>void 0:u4(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,h4);let l=e.options.useScrollendEvent&&g4;return l&&n.addEventListener(`scrollend`,c,h4),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},v4=(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`]},y4=(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:f4,rangeExtractor:p4,onChange:()=>{},measureElement:v4,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=s4(()=>(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=s4(()=>[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=s4(()=>[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=s4(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?S4({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=s4(()=>{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=s4(()=>[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 c4(t[x4(0,t.length-1,e=>c4(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&&l4(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()}},x4=(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 S4({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=x4(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 C4=typeof document<`u`?z.useLayoutEffect:z.useEffect;function w4({useFlushSync:e=!0,...t}){let n=z.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,Mc.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=z.useState(()=>new b4(r));return i.setOptions(r),C4(()=>i._didMount(),[]),C4(()=>i._willUpdate()),i}function T4(e){return w4({observeElementRect:m4,observeElementOffset:_4,scrollToFn:y4,...e})}var E4={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 D4(e){if(!e)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function O4(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 k4(){let e=qe(),[t,n]=(0,z.useState)(200),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(`all`),[y,b]=(0,z.useState)(30),[x,S]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),C=(0,z.useRef)(null),w=_===`all`?void 0:Y2(Z2(new Date,_===`1d`?1:_===`7d`?7:30),`yyyy-MM-dd'T'HH:mm:ss`),{data:T,isLoading:E,isError:D,refetch:O}=ct({queryKey:[`events`,{limit:t,tool_name:r||void 0,start_time:w,search:p||void 0}],queryFn:()=>Gc({limit:t,tool_name:r||void 0,start_time:w,search:p||void 0}).then(e=>e.data)}),k=lt({mutationFn:e=>Il(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`events`]})}});if(E)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});if(D)return(0,B.jsx)(r4,{message:`事件数据加载失败`,onRetry:()=>O()});let A=T?.items.filter(e=>!(a&&e.hook_type!==a||s&&e.project_path.split(`/`).pop()!==s||d&&![e.tool_name,D4(e.tool_input),D4(e.tool_output)].join(` `).toLowerCase().includes(d.toLowerCase())))||[],j=T4({count:A.length,getScrollElement:()=>C.current,estimateSize:()=>120,overscan:5}),M=Array.from(new Set(T?.items.map(e=>e.project_path.split(`/`).pop()||``).filter(Boolean)||[])),N=A.reduce((e,t)=>{let n=t.tool_name||`N/A`;return e[n]=(e[n]||0)+1,e},{}),ee=Object.entries(N).sort((e,t)=>t[1]-e[1]).slice(0,10),P=Array.from(new Set(T?.items.map(e=>e.hook_type)||[]));return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center flex-1`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.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,B.jsx)(`div`,{className:`relative min-w-[200px] max-w-xs`,children:(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),m(h)},children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`内容全文搜索(回车确认)...`,value:h,onChange:e=>g(e.target.value),onBlur:()=>{h!==p&&m(h)},className:ud(`w-full pl-3 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`,p?`border-blue-400 bg-blue-50`:`border-gray-200`)}),p&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{m(``),g(``)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 text-xs`,children:`✕`})]})}),(0,B.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,B.jsx)(`option`,{value:``,children:`全部类型`}),P.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.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,B.jsx)(`option`,{value:``,children:`全部项目`}),M.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden text-sm`,children:[(0,B.jsx)(Ms,{className:`h-3.5 w-3.5 text-gray-400 ml-2`}),[`all`,`1d`,`7d`,`30d`].map(e=>(0,B.jsx)(`button`,{onClick:()=>{v(e)},className:ud(`px-2.5 py-2 transition-colors`,_===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:e===`all`?`全部`:e},e))]}),(0,B.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,B.jsx)(`option`,{value:500,children:`500 条`}),(0,B.jsx)(`option`,{value:1e3,children:`1000 条`}),(0,B.jsx)(`option`,{value:2e3,children:`2000 条`}),(0,B.jsx)(`option`,{value:5e3,children:`5000 条`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,B.jsxs)(`select`,{value:y,onChange:e=>b(Number(e.target.value)),className:`px-2 py-1.5 border border-gray-200 rounded-lg text-sm`,children:[(0,B.jsx)(`option`,{value:7,children:`7天`}),(0,B.jsx)(`option`,{value:30,children:`30天`}),(0,B.jsx)(`option`,{value:90,children:`90天`})]}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:()=>{let e=[`时间`,`类型`,`工具`,`项目`,`会话ID`,`摘要`],t=A.map(e=>{let t=O4(e);return[e.timestamp,e.hook_type,e.tool_name||``,e.project_path.split(`/`).pop()||``,e.session_id.slice(0,12),t.subtitle]});n4(`events-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出`}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:Cc,onClick:()=>{S({open:!0,title:`清理历史事件`,description:`确认清理 ${y} 天前的已蒸馏事件?此操作不可撤销。`,onConfirm:()=>{k.mutate(y),S({...x,open:!1})}})},loading:k.isPending,children:`清理历史`}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:mc,onClick:()=>O(),children:`刷新`})]})]})}),(0,B.jsx)(Y,{title:`工具使用频率`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ee.map(([e,t])=>(0,B.jsxs)(`button`,{onClick:()=>{i(r===e?``:e),setCurrentPage(1)},className:ud(`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,B.jsx)(`span`,{className:`font-medium`,children:e}),(0,B.jsx)(`span`,{className:`ml-1 text-xs opacity-70`,children:t})]},e))})}),(0,B.jsx)(Y,{title:`执行轨迹 (${A.length})`,children:(0,B.jsx)(`div`,{ref:C,className:`h-[600px] overflow-auto`,style:{contain:`strict`},children:(0,B.jsx)(`div`,{style:{height:`${j.getTotalSize()}px`,width:`100%`,position:`relative`},children:j.getVirtualItems().map(e=>{let t=A[e.index],n=O4(t),r=l===t.event_id;return(0,B.jsx)(`div`,{"data-index":e.index,ref:j.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},className:`pb-2`,children:(0,B.jsxs)(`div`,{className:`border border-gray-100 rounded-lg overflow-hidden`,children:[(0,B.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,B.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,B.jsx)(`button`,{className:`text-gray-400`,children:r?(0,B.jsx)(Fs,{className:`h-4 w-4`}):(0,B.jsx)(Ls,{className:`h-4 w-4`})}),(0,B.jsx)(Vb,{size:`sm`,className:E4[t.hook_type]||`bg-gray-100 text-gray-700`,children:t.hook_type}),t.tool_name&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-sm text-gray-700 flex-shrink-0`,children:[t.tool_name===`Bash`?(0,B.jsx)(Sc,{className:`h-4 w-4`}):(0,B.jsx)(Xs,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`font-mono`,children:t.tool_name})]}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`div`,{className:`text-sm font-medium text-gray-900 truncate`,children:n.title}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500 truncate`,children:n.subtitle})]})]}),(0,B.jsx)(`div`,{className:`text-xs text-gray-400 font-mono ml-3`,children:Y2(md(t.timestamp),`HH:mm:ss`)})]}),(0,B.jsx)(My,{children:r&&(0,B.jsx)(zb.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,B.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3 text-xs`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`会话`}),(0,B.jsxs)(`div`,{className:`font-mono text-gray-700`,children:[t.session_id.slice(0,12),`...`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`项目`}),(0,B.jsx)(`div`,{className:`text-gray-700`,children:t.project_path.split(`/`).pop()})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`时间`}),(0,B.jsx)(`div`,{className:`font-mono text-gray-700`,children:t.timestamp})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`类型`}),(0,B.jsx)(`div`,{className:`text-gray-700`,children:t.hook_type})]})]}),t.tool_input&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider`,children:[(0,B.jsx)(sc,{className:`h-3 w-3`}),` 输入`]}),(0,B.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:D4(t.tool_input)})]}),t.tool_output&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider`,children:[(0,B.jsx)(As,{className:`h-3 w-3`}),` 输出`]}),(0,B.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:D4(t.tool_output)})]})]})})})]})},t.event_id)})})})}),(0,B.jsx)(Q2,{open:x.open,title:x.title,description:x.description,variant:`danger`,onConfirm:x.onConfirm,onCancel:()=>S({...x,open:!1})})]})}var A4={analyze:`#3b82f6`,design:`#8b5cf6`,profile:`#06b6d4`,code:`#10b981`,test:`#f59e0b`,review:`#ef4444`,done:`#6b7280`};function j4(){let e=qe(),t=Pn(),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(`all`),[c,l]=(0,z.useState)(1),[u,d]=(0,z.useState)(20),[f,p]=(0,z.useState)(new Set),[m,h]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:g,isLoading:_,isError:v,refetch:y}=ct({queryKey:[`pipelines`],queryFn:()=>qc({limit:500}).then(e=>e.data),refetchInterval:1e4}),b=lt({mutationFn:e=>ol(e),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),x=lt({mutationFn:()=>cl(),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),S=lt({mutationFn:e=>sl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`pipelines`]}),p(new Set)}});if(_)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});if(v)return(0,B.jsx)(r4,{message:`Pipeline 数据加载失败`,onRetry:()=>y()});let C=g?.items.filter(e=>e.status===`active`)||[],w=g?.items.filter(e=>e.status===`completed`)||[],T=o===`all`||o===`active`,E=o===`all`||o===`completed`,D=w.filter(e=>!(n&&!e.requirement.toLowerCase().includes(n.toLowerCase())||i&&e.complexity!==i)),O=Math.ceil(D.length/u),k=D.slice((c-1)*u,c*u);return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[C.length,` 个活跃 · `,w.length,` 个已完成`,f.size>0&&` · 已选 ${f.size} 个`]}),(0,B.jsxs)(`select`,{value:o,onChange:e=>{s(e.target.value),l(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,B.jsx)(`option`,{value:`all`,children:`全部状态`}),(0,B.jsx)(`option`,{value:`active`,children:`仅活跃`}),(0,B.jsx)(`option`,{value:`completed`,children:`仅已完成`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[C.length>0&&f.size>0&&(0,B.jsxs)(J,{variant:`danger`,size:`sm`,icon:kc,onClick:()=>{f.size!==0&&h({open:!0,title:`批量关闭 Pipeline`,description:`确认关闭选中的 ${f.size} 个 Pipeline?`,onConfirm:()=>{S.mutate(Array.from(f)),h(e=>({...e,open:!1}))}})},loading:S.isPending,children:[`批量关闭 (`,f.size,`)`]}),C.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{variant:`secondary`,size:`sm`,onClick:()=>{f.size===C.length?p(new Set):p(new Set(C.map(e=>e.id)))},children:f.size===C.length?`取消全选`:`全选`}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:Cc,onClick:()=>{h({open:!0,title:`清理过期 Pipeline`,description:`确认关闭所有过期 Pipeline?`,onConfirm:()=>{x.mutate(),h(e=>({...e,open:!1}))}})},loading:x.isPending,children:`清理过期`})]}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:mc,onClick:()=>y(),children:`刷新`}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:()=>{let e=g?.items||[];n4(`pipelines-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,[`ID`,`需求`,`阶段`,`复杂度`,`状态`,`时长(s)`,`结果`,`创建时间`],e.map(e=>[e.id,e.requirement,e.current_phase,e.complexity,e.status,e.duration_seconds,e.outcome,e.created_at]))},children:`导出 CSV`})]})]}),T&&C.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider mb-3`,children:`活跃中`}),(0,B.jsx)(`div`,{className:`space-y-3`,children:C.map((e,n)=>(0,B.jsx)(zb.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.05},children:(0,B.jsx)(Y,{className:`!p-0 overflow-hidden cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>t(`/pipelines/${e.id}`),children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 flex-1 min-w-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:f.has(e.id),onChange:t=>{t.stopPropagation(),p(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,B.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg`,style:{backgroundColor:`${A4[e.phase]||`#6b7280`}20`},children:(0,B.jsx)(tc,{className:`h-5 w-5`,style:{color:A4[e.phase]||`#6b7280`}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`font-medium text-gray-900 truncate`,children:e.requirement}),(0,B.jsxs)(`div`,{className:`text-sm text-gray-500 flex items-center gap-3 mt-1`,children:[(0,B.jsx)(Vb,{variant:`info`,size:`sm`,children:e.phaseLabel}),(0,B.jsx)(`span`,{children:e.project}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Hs,{className:`h-3 w-3`}),Y2(md(e.createdAt),`MM-dd HH:mm`)]})]})]})]}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:kc,onClick:()=>{h({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{b.mutate(e.id),h(e=>({...e,open:!1}))}})},loading:b.isPending,children:`关闭`})]})})},e.id))})]}),E&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider mb-3`,children:`历史记录`}),(0,B.jsxs)(Y,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center mb-4 pb-4 border-b border-gray-100`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索需求描述...`,value:n,onChange:e=>{r(e.target.value),l(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,B.jsxs)(`select`,{value:i,onChange:e=>{a(e.target.value),l(1)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,B.jsx)(`option`,{value:``,children:`全部复杂度`}),(0,B.jsx)(`option`,{value:`simple`,children:`简单`}),(0,B.jsx)(`option`,{value:`moderate`,children:`中等`}),(0,B.jsx)(`option`,{value:`complex`,children:`复杂`})]})]}),(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`需求`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`项目`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`类型`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`复杂度`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:k.map(e=>(0,B.jsxs)(`tr`,{className:`border-t border-gray-50 hover:bg-gray-50 cursor-pointer`,onClick:()=>t(`/pipelines/${e.id}`),children:[(0,B.jsx)(`td`,{className:`py-3 max-w-xs truncate`,children:e.requirement}),(0,B.jsx)(`td`,{className:`py-3`,children:e.project}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,children:e.taskType||`-`})}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,variant:e.complexity===`complex`?`danger`:e.complexity===`moderate`?`warning`:`default`,children:e.complexity||`-`})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:Y2(md(e.createdAt),`MM-dd HH:mm`)}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ys,onClick:n=>{n.stopPropagation(),t(`/pipelines/${e.id}`)},children:`查看`})})]},e.id))})]})}),D.length===0&&(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无历史记录`}),D.length>0&&(0,B.jsx)(t4,{currentPage:c,totalPages:O,onPageChange:l,pageSize:u,onPageSizeChange:e=>{d(e),l(1)},totalItems:D.length})]})]}),(0,B.jsx)(Q2,{open:m.open,title:m.title,description:m.description,variant:`danger`,onConfirm:m.onConfirm,onCancel:()=>h({...m,open:!1})})]})}var M4=[`analyze`,`design`,`profile`,`code`,`test`,`review`,`done`],N4={analyze:`#3b82f6`,design:`#8b5cf6`,profile:`#06b6d4`,code:`#10b981`,test:`#f59e0b`,review:`#ef4444`,done:`#6b7280`},P4={PreToolUse:`#3b82f6`,PostToolUse:`#10b981`,UserPromptSubmit:`#f59e0b`,Stop:`#ef4444`};function F4(){let{id:e}=In(),t=Pn(),n=jn(),r=qe(),[i,a]=(0,z.useState)(`tasks`),[o,s]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),c=n.state?.from||`/pipelines`,{data:l,isLoading:u}=ct({queryKey:[`pipeline`,e],queryFn:()=>Jc(e).then(e=>e.data),enabled:!!e,refetchInterval:5e3}),d=lt({mutationFn:()=>ol(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),t(c)}}),f=lt({mutationFn:({taskId:e,status:t})=>ul(e,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),r.invalidateQueries({queryKey:[`pipelines`]})}}),p=lt({mutationFn:()=>dl(e),onSuccess:()=>{alert(`已添加到执行队列,下次工具调用时自动注入提示`)}});if(u||!l)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let m=l.phase!==`done`,h=M4.indexOf(l.phase),g=l.tasks.reduce((e,t)=>(e[t.phase]||(e[t.phase]=[]),e[t.phase].push(t),e),{});return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(a4,{items:[{label:`Pipeline 列表`,path:`/pipelines`},{label:l.id.slice(0,12)+`...`}]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ds,onClick:()=>t(c),children:`返回`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-lg font-bold text-gray-900`,children:`Pipeline 执行轨迹`}),(0,B.jsxs)(`p`,{className:`text-sm text-gray-500`,children:[(0,B.jsx)(`span`,{className:`font-mono`,children:l.id.slice(0,12)}),l.sessionId&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`mx-2`,children:`·`}),(0,B.jsxs)(`span`,{className:`text-blue-600 cursor-pointer hover:underline`,onClick:()=>t(`/sessions/${l.sessionId}`),children:[`会话 `,l.sessionId.slice(0,8)]})]})]})]}),(0,B.jsx)(Vb,{variant:m?`info`:`success`,children:m?l.phaseLabel:`已完成`}),(0,B.jsx)(Vb,{children:l.taskType}),(0,B.jsx)(Vb,{variant:l.complexity===`complex`?`danger`:l.complexity===`moderate`?`warning`:`default`,children:l.complexity})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[l.sessionId&&(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:Ts,onClick:()=>t(`/sessions/${l.sessionId}`),children:`查看会话`}),m&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:dc,onClick:()=>p.mutate(),loading:p.isPending,children:`继续执行`}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:kc,onClick:()=>{s({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{d.mutate(),s(e=>({...e,open:!1}))}})},children:`关闭`})]})]})]}),(0,B.jsx)(Y,{className:`!p-4`,children:(0,B.jsx)(`p`,{className:`text-sm text-gray-700 line-clamp-3`,children:l.requirement})}),(0,B.jsx)(Y,{className:`!p-4`,children:(0,B.jsx)(`div`,{className:`flex items-center gap-1`,children:M4.filter(e=>e!==`done`).map((e,t)=>{let n=e===l.phase,r=h>t||l.phase===`done`,i=N4[e]||`#6b7280`;return(0,B.jsxs)(`div`,{className:`flex items-center flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col items-center flex-1`,children:[(0,B.jsx)(`div`,{className:ud(`w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all`,r?`text-white`:n?`text-white ring-4 ring-offset-2`:`bg-gray-200 text-gray-500`),style:r||n?{backgroundColor:i,ringColor:`${i}40`}:{},children:r?`✓`:t+1}),(0,B.jsx)(`span`,{className:ud(`text-xs mt-1`,n?`font-bold text-gray-900`:`text-gray-500`),children:e})]}),t<M4.length-2&&(0,B.jsx)(`div`,{className:ud(`h-0.5 flex-1 mx-1`,r?`bg-green-400`:`bg-gray-200`)})]},e)})})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-3`,children:[(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-blue-600`,children:l.stats.totalEvents}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`事件`})]}),(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsxs)(`div`,{className:`text-xl font-bold text-green-600`,children:[l.stats.completedTasks,`/`,l.stats.totalTasks]}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`任务`})]}),(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-purple-600`,children:l.stats.totalArtifacts}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`产物`})]}),(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-orange-600`,children:l.stats.totalQualityIssues}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`质量问题`})]}),(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-red-600`,children:l.stats.unresolvedQuality}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`未解决`})]})]}),(0,B.jsx)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[`tasks`,`events`,`artifacts`,`quality`].map(e=>(0,B.jsx)(`button`,{onClick:()=>a(e),className:ud(`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:`任务 (${l.stats.totalTasks})`,events:`事件 (${l.stats.totalEvents})`,artifacts:`产物 (${l.stats.totalArtifacts})`,quality:`质量 (${l.stats.totalQualityIssues})`}[e]},e))}),i===`tasks`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[Object.entries(g).map(([e,t])=>(0,B.jsx)(Y,{title:`${t[0]?.phaseLabel||e} (${t.length})`,children:(0,B.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,B.jsxs)(zb.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:t*.05},className:`flex items-start gap-3 p-3 rounded-lg border border-gray-100`,children:[(0,B.jsx)(`div`,{className:`mt-0.5`,children:e.status===`completed`?(0,B.jsx)(zs,{className:`h-5 w-5 text-green-500`}):e.status===`in_progress`?(0,B.jsx)(dc,{className:`h-5 w-5 text-blue-500`}):(0,B.jsx)(Vs,{className:`h-5 w-5 text-gray-300`})}),(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsx)(`div`,{className:`font-medium text-gray-900`,children:e.title}),e.description&&(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:e.description}),e.output&&(0,B.jsx)(`p`,{className:`text-xs text-green-600 mt-1 font-mono`,children:e.output})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Vb,{size:`sm`,variant:e.status===`completed`?`success`:e.status===`in_progress`?`info`:`default`,children:e.status}),e.status!==`completed`&&(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:zs,onClick:()=>f.mutate({taskId:e.id,status:`completed`}),children:`完成`}),e.status!==`in_progress`&&(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:dc,onClick:()=>f.mutate({taskId:e.id,status:`in_progress`}),children:`开始`})]})]},e.id))})},e)),l.tasks.length===0&&(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无任务`})})]}),i===`events`&&(0,B.jsx)(Y,{title:`工具调用时间线`,children:(0,B.jsxs)(`div`,{className:`space-y-1 max-h-[600px] overflow-y-auto`,children:[l.events.map((e,t)=>(0,B.jsxs)(zb.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,B.jsx)(`span`,{className:`text-gray-400 font-mono w-16 flex-shrink-0`,children:Y2(md(e.time),`HH:mm:ss`)}),(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:P4[e.hookType]||`#6b7280`}}),(0,B.jsx)(`span`,{className:`font-mono text-gray-700 w-20 flex-shrink-0`,children:e.toolName||e.hookType}),(0,B.jsx)(`span`,{className:`text-gray-500 truncate`,children:e.detail||``})]},t)),l.events.length===0&&(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无事件`})]})}),i===`artifacts`&&(0,B.jsx)(Y,{title:`产物文件`,children:(0,B.jsxs)(`div`,{className:`space-y-2`,children:[l.artifacts.map((e,t)=>(0,B.jsx)(zb.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,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Xs,{className:`h-5 w-5 text-green-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-mono text-sm text-gray-900`,children:e.filePath.split(`/`).slice(-2).join(`/`)}),(0,B.jsxs)(`div`,{className:`text-xs text-gray-400`,children:[e.tool,` · `,Y2(md(e.time),`HH:mm:ss`)]})]})]})},t)),l.artifacts.length===0&&(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无产物`})]})}),i===`quality`&&(0,B.jsx)(Y,{title:`质量问题`,children:(0,B.jsxs)(`div`,{className:`space-y-2`,children:[l.qualityIssues.map((e,t)=>(0,B.jsxs)(zb.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,B.jsxs)(`div`,{className:`flex items-start gap-3 flex-1`,children:[e.resolved?(0,B.jsx)(zs,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,B.jsx)(Tc,{className:`h-5 w-5 text-amber-500 mt-0.5`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Vb,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,B.jsx)(Vb,{size:`sm`,children:e.category})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-700 mt-1`,children:e.message}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:Y2(md(e.createdAt),`MM-dd HH:mm`)})]})]}),(0,B.jsx)(Vb,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`})]},t)),l.qualityIssues.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(yc,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`暂无质量问题`]})]})}),(0,B.jsx)(Q2,{open:o.open,title:o.title,description:o.description,variant:`danger`,onConfirm:o.onConfirm,onCancel:()=>s({...o,open:!1})})]})}function I4(){let e=qe(),[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(1),[p,m]=(0,z.useState)(20),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)({}),[y,b]=(0,z.useState)(new Set),[x,S]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:C,isError:w,refetch:T}=ct({queryKey:[`quality-unresolved`],queryFn:()=>Xc().then(e=>e.data),refetchInterval:1e4}),{data:E}=ct({queryKey:[`quality-history`],queryFn:()=>Yc({limit:1e3}).then(e=>e.data)}),D=lt({mutationFn:e=>El(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),O=lt({mutationFn:e=>Dl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),k=lt({mutationFn:()=>Ol(),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),A=lt({mutationFn:e=>kl(e),onSuccess:(t,n)=>{let{needsFix:r,reason:i,fixSuggestion:a}=t.data;v(e=>({...e,[n]:{needsFix:r,reason:i,fixSuggestion:a}})),r||(e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]}))}}),j=lt({mutationFn:async e=>{await Promise.all(e.map(e=>Dl(e)))},onSuccess:()=>{b(new Set),e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),M=E?.items.filter(e=>!(t&&!e.message.toLowerCase().includes(t.toLowerCase())||r&&e.level!==r||a&&e.category!==a||s===`resolved`&&!e.resolved||s===`unresolved`&&e.resolved||l&&!e.project_path?.includes(l)))||[],N=Math.ceil(M.length/p),ee=M.slice((d-1)*p,d*p),P=E?.total||0,F=E?.items.filter(e=>e.resolved).length||0,I=C?.total||0,L=Array.from(new Set(E?.items.map(e=>e.level)||[])),te=Array.from(new Set(E?.items.map(e=>e.category)||[])),ne=Array.from(new Set(E?.items.map(e=>e.project_path?.split(`/`).pop()||``).filter(Boolean)||[])),re=()=>{let e=[`级别`,`类别`,`消息`,`项目`,`状态`,`创建时间`,`解决时间`],t=M.map(e=>[e.level,e.category,e.message,e.project_path?.split(`/`).pop()||``,e.resolved?`已解决`:`未解决`,e.created_at?Y2(md(e.created_at),`yyyy-MM-dd HH:mm:ss`):``,e.resolved_at?Y2(md(e.resolved_at),`yyyy-MM-dd HH:mm:ss`):``]);n4(`quality-issues-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},R=(()=>{if(!E?.items.length)return[];let e=new Map;return E.items.forEach(t=>{if(!t.created_at)return;let n=Y2(md(t.created_at),`MM-dd`);e.has(n)||e.set(n,{date:n,total:0,error:0,warn:0,info:0});let r=e.get(n);r.total++,t.level===`error`?r.error++:t.level===`warn`?r.warn++:r.info++}),Array.from(e.values()).sort((e,t)=>e.date.localeCompare(t.date)).slice(-14)})();return w?(0,B.jsx)(r4,{message:`质量数据加载失败`,onRetry:()=>T()}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Tc,{className:`h-6 w-6 text-amber-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-amber-600`,children:I}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`未解决`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(zs,{className:`h-6 w-6 text-green-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-green-600`,children:F}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`已解决`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Bs,{className:`h-6 w-6 text-blue-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-blue-600`,children:P}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`总计`})]})]}),R.length>0&&(0,B.jsx)(Y,{title:`质量趋势(最近14天)`,icon:wc,children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(v0,{data:R,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`,stroke:`#e5e7eb`}),(0,B.jsx)(C$,{dataKey:`date`,stroke:`#6b7280`,style:{fontSize:12}}),(0,B.jsx)(R$,{stroke:`#6b7280`,style:{fontSize:12}}),(0,B.jsx)(hW,{contentStyle:{backgroundColor:`#fff`,border:`1px solid #e5e7eb`,borderRadius:`8px`},labelStyle:{fontWeight:600,marginBottom:4}}),(0,B.jsx)(LA,{wrapperStyle:{fontSize:12}}),(0,B.jsx)(_Z,{type:`monotone`,dataKey:`error`,stroke:`#ef4444`,strokeWidth:2,name:`错误`}),(0,B.jsx)(_Z,{type:`monotone`,dataKey:`warn`,stroke:`#f59e0b`,strokeWidth:2,name:`警告`}),(0,B.jsx)(_Z,{type:`monotone`,dataKey:`info`,stroke:`#3b82f6`,strokeWidth:2,name:`信息`})]})})}),(0,B.jsxs)(Y,{title:`未解决问题 (${I})`,action:I>0?(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[y.size>0&&(0,B.jsxs)(J,{variant:`secondary`,size:`sm`,icon:kc,onClick:()=>{S({open:!0,title:`批量忽略问题`,description:`确认忽略选中的 ${y.size} 个问题?`,onConfirm:()=>{j.mutate(Array.from(y)),S(e=>({...e,open:!1}))}})},loading:j.isPending,children:[`批量忽略 (`,y.size,`)`]}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:Ps,onClick:()=>{S({open:!0,title:`全部标记已修复`,description:`确认将 ${I} 个问题全部标记为已修复?`,onConfirm:()=>{k.mutate(),S(e=>({...e,open:!1}))}})},loading:k.isPending,children:`全部标记已修复`})]}):void 0,children:[I>0&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 pb-3 border-b border-gray-100`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:y.size===I&&I>0,onChange:e=>{e.target.checked?b(new Set(C?.items.map(e=>String(e.id))||[])):b(new Set)},className:`h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500`}),(0,B.jsx)(`span`,{className:`text-sm text-gray-600`,children:y.size>0?`已选 ${y.size} 个`:`全选`})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[C?.items.map((e,t)=>(0,B.jsxs)(zb.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.03},className:`flex flex-col p-3 rounded-lg border border-gray-100 hover:border-gray-200`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3 flex-1 min-w-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:y.has(String(e.id)),onChange:()=>{b(t=>{let n=new Set(t);return n.has(String(e.id))?n.delete(String(e.id)):n.add(String(e.id)),n})},className:`h-4 w-4 mt-0.5 rounded border-gray-300 text-blue-600 focus:ring-blue-500 flex-shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,B.jsx)(Vb,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,B.jsx)(Vb,{size:`sm`,children:e.category})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-700`,children:e.message}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-400 mt-1`,children:[e.project_path?.split(`/`).pop(),` · `,e.created_at?Y2(md(e.created_at),`MM-dd HH:mm`):``]})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 ml-3 flex-shrink-0`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Dc,onClick:()=>A.mutate(String(e.id)),loading:A.isPending&&A.variables===String(e.id),children:`AI 修复`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ps,onClick:()=>D.mutate(String(e.id)),loading:D.isPending,children:`已修复`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>O.mutate(String(e.id)),loading:O.isPending,children:`忽略`})]})]}),_[String(e.id)]&&(0,B.jsxs)(`div`,{className:`mt-3 p-3 rounded-lg text-sm ${_[String(e.id)].needsFix?`bg-amber-50 border border-amber-200`:`bg-green-50 border border-green-200`}`,children:[(0,B.jsx)(`div`,{className:`font-medium mb-1`,children:_[String(e.id)].needsFix?`需要修复`:`无需修复`}),(0,B.jsx)(`div`,{className:`text-gray-700 mb-2`,children:_[String(e.id)].reason}),_[String(e.id)].fixSuggestion&&(0,B.jsxs)(`div`,{className:`bg-white p-2 rounded border border-amber-300`,children:[(0,B.jsx)(`div`,{className:`text-xs font-medium text-amber-700 mb-1`,children:`修复建议:`}),(0,B.jsx)(`div`,{className:`text-gray-800`,children:_[String(e.id)].fixSuggestion})]})]})]},e.id||t)),I===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(zs,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`暂无未解决的质量问题`]})]})]}),(0,B.jsxs)(Y,{title:`历史记录 (${M.length})`,action:M.length>0?(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:re,children:`导出 CSV`}):void 0,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center mb-4 pb-4 border-b border-gray-100`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索问题描述...`,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 text-sm`})]}),(0,B.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,B.jsx)(`option`,{value:``,children:`全部级别`}),L.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.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,B.jsx)(`option`,{value:``,children:`全部类别`}),te.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.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,B.jsx)(`option`,{value:``,children:`全部状态`}),(0,B.jsx)(`option`,{value:`resolved`,children:`已解决`}),(0,B.jsx)(`option`,{value:`unresolved`,children:`未解决`})]}),(0,B.jsxs)(`select`,{value:l,onChange:e=>{u(e.target.value),f(1)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,B.jsx)(`option`,{value:``,children:`全部项目`}),ne.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),(0,B.jsx)(`div`,{className:`space-y-1`,children:ee.map((e,t)=>{let n=h===String(e.id||t);return(0,B.jsxs)(`div`,{className:`rounded-lg border border-gray-100 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 p-3 hover:bg-gray-50 cursor-pointer text-sm`,onClick:()=>g(n?null:String(e.id||t)),children:[n?(0,B.jsx)(Fs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}):(0,B.jsx)(Ls,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}),(0,B.jsx)(Vb,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,B.jsx)(Vb,{size:`sm`,children:e.category}),(0,B.jsx)(`span`,{className:`flex-1 truncate text-gray-600`,children:e.message}),(0,B.jsx)(Vb,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),(0,B.jsx)(`span`,{className:`text-gray-400 flex-shrink-0`,children:e.created_at?Y2(md(e.created_at),`MM-dd HH:mm`):``})]}),(0,B.jsx)(My,{children:n&&(0,B.jsx)(zb.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,B.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 p-4 space-y-2 text-sm`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`完整消息:`}),(0,B.jsx)(`p`,{className:`text-gray-700 mt-1 break-words`,children:e.message})]}),e.project_path&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`项目路径:`}),(0,B.jsx)(`span`,{className:`text-gray-700 ml-1 font-mono text-xs`,children:e.project_path})]}),(0,B.jsxs)(`div`,{className:`flex gap-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`创建时间:`}),(0,B.jsx)(`span`,{className:`text-gray-700 ml-1`,children:e.created_at?Y2(md(e.created_at),`yyyy-MM-dd HH:mm:ss`):`-`})]}),e.resolved_at&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`解决时间:`}),(0,B.jsx)(`span`,{className:`text-gray-700 ml-1`,children:Y2(md(e.resolved_at),`yyyy-MM-dd HH:mm:ss`)})]})]}),!e.resolved&&(0,B.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ps,onClick:t=>{t.stopPropagation(),D.mutate(String(e.id))},loading:D.isPending,children:`标记已修复`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:t=>{t.stopPropagation(),O.mutate(String(e.id))},loading:O.isPending,children:`忽略`})]})]})})})]},e.id||t)})}),M.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(ec,{className:`h-12 w-12 mx-auto mb-3 text-gray-300`}),`没有符合条件的记录`]}),M.length>0&&(0,B.jsx)(t4,{currentPage:d,totalPages:N,onPageChange:f,pageSize:p,onPageSizeChange:e=>{m(e),f(1)},totalItems:M.length})]}),(0,B.jsx)(Q2,{open:x.open,title:x.title,description:x.description,variant:`warning`,onConfirm:x.onConfirm,onCancel:()=>S({...x,open:!1})})]})}var L4=[{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 R4(){let e=qe(),[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(`idle`),[a,o]=(0,z.useState)(`distill`),[s,c]=(0,z.useState)(new Set),l=s.size>0,[u,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(new Set),[m,h]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:g,isLoading:_}=ct({queryKey:[`config`],queryFn:()=>Rc().then(e=>e.data)}),{data:v,refetch:y}=ct({queryKey:[`daemon-diagnosis`],queryFn:()=>Ml().then(e=>e.data),enabled:a===`environment`}),{data:b,refetch:x}=ct({queryKey:[`backups`],queryFn:()=>Fl().then(e=>e.data),enabled:a===`backup_mgmt`}),{data:S}=ct({queryKey:[`config-history`],queryFn:()=>Bc().then(e=>e.data),enabled:a===`history`}),{data:C}=ct({queryKey:[`daemon-status`],queryFn:()=>Al().then(e=>e.data),enabled:a===`backup_mgmt`}),w=lt({mutationFn:()=>Pl(),onSuccess:()=>{x(),i(`success`),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),T=lt({mutationFn:()=>Nl(),onSuccess:e=>{d(e.data),y()}});(0,z.useEffect)(()=>{g&&!t&&n(g)},[g,t]);let E=lt({mutationFn:e=>zc(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),i(`success`),c(new Set),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),D=lt({mutationFn:()=>W.post(`/config/reset`),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),n(null),i(`success`),setTimeout(()=>i(`idle`),3e3)}});if(_||!t)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let O=(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??``},k=(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}})},A=()=>{if(!t)return;let e={};s.forEach(n=>{e[n]=t[n]}),E.mutate(e)},j=()=>{n(g),c(new Set)},M=()=>{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)},N=()=>{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(L4.map(e=>e.key)))}catch{alert(`配置文件格式错误,请选择有效的 JSON 文件`)}},r.readAsText(t)},e.click()},ee=L4.find(e=>e.key===a);return(0,B.jsxs)(`div`,{className:`flex gap-6`,children:[(0,B.jsx)(`div`,{className:`w-56 flex-shrink-0`,children:(0,B.jsx)(Y,{className:`!p-2 sticky top-6`,children:(0,B.jsxs)(`nav`,{className:`space-y-1`,children:[L4.map(e=>(0,B.jsx)(`button`,{onClick:()=>o(e.key),className:ud(`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,B.jsx)(`div`,{className:`border-t border-gray-100 my-1`}),(0,B.jsxs)(`button`,{onClick:()=>o(`backup_mgmt`),className:ud(`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,B.jsx)(Gs,{className:`h-3.5 w-3.5`}),`数据备份`]}),(0,B.jsxs)(`button`,{onClick:()=>o(`environment`),className:ud(`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,B.jsx)(yc,{className:`h-3.5 w-3.5`}),`环境检测`]})]})})}),(0,B.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900`,children:a===`environment`?`环境检测`:a===`backup_mgmt`?`数据备份`:a===`history`?`配置历史`:ee?.title}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:a===`environment`?`Hook 脚本与 Claude settings.json 注入状态检测与修复`:a===`backup_mgmt`?`数据库备份与历史备份管理`:a===`history`?`查看最近 10 次配置变更记录`:ee?.description??``})]}),a!==`environment`&&a!==`backup_mgmt`&&a!==`history`&&(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(My,{children:[r===`success`&&(0,B.jsxs)(zb.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,B.jsx)(zs,{className:`h-4 w-4`}),`已保存`]}),r===`error`&&(0,B.jsxs)(zb.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,B.jsx)(Bs,{className:`h-4 w-4`}),`保存失败`]})]}),l&&(0,B.jsx)(Vb,{variant:`warning`,children:`未保存`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:qs,onClick:M,children:`导出`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ec,onClick:N,children:`导入`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:hc,onClick:j,disabled:!l,children:`撤销`}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:gc,onClick:A,loading:E.isPending,disabled:!l,children:`保存`})]})]}),a!==`environment`&&a!==`backup_mgmt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`space-y-6`,children:ee?.fields.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,B.jsxs)(`div`,{className:`w-48 flex-shrink-0 pt-2`,children:[(0,B.jsx)(`label`,{className:`text-sm font-medium text-gray-700`,children:e.label}),e.description&&(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-0.5`,children:e.description})]}),(0,B.jsx)(`div`,{className:`flex-1`,children:e.type===`boolean`?(0,B.jsx)(`button`,{onClick:()=>k(a,e.key,!O(a,e.key)),className:ud(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors`,O(a,e.key)?`bg-blue-600`:`bg-gray-300`),children:(0,B.jsx)(`span`,{className:ud(`inline-block h-4 w-4 transform rounded-full bg-white transition-transform`,O(a,e.key)?`translate-x-6`:`translate-x-1`)})}):e.type===`select`?(0,B.jsx)(`select`,{value:String(O(a,e.key)||``),onChange:t=>k(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,B.jsx)(`option`,{value:e.value,children:e.label},e.value))}):e.type===`number`?(0,B.jsx)(`input`,{type:`number`,value:Number(O(a,e.key))||0,onChange:t=>k(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,B.jsxs)(`div`,{className:`relative flex items-center max-w-xs`,children:[(0,B.jsx)(`input`,{type:e.sensitive&&!f.has(`${a}.${e.key}`)?`password`:`text`,value:String(O(a,e.key)||``),onChange:t=>k(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,B.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,B.jsx)(Js,{className:`h-4 w-4`}):(0,B.jsx)(Ys,{className:`h-4 w-4`})})]})})]},e.key))})}),(0,B.jsx)(Y,{className:`!border-red-200`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-red-600`,children:`重置配置`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-1`,children:`将所有配置恢复为默认值,此操作不可撤销`})]}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:Tc,onClick:()=>{h({open:!0,title:`重置配置`,description:`确定要重置所有配置为默认值吗?此操作不可撤销。`,onConfirm:()=>{D.mutate(),h({...m,open:!1})}})},loading:D.isPending,children:`重置`})]})})]}),a===`backup_mgmt`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full bg-blue-50 flex items-center justify-center`,children:(0,B.jsx)(nc,{className:`h-5 w-5 text-blue-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`当前数据库`}),(0,B.jsxs)(`p`,{className:`text-sm text-gray-500 mt-1`,children:[`大小:`,C?.memory?`${(C.memory.heapUsed/1024/1024).toFixed(2)} MB`:`加载中...`]})]})]}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:Gs,onClick:()=>w.mutate(),loading:w.isPending,children:`立即备份`})]})}),(0,B.jsxs)(Y,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`备份历史`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:mc,onClick:()=>x(),children:`刷新`})]}),b&&b.items.length>0?(0,B.jsx)(`div`,{className:`space-y-2`,children:b.items.map(e=>(0,B.jsx)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900 truncate`,children:e.filename}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[Y2(new Date(e.createdAt),`yyyy-MM-dd HH:mm:ss`),` · `,e.sizeMb,` MB`]})]})},e.filename))}):(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无备份记录`})]})]}),a===`history`&&(0,B.jsxs)(Y,{children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,B.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`最近 10 次配置变更`})}),S&&S.items.length>0?(0,B.jsx)(`div`,{className:`space-y-2`,children:S.items.map(e=>(0,B.jsxs)(`div`,{className:`py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(`span`,{className:`text-sm font-medium text-gray-900`,children:[`#`,e.id]}),(0,B.jsx)(`span`,{className:`text-xs text-gray-500`,children:Y2(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)})]}),(0,B.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`确认恢复配置`,description:`确定要恢复到 ${Y2(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)} 的配置吗?当前配置将被覆盖。`,onConfirm:()=>{n(e.config),A(),h({...m,open:!1})}})},children:`恢复到此版本`})]}),(0,B.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,B.jsx)(`pre`,{className:`whitespace-pre-wrap break-all`,children:JSON.stringify(e.config,null,2)})})]},e.id))}):(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无配置变更记录`})]}),a===`environment`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-medium text-gray-900 mb-1`,children:`Hook 环境诊断`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`检测 Forge hooks 脚本与 Claude settings.json 中 Forge 注入是否完整`})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:mc,onClick:()=>y(),children:`重新检测`}),(0,B.jsx)(J,{size:`sm`,icon:Oc,onClick:()=>T.mutate(),disabled:T.isPending||v?.hooksHealthy,children:T.isPending?`修复中...`:`一键修复`})]})]})}),u&&(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[u.hooksHealthy?(0,B.jsx)(zs,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(Tc,{className:`h-4 w-4 text-yellow-500 mt-0.5 flex-shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:ud(`text-sm font-medium`,u.hooksHealthy?`text-gray-900`:`text-yellow-600`),children:u.hooksHealthy?`Hooks 环境已恢复正常`:`修复后仍有未通过项,请根据下方列表排查`}),u.backupPath&&(0,B.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[`已备份 settings: `,u.backupPath.split(`/`).pop()]})]})]}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Bs,onClick:()=>d(null)})]})}),v&&(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`space-y-2`,children:v.items.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 py-2 border-b border-gray-50 last:border-0`,children:[(0,B.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,children:e.ok?(0,B.jsx)(zs,{className:`h-4 w-4 text-green-500`}):e.id===`daemon_process`?(0,B.jsx)(Tc,{className:`h-4 w-4 text-yellow-500`}):(0,B.jsx)(Bs,{className:`h-4 w-4 text-red-500`})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.label}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5 break-all`,children:e.detail})]})]},e.id))})}),v&&(0,B.jsx)(Y,{className:v.hooksHealthy?`!border-green-200 !bg-green-50`:`!border-yellow-200 !bg-yellow-50`,children:(0,B.jsx)(`div`,{className:`flex items-center gap-2`,children:v.hooksHealthy?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(zs,{className:`h-5 w-5 text-green-600`}),(0,B.jsx)(`p`,{className:`text-sm font-medium text-green-700`,children:`Hooks 相关环境正常`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Tc,{className:`h-5 w-5 text-yellow-600`}),(0,B.jsx)(`p`,{className:`text-sm font-medium text-yellow-700`,children:`检测到 Hooks 环境不完整,请点击「一键修复」`})]})})})]})]}),(0,B.jsx)(Q2,{open:m.open,title:m.title,description:m.description,variant:`danger`,onConfirm:m.onConfirm,onCancel:()=>h({...m,open:!1})})]})}function z4({children:e,fallback:t,rootMargin:n=`200px`}){let[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(null);return(0,z.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,B.jsx)(`div`,{ref:a,style:{minHeight:r?`auto`:`400px`},children:r?e:t||(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96 text-gray-400`,children:`加载中...`})})}var B4=[`#667eea`,`#10b981`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#06b6d4`],V4={"7d":7,"30d":30,"90d":90,custom:0};function H4(){let[e,t]=(0,z.useState)(`30d`),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),o=V4[e],s=e===`custom`?n?`${n}T00:00:00`:void 0:Y2(Z2(new Date,o),`yyyy-MM-dd'T'HH:mm:ss`),c=e===`custom`&&i?`${i}T23:59:59`:void 0,{data:l,isLoading:u,isError:d,refetch:f}=ct({queryKey:[`sessions`,{limit:500,startTime:s,endTime:c}],queryFn:()=>Vc({limit:500,start_time:s}).then(e=>e.data)}),{data:p,isLoading:m,isError:h,refetch:g}=ct({queryKey:[`events`,{limit:1e3,startTime:s,endTime:c}],queryFn:()=>Gc({limit:1e3,start_time:s,end_time:c}).then(e=>e.data)}),{data:_,isLoading:v}=ct({queryKey:[`event-stats`],queryFn:()=>Kc().then(e=>e.data)}),{data:y}=ct({queryKey:[`api-usage-stats`,e],queryFn:()=>Ll(e===`custom`?90:o).then(e=>e.data),staleTime:6e4}),b=u||m||v,x=d||h,S=()=>{let e=[`日期`,`会话数`],t=C.map(e=>[e.date,e.count]);n4(`analytics-sessions-${Y2(new Date,`yyyyMMdd`)}.csv`,e,t)},C=(0,z.useMemo)(()=>{if(!l?.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=Y2(new Date(e.getTime()+n*24*60*60*1e3),`MM-dd`);return{date:r,count:l.items.filter(e=>Y2(md(e.start_time),`MM-dd`)===r).length}})}return Array.from({length:o},(e,t)=>{let n=Y2(Z2(new Date,o-1-t),`MM-dd`);return{date:n,count:l.items.filter(e=>Y2(md(e.start_time),`MM-dd`)===n).length}})},[l?.items,o,e,n,i]),w=(0,z.useMemo)(()=>p?.items?Array.from({length:24},(e,t)=>{let n=p.items.filter(e=>md(e.timestamp).getHours()===t).length;return{hour:`${t}:00`,count:n}}):[],[p?.items]),T=(0,z.useMemo)(()=>{if(!p?.items)return[];let e=p.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}))},[p?.items]),E=(0,z.useMemo)(()=>{if(!p?.items)return[];let e=p.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:e,value:t}))},[p?.items]),{sessionDurations:D,durationBuckets:O}=(0,z.useMemo)(()=>{if(!l?.items)return{sessionDurations:[],durationBuckets:[]};let e=l.items.filter(e=>e.end_time).map(e=>{let t=(md(e.end_time).getTime()-md(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}]}},[l?.items]),{avgSessionEvents:k,avgSessionDuration:A}=(0,z.useMemo)(()=>({avgSessionEvents:l?.items.reduce((e,t)=>e+t.event_count,0)/(l?.items.length||1)||0,avgSessionDuration:D.reduce((e,t)=>e+t,0)/(D.length||1)||0}),[l?.items,D]);return b?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})}):x?(0,B.jsx)(r4,{message:`分析数据加载失败`,onRetry:()=>{f(),g()}}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Ms,{className:`h-4 w-4 text-gray-400`}),(0,B.jsx)(`span`,{className:`text-sm text-gray-600`,children:`时间范围:`}),(0,B.jsx)(`div`,{className:`flex gap-1 border border-gray-200 rounded-lg overflow-hidden`,children:[`7d`,`30d`,`90d`,`custom`].map(n=>(0,B.jsx)(`button`,{onClick:()=>t(n),className:ud(`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,B.jsx)(J,{variant:`outline`,size:`sm`,icon:qs,onClick:S,children:`导出数据`})]}),e===`custom`&&(0,B.jsxs)(`div`,{className:`flex items-center gap-3 pl-6`,children:[(0,B.jsx)(`label`,{className:`text-sm text-gray-600`,children:`开始日期:`}),(0,B.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,B.jsx)(`label`,{className:`text-sm text-gray-600`,children:`结束日期:`}),(0,B.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,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Ts,{className:`h-7 w-7 text-indigo-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:k.toFixed(1)}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话事件数`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Hs,{className:`h-7 w-7 text-green-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:A.toFixed(1)}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话时长(分钟)`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Ac,{className:`h-7 w-7 text-amber-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:p?.total||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总事件数`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(wc,{className:`h-7 w-7 text-purple-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:l?.total||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总会话数`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,B.jsx)(Y,{title:`最近 ${o} 天会话趋势`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(V0,{data:C,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`date`}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`count`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3})]})})})}),(0,B.jsx)(Y,{title:`24 小时事件分布`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(v0,{data:w,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`hour`}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{}),(0,B.jsx)(_Z,{type:`monotone`,dataKey:`count`,stroke:`#10b981`,strokeWidth:2})]})})})}),(0,B.jsx)(Y,{title:`项目活跃度 Top 10`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(b0,{data:T,layout:`vertical`,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{type:`number`}),(0,B.jsx)(R$,{dataKey:`name`,type:`category`,width:100}),(0,B.jsx)(hW,{}),(0,B.jsx)(n$,{dataKey:`value`,fill:`#667eea`})]})})})}),(0,B.jsx)(Y,{title:`工具使用排行 Top 15`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(b0,{data:E,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`name`,angle:-45,textAnchor:`end`,height:80}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{}),(0,B.jsx)(n$,{dataKey:`value`,fill:`#10b981`})]})})})}),(0,B.jsx)(Y,{title:`会话时长分布`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(z0,{children:[(0,B.jsx)(pJ,{data:O,cx:`50%`,cy:`50%`,labelLine:!1,label:({range:e,count:t})=>`${e}: ${t}`,outerRadius:80,fill:`#8884d8`,dataKey:`count`,children:O.map((e,t)=>(0,B.jsx)(gW,{fill:B4[t%B4.length]},`cell-${t}`))}),(0,B.jsx)(hW,{})]})})})}),(0,B.jsx)(Y,{title:`事件类型趋势`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(V0,{data:_?.stats.slice(0,30)||[],children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`date`}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{}),(0,B.jsx)(LA,{}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`count`,stackId:`1`,stroke:`#667eea`,fill:`#667eea`})]})})})})]}),y&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,B.jsx)(Ks,{className:`h-5 w-5 text-gray-500`}),(0,B.jsx)(`h2`,{className:`text-base font-semibold text-gray-800`,children:`Token 与费用统计`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[`$`,y.summary.totalCost.toFixed(4)]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总费用(USD)`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(y.summary.totalTokens/1e3).toFixed(1),`K`]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总 Token 数`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(y.summary.totalTokensIn/1e3).toFixed(1),`K`]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`输入 Token`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(y.summary.totalTokensOut/1e3).toFixed(1),`K`]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`输出 Token`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,B.jsx)(Y,{title:`每日 Token 趋势`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(V0,{data:y.dailyTrend,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`date`}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{formatter:e=>`${(e/1e3).toFixed(1)}K`}),(0,B.jsx)(LA,{}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`tokens_in`,name:`输入`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3,stackId:`1`}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`tokens_out`,name:`输出`,stroke:`#10b981`,fill:`#10b981`,fillOpacity:.3,stackId:`1`})]})})})}),(0,B.jsx)(Y,{title:`每日费用趋势(USD)`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(b0,{data:y.dailyTrend,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`date`}),(0,B.jsx)(R$,{tickFormatter:e=>`$${e.toFixed(3)}`}),(0,B.jsx)(hW,{formatter:e=>`$${e.toFixed(4)}`}),(0,B.jsx)(n$,{dataKey:`cost_usd`,name:`费用`,fill:`#f59e0b`})]})})})}),y.byModel.length>0&&(0,B.jsx)(Y,{title:`按模型费用分布`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(z0,{children:[(0,B.jsx)(pJ,{data:y.byModel,dataKey:`cost`,nameKey:`model`,cx:`50%`,cy:`50%`,outerRadius:80,label:({model:e,cost:t})=>`${e}: $${t.toFixed(4)}`,children:y.byModel.map((e,t)=>(0,B.jsx)(gW,{fill:B4[t%B4.length]},t))}),(0,B.jsx)(hW,{formatter:e=>`$${e.toFixed(4)}`})]})})})})]})]})]})}function U4(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=U4(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var W4={value:()=>{}};function G4(){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 K4(n)}function K4(e){this._=e}function q4(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}})}K4.prototype=G4.prototype={constructor:K4,on:function(e,t){var n=this._,r=q4(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=J4(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]=Y4(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Y4(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 K4(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 J4(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Y4(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=W4,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var X4={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 Z4(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),X4.hasOwnProperty(t)?{space:X4[t],local:e}:e}function Q4(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 $4(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function e3(e){var t=Z4(e);return(t.local?$4:Q4)(t)}function t3(){}function n3(e){return e==null?t3:function(){return this.querySelector(e)}}function r3(e){typeof e!=`function`&&(e=n3(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 V6(r,this._parents)}function i3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function a3(){return[]}function o3(e){return e==null?a3:function(){return this.querySelectorAll(e)}}function s3(e){return function(){return i3(e.apply(this,arguments))}}function c3(e){e=typeof e==`function`?s3(e):o3(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 V6(r,i)}function l3(e){return function(){return this.matches(e)}}function u3(e){return function(t){return t.matches(e)}}var d3=Array.prototype.find;function f3(e){return function(){return d3.call(this.children,e)}}function p3(){return this.firstElementChild}function m3(e){return this.select(e==null?p3:f3(typeof e==`function`?e:u3(e)))}var h3=Array.prototype.filter;function g3(){return Array.from(this.children)}function _3(e){return function(){return h3.call(this.children,e)}}function v3(e){return this.selectAll(e==null?g3:_3(typeof e==`function`?e:u3(e)))}function y3(e){typeof e!=`function`&&(e=l3(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 V6(r,this._parents)}function b3(e){return Array(e.length)}function x3(){return new V6(this._enter||this._groups.map(b3),this._parents)}function S3(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}S3.prototype={constructor:S3,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 C3(e){return function(){return e}}function w3(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 S3(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function T3(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 S3(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function E3(e){return e.__data__}function D3(e,t){if(!arguments.length)return Array.from(this,E3);var n=t?T3:w3,r=this._parents,i=this._groups;typeof e!=`function`&&(e=C3(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=O3(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 V6(o,r),o._enter=s,o._exit=c,o}function O3(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function k3(){return new V6(this._exit||this._groups.map(b3),this._parents)}function A3(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 j3(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 V6(s,this._parents)}function M3(){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 N3(e){e||=P3;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 V6(i,this._parents).order()}function P3(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function F3(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function I3(){return Array.from(this)}function L3(){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 R3(){let e=0;for(let t of this)++e;return e}function z3(){return!this.node()}function B3(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 V3(e){return function(){this.removeAttribute(e)}}function H3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function U3(e,t){return function(){this.setAttribute(e,t)}}function W3(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function G3(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function K3(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 q3(e,t){var n=Z4(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?H3:V3:typeof t==`function`?n.local?K3:G3:n.local?W3:U3)(n,t))}function J3(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Y3(e){return function(){this.style.removeProperty(e)}}function X3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Z3(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Q3(e,t,n){return arguments.length>1?this.each((t==null?Y3:typeof t==`function`?Z3:X3)(e,t,n??``)):$3(this.node(),e)}function $3(e,t){return e.style.getPropertyValue(t)||J3(e).getComputedStyle(e,null).getPropertyValue(t)}function e6(e){return function(){delete this[e]}}function t6(e,t){return function(){this[e]=t}}function n6(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function r6(e,t){return arguments.length>1?this.each((t==null?e6:typeof t==`function`?n6:t6)(e,t)):this.node()[e]}function i6(e){return e.trim().split(/^|\s+/)}function a6(e){return e.classList||new o6(e)}function o6(e){this._node=e,this._names=i6(e.getAttribute(`class`)||``)}o6.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 s6(e,t){for(var n=a6(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function c6(e,t){for(var n=a6(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function l6(e){return function(){s6(this,e)}}function u6(e){return function(){c6(this,e)}}function d6(e,t){return function(){(t.apply(this,arguments)?s6:c6)(this,e)}}function f6(e,t){var n=i6(e+``);if(arguments.length<2){for(var r=a6(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?d6:t?l6:u6)(n,t))}function p6(){this.textContent=``}function m6(e){return function(){this.textContent=e}}function h6(e){return function(){this.textContent=e.apply(this,arguments)??``}}function g6(e){return arguments.length?this.each(e==null?p6:(typeof e==`function`?h6:m6)(e)):this.node().textContent}function _6(){this.innerHTML=``}function v6(e){return function(){this.innerHTML=e}}function y6(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function b6(e){return arguments.length?this.each(e==null?_6:(typeof e==`function`?y6:v6)(e)):this.node().innerHTML}function x6(){this.nextSibling&&this.parentNode.appendChild(this)}function S6(){return this.each(x6)}function C6(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function w6(){return this.each(C6)}function T6(e){var t=typeof e==`function`?e:e3(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function E6(){return null}function D6(e,t){var n=typeof e==`function`?e:e3(e),r=t==null?E6:typeof t==`function`?t:n3(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function O6(){var e=this.parentNode;e&&e.removeChild(this)}function k6(){return this.each(O6)}function A6(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function j6(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function M6(e){return this.select(e?j6:A6)}function N6(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function P6(e){return function(t){e.call(this,t,this.__data__)}}function F6(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 I6(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 L6(e,t,n){return function(){var r=this.__on,i,a=P6(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 R6(e,t,n){var r=F6(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?L6:I6,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function z6(e,t,n){var r=J3(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 Fie(e,t){return function(){return z6(this,e,t)}}function Iie(e,t){return function(){return z6(this,e,t.apply(this,arguments))}}function Lie(e,t){return this.each((typeof t==`function`?Iie:Fie)(e,t))}function*Rie(){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 B6=[null];function V6(e,t){this._groups=e,this._parents=t}function H6(){return new V6([[document.documentElement]],B6)}function zie(){return this}V6.prototype=H6.prototype={constructor:V6,select:r3,selectAll:c3,selectChild:m3,selectChildren:v3,filter:y3,data:D3,enter:x3,exit:k3,join:A3,merge:j3,selection:zie,order:M3,sort:N3,call:F3,nodes:I3,node:L3,size:R3,empty:z3,each:B3,attr:q3,style:Q3,property:r6,classed:f6,text:g6,html:b6,raise:S6,lower:w6,append:T6,insert:D6,remove:k6,clone:M6,datum:N6,on:R6,dispatch:Lie,[Symbol.iterator]:Rie};function U6(e){return typeof e==`string`?new V6([[document.querySelector(e)]],[document.documentElement]):new V6([[e]],B6)}function Bie(e){let t;for(;t=e.sourceEvent;)e=t;return e}function W6(e,t){if(e=Bie(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 Vie={passive:!1},G6={capture:!0,passive:!1};function K6(e){e.stopImmediatePropagation()}function q6(e){e.preventDefault(),e.stopImmediatePropagation()}function J6(e){var t=e.document.documentElement,n=U6(e).on(`dragstart.drag`,q6,G6);`onselectstart`in t?n.on(`selectstart.drag`,q6,G6):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Y6(e,t){var n=e.document.documentElement,r=U6(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,q6,G6),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 X6=e=>()=>e;function Z6(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}})}Z6.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hie(e){return!e.ctrlKey&&!e.button}function Uie(){return this.parentNode}function Wie(e,t){return t??{x:e.x,y:e.y}}function Gie(){return navigator.maxTouchPoints||`ontouchstart`in this}function Q6(){var e=Hie,t=Uie,n=Wie,r=Gie,i={},a=G4(`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`,_,Vie).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&&(U6(n.view).on(`mousemove.drag`,m,G6).on(`mouseup.drag`,h,G6),J6(n.view),K6(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(q6(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){U6(e.view).on(`mousemove.drag mouseup.drag`,null),Y6(e.view,l),q6(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]))&&(K6(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])&&(q6(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])&&(K6(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=W6(l||r,t),p,m,h;if((h=n.call(e,new Z6(`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=W6(l||a,t),_=o;break}u.call(r,e,new Z6(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:X6(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:X6(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:X6(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:X6(!!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 $6=0,e8=0,t8=0,n8=1e3,r8,i8,a8=0,o8=0,s8=0,c8=typeof performance==`object`&&performance.now?performance:Date,l8=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function u8(){return o8||=(l8(Kie),c8.now()+s8)}function Kie(){o8=0}function d8(){this._call=this._time=this._next=null}d8.prototype=f8.prototype={constructor:d8,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?u8():+n)+(t==null?0:+t),!this._next&&i8!==this&&(i8?i8._next=this:r8=this,i8=this),this._call=e,this._time=n,m8()},stop:function(){this._call&&(this._call=null,this._time=1/0,m8())}};function f8(e,t,n){var r=new d8;return r.restart(e,t,n),r}function qie(){u8(),++$6;for(var e=r8,t;e;)(t=o8-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$6}function p8(){o8=(a8=c8.now())+s8,$6=e8=0;try{qie()}finally{$6=0,Yie(),o8=0}}function Jie(){var e=c8.now(),t=e-a8;t>n8&&(s8-=t,a8=e)}function Yie(){for(var e,t=r8,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:r8=n);i8=e,m8(r)}function m8(e){$6||(e8&&=clearTimeout(e8),e-o8>24?(e<1/0&&(e8=setTimeout(p8,e-c8.now()-s8)),t8&&=clearInterval(t8)):(t8||=(a8=c8.now(),setInterval(Jie,n8)),$6=1,l8(p8)))}function h8(e,t,n){var r=new d8;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Xie=G4(`start`,`end`,`cancel`,`interrupt`),Zie=[];function g8(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Qie(e,n,{name:t,index:r,group:i,on:Xie,tween:Zie,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function _8(e,t){var n=y8(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function v8(e,t){var n=y8(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function y8(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Qie(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=f8(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 h8(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(h8(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 b8(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 $ie(e){return this.each(function(){b8(this,e)})}function eae(e,t){var n,r;return function(){var i=v8(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 tae(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=v8(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 nae(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=y8(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?eae:tae)(n,e,t))}function x8(e,t,n){var r=e._id;return e.each(function(){var e=v8(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return y8(e,r).value[t]}}function S8(e,t){var n;return(typeof t==`number`?cI:t instanceof HF?sI:(n=HF(t))?(t=n,sI):dI)(e,t)}function rae(e){return function(){this.removeAttribute(e)}}function iae(e){return function(){this.removeAttributeNS(e.space,e.local)}}function aae(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 oae(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 sae(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 cae(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 lae(e,t){var n=Z4(e),r=n===`transform`?kne:S8;return this.attrTween(e,typeof t==`function`?(n.local?cae:sae)(n,r,x8(this,`attr.`+e,t)):t==null?(n.local?iae:rae)(n):(n.local?oae:aae)(n,r,t))}function uae(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function dae(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fae(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&dae(e,i)),n}return i._value=t,i}function pae(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&uae(e,i)),n}return i._value=t,i}function mae(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=Z4(e);return this.tween(n,(r.local?fae:pae)(r,t))}function hae(e,t){return function(){_8(this,e).delay=+t.apply(this,arguments)}}function gae(e,t){return t=+t,function(){_8(this,e).delay=t}}function _ae(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?hae:gae)(t,e)):y8(this.node(),t).delay}function vae(e,t){return function(){v8(this,e).duration=+t.apply(this,arguments)}}function yae(e,t){return t=+t,function(){v8(this,e).duration=t}}function bae(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?vae:yae)(t,e)):y8(this.node(),t).duration}function xae(e,t){if(typeof t!=`function`)throw Error();return function(){v8(this,e).ease=t}}function Sae(e){var t=this._id;return arguments.length?this.each(xae(t,e)):y8(this.node(),t).ease}function Cae(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();v8(this,e).ease=n}}function wae(e){if(typeof e!=`function`)throw Error();return this.each(Cae(this._id,e))}function Tae(e){typeof e!=`function`&&(e=l3(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 w8(r,this._parents,this._name,this._id)}function Eae(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 w8(o,this._parents,this._name,this._id)}function Dae(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 Oae(e,t,n){var r,i,a=Dae(t)?_8:v8;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function kae(e,t){var n=this._id;return arguments.length<2?y8(this.node(),n).on.on(e):this.each(Oae(n,e,t))}function Aae(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function jae(){return this.on(`end.remove`,Aae(this._id))}function Mae(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=n3(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,g8(l[f],t,n,f,l,y8(u,n)));return new w8(a,this._parents,t,n)}function Nae(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=o3(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=y8(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&g8(p,t,n,h,f,m);a.push(f),o.push(u)}return new w8(a,o,t,n)}var Pae=H6.prototype.constructor;function Fae(){return new Pae(this._groups,this._parents)}function Iae(e,t){var n,r,i;return function(){var a=$3(this,e),o=(this.style.removeProperty(e),$3(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function C8(e){return function(){this.style.removeProperty(e)}}function Lae(e,t,n){var r,i=n+``,a;return function(){var o=$3(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Rae(e,t,n){var r,i,a;return function(){var o=$3(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),$3(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function zae(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=v8(this,e),l=c.on,u=c.value[a]==null?s||=C8(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Bae(e,t,n){var r=(e+=``)==`transform`?One:S8;return t==null?this.styleTween(e,Iae(e,r)).on(`end.style.`+e,C8(e)):typeof t==`function`?this.styleTween(e,Rae(e,r,x8(this,`style.`+e,t))).each(zae(this._id,e)):this.styleTween(e,Lae(e,r,t),n).on(`end.style.`+e,null)}function Vae(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Hae(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Vae(e,a,n)),r}return a._value=t,a}function Uae(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,Hae(e,t,n??``))}function Wae(e){return function(){this.textContent=e}}function Gae(e){return function(){this.textContent=e(this)??``}}function Kae(e){return this.tween(`text`,typeof e==`function`?Gae(x8(this,`text`,e)):Wae(e==null?``:e+``))}function qae(e){return function(t){this.textContent=e.call(this,t)}}function Jae(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&qae(r)),t}return r._value=e,r}function Yae(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,Jae(e))}function Xae(){for(var e=this._name,t=this._id,n=T8(),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=y8(c,t);g8(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new w8(r,this._parents,e,n)}function Zae(){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=v8(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 Qae=0;function w8(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function $ae(e){return H6().transition(e)}function T8(){return++Qae}var E8=H6.prototype;w8.prototype=$ae.prototype={constructor:w8,select:Mae,selectAll:Nae,selectChild:E8.selectChild,selectChildren:E8.selectChildren,filter:Tae,merge:Eae,selection:Fae,transition:Xae,call:E8.call,nodes:E8.nodes,node:E8.node,size:E8.size,empty:E8.empty,each:E8.each,on:kae,attr:lae,attrTween:mae,style:Bae,styleTween:Uae,text:Kae,textTween:Yae,remove:jae,tween:nae,delay:_ae,duration:bae,ease:Sae,easeVarying:wae,end:Zae,[Symbol.iterator]:E8[Symbol.iterator]};function eoe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var toe={time:null,delay:0,duration:250,ease:eoe};function noe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function roe(e){var t,n;e instanceof w8?(t=e._id,e=e._name):(t=T8(),(n=toe).time=u8(),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])&&g8(c,e,t,l,o,n||noe(c,t));return new w8(r,this._parents,e,t)}H6.prototype.interrupt=$ie,H6.prototype.transition=roe;var D8=e=>()=>e;function ioe(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 O8(e,t,n){this.k=e,this.x=t,this.y=n}O8.prototype={constructor:O8,scale:function(e){return e===1?this:new O8(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new O8(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 k8=new O8(1,0,0);A8.prototype=O8.prototype;function A8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return k8;return e.__zoom}function j8(e){e.stopImmediatePropagation()}function M8(e){e.preventDefault(),e.stopImmediatePropagation()}function aoe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function ooe(){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 N8(){return this.__zoom||k8}function soe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function coe(){return navigator.maxTouchPoints||`ontouchstart`in this}function loe(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 P8(){var e=aoe,t=ooe,n=loe,r=soe,i=coe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=bI,l=G4(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,N8).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`,N8),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(k8.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 O8(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 O8(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 O8(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=U6(this.that).datum();l.call(e,this.that,new ioe(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=W6(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)],b8(this),s.start();M8(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=U6(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=W6(t,i),l=t.clientX,u=t.clientY;J6(t.view),j8(t),a.mouse=[c,this.__zoom.invert(c)],b8(this),a.start();function d(e){if(M8(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]=W6(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Y6(e.view,a.moved),M8(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=W6(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);M8(r),s>0?U6(this).transition().duration(s).call(x,d,c,r):U6(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(j8(t),s=0;s<i;++s)c=r[s],l=W6(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)),b8(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(M8(e),s=0;s<a;++s)c=i[s],l=W6(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(j8(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=W6(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=U6(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:D8(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:D8(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:D8(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:D8([[+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 F8={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]],L8=[`Enter`,` `,`Escape`],R8={"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`},z8;(function(e){e.Strict=`strict`,e.Loose=`loose`})(z8||={});var B8;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(B8||={});var V8;(function(e){e.Partial=`partial`,e.Full=`full`})(V8||={});var H8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},U8;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(U8||={});var W8;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(W8||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var G8={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function K8(e){return e===null?null:e?`valid`:`invalid`}var q8=e=>`id`in e&&`source`in e&&`target`in e,uoe=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),J8=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Y8=(e,t=[0,0])=>{let{width:n,height:r}=b5(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},doe=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:o5(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):J8(n)?n:t.nodeLookup.get(n.id)),i5(e,i?c5(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),X8=(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=i5(n,c5(e)),r=!0)}),r?o5(n):{x:0,y:0,width:0,height:0}},Z8=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...m5(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=u5(s,s5(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},foe=(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 poe(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 moe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=_5(X8(poe(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 Q8({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`,F8.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&y5(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=y5(d)?e5(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,F8.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 hoe({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=foe(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 $8=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),e5=(e={x:0,y:0},t,n)=>({x:$8(e.x,t[0][0],t[1][0]-(n?.width??0)),y:$8(e.y,t[0][1],t[1][1]-(n?.height??0))});function t5(e,t,n){let{width:r,height:i}=b5(n),{x:a,y:o}=n.internals.positionAbsolute;return e5(e,[[a,o],[a+r,o+i]],t)}var n5=(e,t,n)=>e<t?$8(Math.abs(e-t),1,t)/t:e>n?-$8(Math.abs(e-n),1,t)/t:0,r5=(e,t,n=15,r=40)=>[n5(e.x,r,t.width-r)*n,n5(e.y,r,t.height-r)*n],i5=(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)}),a5=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),o5=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),s5=(e,t=[0,0])=>{let{x:n,y:r}=J8(e)?e.internals.positionAbsolute:Y8(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}},c5=(e,t=[0,0])=>{let{x:n,y:r}=J8(e)?e.internals.positionAbsolute:Y8(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)}},l5=(e,t)=>o5(i5(a5(e),a5(t))),u5=(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)},d5=e=>f5(e.width)&&f5(e.height)&&f5(e.x)&&f5(e.y),f5=e=>!isNaN(e)&&isFinite(e),goe=(e,t)=>{},p5=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),m5=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?p5(s,o):s},h5=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function g5(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 _oe(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=g5(e,n),i=g5(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=g5(e.top??e.y??0,n),i=g5(e.bottom??e.y??0,n),a=g5(e.left??e.x??0,t),o=g5(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 voe(e,t,n,r,i,a){let{x:o,y:s}=h5(e,[t,n,r]),{x:c,y:l}=h5({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 _5=(e,t,n,r,i,a)=>{let o=_oe(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=$8(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=voe(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}},v5=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function y5(e){return e!=null&&e!==`parent`}function b5(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function x5(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function S5(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 C5(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function yoe(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function boe(e){return{...R8,...e||{}}}function w5(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=k5(e),s=m5({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?p5(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var T5=e=>({width:e.offsetWidth,height:e.offsetHeight}),E5=e=>e?.getRootNode?.()||window?.document,xoe=[`INPUT`,`SELECT`,`TEXTAREA`];function D5(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?xoe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var O5=e=>`clientX`in e,k5=(e,t)=>{let n=O5(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)}},A5=(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,...T5(t)}})};function j5({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 M5(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 $.Left:return[t-M5(t-r,a),n];case $.Right:return[t+M5(r-t,a),n];case $.Top:return[t,n-M5(n-i,a)];case $.Bottom:return[t,n+M5(i-n,a)]}}function P5({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.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]=j5({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 F5({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 Soe({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 Coe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=i5(c5(e),c5(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),u5({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},o5(a))>0}var woe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Toe=(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)),Eoe=(e,t,n={})=>{if(!e.source||!e.target)return F8.error006(),t;let r=n.getEdgeId||woe,i;return i=q8(e)?{...e}:{...e,id:r(e)},Toe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function I5({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=F5({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var L5={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},Doe=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.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},R5=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Ooe({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=L5[t],c=L5[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=Doe({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]=F5({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 koe(e,t,n,r){let i=Math.min(R5(e,t)/2,R5(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 z5({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Ooe({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+=koe(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 B5(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Aoe(e){let{sourceNode:t,targetNode:n}=e;if(!B5(t)||!B5(n))return null;let r=t.internals.handleBounds||V5(t.handles),i=n.internals.handleBounds||V5(n.handles),a=U5(r?.source??[],e.sourceHandle),o=U5(e.connectionMode===z8.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,F8.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=H5(t,a,s),u=H5(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function V5(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 H5(e,t,n=$.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??b5(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function U5(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function W5(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function joe(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=W5(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 G5=1e3,Moe=10,K5={nodeOrigin:[0,0],nodeExtent:I8,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Noe={...K5,checkEquality:!0};function q5(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Poe(e,t,n){let r=q5(K5,n);for(let n of e.values())if(n.parentId)X5(n,e,t,r);else{let e=e5(Y8(n,r.nodeOrigin),y5(n.extent)?n.extent:r.nodeExtent,b5(n));n.internals.positionAbsolute=e}}function Foe(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 J5(e){return e===`manual`}function Y5(e,t,n,r={}){let i=q5(Noe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!J5(i.zIndexMode)?G5: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=e5(Y8(u,i.nodeOrigin),y5(u.extent)?u.extent:i.nodeExtent,b5(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Foe(u,e),z:Z5(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&&X5(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Ioe(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 X5(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=q5(K5,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}Ioe(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*Moe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Loe(e,u,o,s,a&&!J5(c)?G5: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 Z5(e,t,n){let r=f5(e.zIndex)?e.zIndex:0;return J5(n)?r:r+(e.selected?t:0)}function Loe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=b5(e),l=Y8(e,n),u=y5(e.extent)?e5(l,e.extent,c):l,d=e5({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=t5(d,c,t));let f=Z5(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Q5(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=l5(a.get(n.parentId)?.expandedRect??s5(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=b5(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 Roe(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=T5(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=y5(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=t5(h,s,t.get(e.parentId)):m&&(h=e5(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:A5(`source`,r.nodeElement,p,d,e.id),target:A5(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&X5(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:s5(g,i)}))}}if(f.length>0){let e=Q5(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function zoe({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 $5(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 e7(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}`;$5(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),$5(`target`,s,c,e,i,o),t.set(r.id,r)}}function t7(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:t7(n,t):!1}function n7(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 Boe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!t7(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 r7({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 Voe({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=p5(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Hoe({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=U6(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?a5(X8(s)):null,x=v&&l?Voe({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)}:p5(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}=Q8({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]=r7({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]=r5(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=w5(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Boe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=r7({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Q6().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=w5(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=k5(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=w5(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=k5(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=k5(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]=r7({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||!n7(t,`.${g}`,v))&&(!_||n7(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Uoe(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())u5(i,s5(e))>0&&r.push(e);return r}var Woe=250;function Goe(e,t,n,r){let i=[],a=1/0,o=Uoe(e,n,t+Woe);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}=H5(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 i7(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,...H5(o,c,c.position,!0)}:c}function a7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Koe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var o7=()=>!0;function qoe(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:_=o7,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=E5(e.target),E=0,D,{x:O,y:k}=k5(e),A=a7(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=i7(i,A,r,c,t);if(!N)return;let ee=k5(e,j),P=!1,F=null,I=!1,L=null;function te(){if(!u||!j)return;let[e,t]=r5(ee,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let ne={...N,nodeId:i,type:A,position:N.position},re=c.get(i),R={inProgress:!0,isValid:null,from:H5(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:ee,toHandle:null,toPosition:G8[ne.position],toNode:null,pointer:ee};function ie(){M=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ie();function ae(e){if(!M){let{x:t,y:n}=k5(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!ne){oe(e);return}let a=b();ee=k5(e,j),D=Goe(m5(ee,a,!1,[1,1]),n,c,ne),P||=(te(),!0);let s=s7(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,F=s.connection,I=Koe(!!D,s.isValid);let u=c.get(i),f=u?H5(u,ne,$.Left,!0):R.from,p={...R,from:f,isValid:I,to:s.toHandle&&I?h5({x:s.toHandle.x,y:s.toHandle.y},a):ee,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:G8[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:ee};y(p),R=p}function oe(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&F&&I&&h?.(F);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),P=!1,I=!1,F=null,L=null,T.removeEventListener(`mousemove`,ae),T.removeEventListener(`mouseup`,oe),T.removeEventListener(`touchmove`,ae),T.removeEventListener(`touchend`,oe)}}T.addEventListener(`mousemove`,ae),T.addEventListener(`mouseup`,oe),T.addEventListener(`touchmove`,ae),T.addEventListener(`touchend`,oe)}function s7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=o7,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}=k5(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=a7(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===z8.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=i7(t,e,a,u,n,!0)}return _}var c7={onPointerDown:qoe,isValid:s7};function Joe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=U6(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&&v5()?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=P8().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:W6}}var l7=e=>({x:e.x,y:e.y,zoom:e.k}),u7=({x:e,y:t,zoom:n})=>k8.translate(e,t).scale(n),d7=(e,t)=>e.target.closest(`.${t}`),f7=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Yoe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,p7=(e,t=0,n=Yoe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},m7=e=>{let t=e.ctrlKey&&v5()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Xoe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(d7(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=W6(u),t=d*2**m7(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===B8.Vertical?0:u.deltaX*f,m=i===B8.Horizontal?0:u.deltaY*f;!v5()&&u.shiftKey&&i!==B8.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=l7(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 Zoe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=d7(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Qoe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=l7(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 $oe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&f7(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,l7(a.transform))}}function ese({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&f7(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=l7(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function tse({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`&&(d7(d,`${l}-flow__node`)||d7(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||d7(d,s)&&m||d7(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 nse({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=P8().scaleExtent([t,n]).translateExtent(r),f=U6(e).call(d);v({x:i.x,y:i.y,zoom:$8(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(m7);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?fI:bI).transform(p7(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:!f5(E)||E<0?0:E);let k=O?Xoe({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Zoe({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=Qoe({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=$oe({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=ese({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=tse({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=u7(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=u7(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=u7(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?A8(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`?fI:bI).scaleTo(p7(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`?fI:bI).scaleBy(p7(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=!f5(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 h7;(function(e){e.Line=`line`,e.Handle=`handle`})(h7||={});function rse({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 g7(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 _7(e,t){return Math.max(0,t-e)}function v7(e,t){return Math.max(0,e-t)}function y7(e,t,n){return Math.max(0,t-e,e-n)}function b7(e,t){return e?!t:t}function ise(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=y7(E,h,g),j=y7(D,_,v);if(o){let e=0,t=0;c&&w<0?e=_7(y+w+O,o[0][0]):!c&&w>0&&(e=v7(y+E+O,o[1][0])),l&&T<0?t=_7(b+T+k,o[0][1]):!l&&T>0&&(t=v7(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=v7(y+w,s[0][0]):!c&&w<0&&(e=_7(y+E,s[1][0])),l&&T>0?t=v7(b+T,s[0][1]):!l&&T<0&&(t=_7(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=y7(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?v7(b+k+E/C,o[1][1])*C:_7(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?_7(b+E/C,s[1][1])*C:v7(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=y7(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?v7(y+D*C+O,o[1][0])/C:_7(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?_7(y+D*C,s[1][0])/C:v7(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=(b7(c,l)?-w:w)/C:w=(b7(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 x7={width:0,height:0,x:0,y:0},ase={...x7,pointerX:0,pointerY:0,aspectRatio:1};function ose(e){return[[0,0],[e.measured.width,e.measured.height]]}function sse(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 cse({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=U6(e),o={controlDirection:g7(`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={...x7},h={...ase};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:g7(e)};let g,_=null,v=[],y,b,x,S=!1,C=Q6().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}=w5(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`?ose(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=sse(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=w5(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}=ise(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 P=rse({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),F={...m,direction:P};p?.(e,F)!==!1&&(S=!0,d?.(e,F),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 S7=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},lse=e=>e?S7(e):S7,{useDebugValue:use}=z.default,{useSyncExternalStoreWithSelector:dse}=bw.default,fse=e=>e;function C7(e,t=fse,n){let r=dse(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return use(r),r}var w7=(e,t)=>{let n=lse(e),r=(e,r=t)=>C7(n,e,r);return Object.assign(r,n),r},pse=(e,t)=>e?w7(e,t):w7;function T7(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 E7=(0,z.createContext)(null),D7=E7.Provider,O7=F8.error001();function k7(e,t){let n=(0,z.useContext)(E7);if(n===null)throw Error(O7);return C7(n,e,t)}function A7(){let e=(0,z.useContext)(E7);if(e===null)throw Error(O7);return(0,z.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var j7={display:`none`},mse={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},M7=`react-flow__node-desc`,N7=`react-flow__edge-desc`,hse=`react-flow__aria-live`,gse=e=>e.ariaLiveMessage,_se=e=>e.ariaLabelConfig;function vse({rfId:e}){let t=k7(gse);return(0,B.jsx)(`div`,{id:`${hse}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:mse,children:t})}function yse({rfId:e,disableKeyboardA11y:t}){let n=k7(_se);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{id:`${M7}-${e}`,style:j7,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,B.jsx)(`div`,{id:`${N7}-${e}`,style:j7,children:n[`edge.a11yDescription.default`]}),!t&&(0,B.jsx)(vse,{rfId:e})]})}var P7=(0,z.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,B.jsx)(`div`,{className:U4([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));P7.displayName=`Panel`;function bse({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,B.jsx)(P7,{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,B.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var xse=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}},F7=e=>e.id;function Sse(e,t){return T7(e.selectedNodes.map(F7),t.selectedNodes.map(F7))&&T7(e.selectedEdges.map(F7),t.selectedEdges.map(F7))}function Cse({onSelectionChange:e}){let t=A7(),{selectedNodes:n,selectedEdges:r}=k7(xse,Sse);return(0,z.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var wse=e=>!!e.onSelectionChangeHandlers;function Tse({onSelectionChange:e}){let t=k7(wse);return e||t?(0,B.jsx)(Cse,{onSelectionChange:e}):null}var I7=typeof window<`u`?z.useLayoutEffect:z.useEffect,L7=[0,0],Ese={x:0,y:0,zoom:1},R7=[...`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`],Dse=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}),z7={translateExtent:I8,nodeOrigin:L7,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Ose(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=k7(Dse,T7),l=A7();I7(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=z7,s()}),[]);let u=(0,z.useRef)(z7);return I7(()=>{for(let s of R7){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:boe(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},R7.map(t=>e[t])),null}function B7(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function kse(e){let[t,n]=(0,z.useState)(e===`system`?null:e);return(0,z.useEffect)(()=>{if(e!==`system`){n(e);return}let t=B7(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?B7()?.matches?`dark`:`light`:t}var V7=typeof document<`u`?document:null;function H7(e=null,t={target:V7,actInsideInputWithModifier:!0}){let[n,r]=(0,z.useState)(!1),i=(0,z.useRef)(!1),a=(0,z.useRef)(new Set([])),[o,s]=(0,z.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
67
|
+
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 c4(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var l4=(e,t)=>Math.abs(e-t)<1.01,u4=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},d4=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},f4=e=>e,p4=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},m4=(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(d4(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(d4(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},h4={passive:!0},g4=typeof window>`u`?!0:`onscrollend`in window,_4=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&g4?()=>void 0:u4(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,h4);let l=e.options.useScrollendEvent&&g4;return l&&n.addEventListener(`scrollend`,c,h4),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},v4=(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`]},y4=(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:f4,rangeExtractor:p4,onChange:()=>{},measureElement:v4,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=s4(()=>(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=s4(()=>[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=s4(()=>[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=s4(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?S4({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=s4(()=>{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=s4(()=>[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 c4(t[x4(0,t.length-1,e=>c4(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&&l4(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()}},x4=(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 S4({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=x4(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 C4=typeof document<`u`?z.useLayoutEffect:z.useEffect;function w4({useFlushSync:e=!0,...t}){let n=z.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,Mc.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=z.useState(()=>new b4(r));return i.setOptions(r),C4(()=>i._didMount(),[]),C4(()=>i._willUpdate()),i}function T4(e){return w4({observeElementRect:m4,observeElementOffset:_4,scrollToFn:y4,...e})}var E4={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 D4(e){if(!e)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function O4(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 k4(){let e=qe(),[t,n]=(0,z.useState)(200),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(`all`),[y,b]=(0,z.useState)(30),[x,S]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),C=(0,z.useRef)(null),w=_===`all`?void 0:Y2(Z2(new Date,_===`1d`?1:_===`7d`?7:30),`yyyy-MM-dd'T'HH:mm:ss`),{data:T,isLoading:E,isError:D,refetch:O}=ct({queryKey:[`events`,{limit:t,tool_name:r||void 0,start_time:w,search:p||void 0}],queryFn:()=>Gc({limit:t,tool_name:r||void 0,start_time:w,search:p||void 0}).then(e=>e.data)}),k=lt({mutationFn:e=>Il(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`events`]})}}),A=T?.items.filter(e=>!(a&&e.hook_type!==a||s&&e.project_path.split(`/`).pop()!==s||d&&![e.tool_name,D4(e.tool_input),D4(e.tool_output)].join(` `).toLowerCase().includes(d.toLowerCase())))||[],j=T4({count:A.length,getScrollElement:()=>C.current,estimateSize:()=>120,overscan:5});if(E)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});if(D)return(0,B.jsx)(r4,{message:`事件数据加载失败`,onRetry:()=>O()});let M=Array.from(new Set(T?.items.map(e=>e.project_path.split(`/`).pop()||``).filter(Boolean)||[])),N=A.reduce((e,t)=>{let n=t.tool_name||`N/A`;return e[n]=(e[n]||0)+1,e},{}),ee=Object.entries(N).sort((e,t)=>t[1]-e[1]).slice(0,10),P=Array.from(new Set(T?.items.map(e=>e.hook_type)||[]));return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center flex-1`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.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,B.jsx)(`div`,{className:`relative min-w-[200px] max-w-xs`,children:(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),m(h)},children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`内容全文搜索(回车确认)...`,value:h,onChange:e=>g(e.target.value),className:ud(`w-full pl-3 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm`,p?`border-blue-400 bg-blue-50`:`border-gray-200`)}),p&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>{m(``),g(``)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 text-xs`,children:`✕`})]})}),(0,B.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,B.jsx)(`option`,{value:``,children:`全部类型`}),P.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.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,B.jsx)(`option`,{value:``,children:`全部项目`}),M.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 border border-gray-200 rounded-lg overflow-hidden text-sm`,children:[(0,B.jsx)(Ms,{className:`h-3.5 w-3.5 text-gray-400 ml-2`}),[`all`,`1d`,`7d`,`30d`].map(e=>(0,B.jsx)(`button`,{onClick:()=>{v(e)},className:ud(`px-2.5 py-2 transition-colors`,_===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:e===`all`?`全部`:e},e))]}),(0,B.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,B.jsx)(`option`,{value:500,children:`500 条`}),(0,B.jsx)(`option`,{value:1e3,children:`1000 条`}),(0,B.jsx)(`option`,{value:2e3,children:`2000 条`}),(0,B.jsx)(`option`,{value:5e3,children:`5000 条`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,B.jsxs)(`select`,{value:y,onChange:e=>b(Number(e.target.value)),className:`px-2 py-1.5 border border-gray-200 rounded-lg text-sm`,children:[(0,B.jsx)(`option`,{value:7,children:`7天`}),(0,B.jsx)(`option`,{value:30,children:`30天`}),(0,B.jsx)(`option`,{value:90,children:`90天`})]}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:()=>{let e=[`时间`,`类型`,`工具`,`项目`,`会话ID`,`摘要`],t=A.map(e=>{let t=O4(e);return[e.timestamp,e.hook_type,e.tool_name||``,e.project_path.split(`/`).pop()||``,e.session_id.slice(0,12),t.subtitle]});n4(`events-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出`}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:Cc,onClick:()=>{S({open:!0,title:`清理历史事件`,description:`确认清理 ${y} 天前的已蒸馏事件?此操作不可撤销。`,onConfirm:()=>{k.mutate(y),S({...x,open:!1})}})},loading:k.isPending,children:`清理历史`}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:mc,onClick:()=>O(),children:`刷新`})]})]})}),(0,B.jsx)(Y,{title:`工具使用频率`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ee.map(([e,t])=>(0,B.jsxs)(`button`,{onClick:()=>{i(r===e?``:e),setCurrentPage(1)},className:ud(`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,B.jsx)(`span`,{className:`font-medium`,children:e}),(0,B.jsx)(`span`,{className:`ml-1 text-xs opacity-70`,children:t})]},e))})}),(0,B.jsx)(Y,{title:`执行轨迹 (${A.length})`,children:(0,B.jsx)(`div`,{ref:C,className:`h-[600px] overflow-auto`,style:{contain:`strict`},children:(0,B.jsx)(`div`,{style:{height:`${j.getTotalSize()}px`,width:`100%`,position:`relative`},children:j.getVirtualItems().map(e=>{let t=A[e.index],n=O4(t),r=l===t.event_id;return(0,B.jsx)(`div`,{"data-index":e.index,ref:j.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},className:`pb-2`,children:(0,B.jsxs)(`div`,{className:`border border-gray-100 rounded-lg overflow-hidden`,children:[(0,B.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,B.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,B.jsx)(`button`,{className:`text-gray-400`,children:r?(0,B.jsx)(Fs,{className:`h-4 w-4`}):(0,B.jsx)(Ls,{className:`h-4 w-4`})}),(0,B.jsx)(Vb,{size:`sm`,className:E4[t.hook_type]||`bg-gray-100 text-gray-700`,children:t.hook_type}),t.tool_name&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-sm text-gray-700 flex-shrink-0`,children:[t.tool_name===`Bash`?(0,B.jsx)(Sc,{className:`h-4 w-4`}):(0,B.jsx)(Xs,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`font-mono`,children:t.tool_name})]}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`div`,{className:`text-sm font-medium text-gray-900 truncate`,children:n.title}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500 truncate`,children:n.subtitle})]})]}),(0,B.jsx)(`div`,{className:`text-xs text-gray-400 font-mono ml-3`,children:Y2(md(t.timestamp),`HH:mm:ss`)})]}),(0,B.jsx)(My,{children:r&&(0,B.jsx)(zb.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,B.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-3 text-xs`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`会话`}),(0,B.jsxs)(`div`,{className:`font-mono text-gray-700`,children:[t.session_id.slice(0,12),`...`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`项目`}),(0,B.jsx)(`div`,{className:`text-gray-700`,children:t.project_path.split(`/`).pop()})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`时间`}),(0,B.jsx)(`div`,{className:`font-mono text-gray-700`,children:t.timestamp})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-gray-400 mb-1`,children:`类型`}),(0,B.jsx)(`div`,{className:`text-gray-700`,children:t.hook_type})]})]}),t.tool_input&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider`,children:[(0,B.jsx)(sc,{className:`h-3 w-3`}),` 输入`]}),(0,B.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:D4(t.tool_input)})]}),t.tool_output&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-gray-500 mb-2 uppercase tracking-wider`,children:[(0,B.jsx)(As,{className:`h-3 w-3`}),` 输出`]}),(0,B.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:D4(t.tool_output)})]})]})})})]})},t.event_id)})})})}),(0,B.jsx)(Q2,{open:x.open,title:x.title,description:x.description,variant:`danger`,onConfirm:x.onConfirm,onCancel:()=>S({...x,open:!1})})]})}var A4={analyze:`#3b82f6`,design:`#8b5cf6`,profile:`#06b6d4`,code:`#10b981`,test:`#f59e0b`,review:`#ef4444`,done:`#6b7280`};function j4(){let e=qe(),t=Pn(),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(`all`),[c,l]=(0,z.useState)(1),[u,d]=(0,z.useState)(20),[f,p]=(0,z.useState)(new Set),[m,h]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:g,isLoading:_,isError:v,refetch:y}=ct({queryKey:[`pipelines`],queryFn:()=>qc({limit:500}).then(e=>e.data),refetchInterval:1e4}),b=lt({mutationFn:e=>ol(e),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),x=lt({mutationFn:()=>cl(),onSuccess:()=>e.invalidateQueries({queryKey:[`pipelines`]})}),S=lt({mutationFn:e=>sl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`pipelines`]}),p(new Set)}});if(_)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});if(v)return(0,B.jsx)(r4,{message:`Pipeline 数据加载失败`,onRetry:()=>y()});let C=g?.items.filter(e=>e.status===`active`)||[],w=g?.items.filter(e=>e.status===`completed`)||[],T=o===`all`||o===`active`,E=o===`all`||o===`completed`,D=w.filter(e=>!(n&&!e.requirement.toLowerCase().includes(n.toLowerCase())||i&&e.complexity!==i)),O=Math.ceil(D.length/u),k=D.slice((c-1)*u,c*u);return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-gray-500`,children:[C.length,` 个活跃 · `,w.length,` 个已完成`,f.size>0&&` · 已选 ${f.size} 个`]}),(0,B.jsxs)(`select`,{value:o,onChange:e=>{s(e.target.value),l(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,B.jsx)(`option`,{value:`all`,children:`全部状态`}),(0,B.jsx)(`option`,{value:`active`,children:`仅活跃`}),(0,B.jsx)(`option`,{value:`completed`,children:`仅已完成`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[C.length>0&&f.size>0&&(0,B.jsxs)(J,{variant:`danger`,size:`sm`,icon:kc,onClick:()=>{f.size!==0&&h({open:!0,title:`批量关闭 Pipeline`,description:`确认关闭选中的 ${f.size} 个 Pipeline?`,onConfirm:()=>{S.mutate(Array.from(f)),h(e=>({...e,open:!1}))}})},loading:S.isPending,children:[`批量关闭 (`,f.size,`)`]}),C.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{variant:`secondary`,size:`sm`,onClick:()=>{f.size===C.length?p(new Set):p(new Set(C.map(e=>e.id)))},children:f.size===C.length?`取消全选`:`全选`}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:Cc,onClick:()=>{h({open:!0,title:`清理过期 Pipeline`,description:`确认关闭所有过期 Pipeline?`,onConfirm:()=>{x.mutate(),h(e=>({...e,open:!1}))}})},loading:x.isPending,children:`清理过期`})]}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:mc,onClick:()=>y(),children:`刷新`}),(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:()=>{let e=g?.items||[];n4(`pipelines-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,[`ID`,`需求`,`阶段`,`复杂度`,`状态`,`时长(s)`,`结果`,`创建时间`],e.map(e=>[e.id,e.requirement,e.current_phase,e.complexity,e.status,e.duration_seconds,e.outcome,e.created_at]))},children:`导出 CSV`})]})]}),T&&C.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider mb-3`,children:`活跃中`}),(0,B.jsx)(`div`,{className:`space-y-3`,children:C.map((e,n)=>(0,B.jsx)(zb.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.05},children:(0,B.jsx)(Y,{className:`!p-0 overflow-hidden cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>t(`/pipelines/${e.id}`),children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 flex-1 min-w-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:f.has(e.id),onChange:t=>{t.stopPropagation(),p(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,B.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg`,style:{backgroundColor:`${A4[e.phase]||`#6b7280`}20`},children:(0,B.jsx)(tc,{className:`h-5 w-5`,style:{color:A4[e.phase]||`#6b7280`}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`font-medium text-gray-900 truncate`,children:e.requirement}),(0,B.jsxs)(`div`,{className:`text-sm text-gray-500 flex items-center gap-3 mt-1`,children:[(0,B.jsx)(Vb,{variant:`info`,size:`sm`,children:e.phaseLabel}),(0,B.jsx)(`span`,{children:e.project}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Hs,{className:`h-3 w-3`}),Y2(md(e.createdAt),`MM-dd HH:mm`)]})]})]})]}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:kc,onClick:()=>{h({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{b.mutate(e.id),h(e=>({...e,open:!1}))}})},loading:b.isPending,children:`关闭`})]})})},e.id))})]}),E&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-gray-500 uppercase tracking-wider mb-3`,children:`历史记录`}),(0,B.jsxs)(Y,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center mb-4 pb-4 border-b border-gray-100`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索需求描述...`,value:n,onChange:e=>{r(e.target.value),l(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,B.jsxs)(`select`,{value:i,onChange:e=>{a(e.target.value),l(1)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,B.jsx)(`option`,{value:``,children:`全部复杂度`}),(0,B.jsx)(`option`,{value:`simple`,children:`简单`}),(0,B.jsx)(`option`,{value:`moderate`,children:`中等`}),(0,B.jsx)(`option`,{value:`complex`,children:`复杂`})]})]}),(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`需求`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`项目`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`类型`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`复杂度`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:k.map(e=>(0,B.jsxs)(`tr`,{className:`border-t border-gray-50 hover:bg-gray-50 cursor-pointer`,onClick:()=>t(`/pipelines/${e.id}`),children:[(0,B.jsx)(`td`,{className:`py-3 max-w-xs truncate`,children:e.requirement}),(0,B.jsx)(`td`,{className:`py-3`,children:e.project}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,children:e.taskType||`-`})}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,variant:e.complexity===`complex`?`danger`:e.complexity===`moderate`?`warning`:`default`,children:e.complexity||`-`})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:Y2(md(e.createdAt),`MM-dd HH:mm`)}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ys,onClick:n=>{n.stopPropagation(),t(`/pipelines/${e.id}`)},children:`查看`})})]},e.id))})]})}),D.length===0&&(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无历史记录`}),D.length>0&&(0,B.jsx)(t4,{currentPage:c,totalPages:O,onPageChange:l,pageSize:u,onPageSizeChange:e=>{d(e),l(1)},totalItems:D.length})]})]}),(0,B.jsx)(Q2,{open:m.open,title:m.title,description:m.description,variant:`danger`,onConfirm:m.onConfirm,onCancel:()=>h({...m,open:!1})})]})}var M4=[`analyze`,`design`,`profile`,`code`,`test`,`review`,`done`],N4={analyze:`#3b82f6`,design:`#8b5cf6`,profile:`#06b6d4`,code:`#10b981`,test:`#f59e0b`,review:`#ef4444`,done:`#6b7280`},P4={PreToolUse:`#3b82f6`,PostToolUse:`#10b981`,UserPromptSubmit:`#f59e0b`,Stop:`#ef4444`};function F4(){let{id:e}=In(),t=Pn(),n=jn(),r=qe(),[i,a]=(0,z.useState)(`tasks`),[o,s]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),c=n.state?.from||`/pipelines`,{data:l,isLoading:u}=ct({queryKey:[`pipeline`,e],queryFn:()=>Jc(e).then(e=>e.data),enabled:!!e,refetchInterval:5e3}),d=lt({mutationFn:()=>ol(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),t(c)}}),f=lt({mutationFn:({taskId:e,status:t})=>ul(e,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`pipeline`,e]}),r.invalidateQueries({queryKey:[`pipelines`]})}}),p=lt({mutationFn:()=>dl(e),onSuccess:()=>{alert(`已添加到执行队列,下次工具调用时自动注入提示`)}});if(u||!l)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let m=l.phase!==`done`,h=M4.indexOf(l.phase),g=l.tasks.reduce((e,t)=>(e[t.phase]||(e[t.phase]=[]),e[t.phase].push(t),e),{});return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(a4,{items:[{label:`Pipeline 列表`,path:`/pipelines`},{label:l.id.slice(0,12)+`...`}]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ds,onClick:()=>t(c),children:`返回`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-lg font-bold text-gray-900`,children:`Pipeline 执行轨迹`}),(0,B.jsxs)(`p`,{className:`text-sm text-gray-500`,children:[(0,B.jsx)(`span`,{className:`font-mono`,children:l.id.slice(0,12)}),l.sessionId&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`mx-2`,children:`·`}),(0,B.jsxs)(`span`,{className:`text-blue-600 cursor-pointer hover:underline`,onClick:()=>t(`/sessions/${l.sessionId}`),children:[`会话 `,l.sessionId.slice(0,8)]})]})]})]}),(0,B.jsx)(Vb,{variant:m?`info`:`success`,children:m?l.phaseLabel:`已完成`}),(0,B.jsx)(Vb,{children:l.taskType}),(0,B.jsx)(Vb,{variant:l.complexity===`complex`?`danger`:l.complexity===`moderate`?`warning`:`default`,children:l.complexity})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[l.sessionId&&(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:Ts,onClick:()=>t(`/sessions/${l.sessionId}`),children:`查看会话`}),m&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:dc,onClick:()=>p.mutate(),loading:p.isPending,children:`继续执行`}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:kc,onClick:()=>{s({open:!0,title:`关闭 Pipeline`,description:`确认关闭此 Pipeline?`,onConfirm:()=>{d.mutate(),s(e=>({...e,open:!1}))}})},children:`关闭`})]})]})]}),(0,B.jsx)(Y,{className:`!p-4`,children:(0,B.jsx)(`p`,{className:`text-sm text-gray-700 line-clamp-3`,children:l.requirement})}),(0,B.jsx)(Y,{className:`!p-4`,children:(0,B.jsx)(`div`,{className:`flex items-center gap-1`,children:M4.filter(e=>e!==`done`).map((e,t)=>{let n=e===l.phase,r=h>t||l.phase===`done`,i=N4[e]||`#6b7280`;return(0,B.jsxs)(`div`,{className:`flex items-center flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col items-center flex-1`,children:[(0,B.jsx)(`div`,{className:ud(`w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all`,r?`text-white`:n?`text-white ring-4 ring-offset-2`:`bg-gray-200 text-gray-500`),style:r||n?{backgroundColor:i,ringColor:`${i}40`}:{},children:r?`✓`:t+1}),(0,B.jsx)(`span`,{className:ud(`text-xs mt-1`,n?`font-bold text-gray-900`:`text-gray-500`),children:e})]}),t<M4.length-2&&(0,B.jsx)(`div`,{className:ud(`h-0.5 flex-1 mx-1`,r?`bg-green-400`:`bg-gray-200`)})]},e)})})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-3`,children:[(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-blue-600`,children:l.stats.totalEvents}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`事件`})]}),(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsxs)(`div`,{className:`text-xl font-bold text-green-600`,children:[l.stats.completedTasks,`/`,l.stats.totalTasks]}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`任务`})]}),(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-purple-600`,children:l.stats.totalArtifacts}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`产物`})]}),(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-orange-600`,children:l.stats.totalQualityIssues}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`质量问题`})]}),(0,B.jsxs)(Y,{className:`text-center !p-3`,children:[(0,B.jsx)(`div`,{className:`text-xl font-bold text-red-600`,children:l.stats.unresolvedQuality}),(0,B.jsx)(`div`,{className:`text-xs text-gray-500`,children:`未解决`})]})]}),(0,B.jsx)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit`,children:[`tasks`,`events`,`artifacts`,`quality`].map(e=>(0,B.jsx)(`button`,{onClick:()=>a(e),className:ud(`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:`任务 (${l.stats.totalTasks})`,events:`事件 (${l.stats.totalEvents})`,artifacts:`产物 (${l.stats.totalArtifacts})`,quality:`质量 (${l.stats.totalQualityIssues})`}[e]},e))}),i===`tasks`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[Object.entries(g).map(([e,t])=>(0,B.jsx)(Y,{title:`${t[0]?.phaseLabel||e} (${t.length})`,children:(0,B.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,B.jsxs)(zb.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:t*.05},className:`flex items-start gap-3 p-3 rounded-lg border border-gray-100`,children:[(0,B.jsx)(`div`,{className:`mt-0.5`,children:e.status===`completed`?(0,B.jsx)(zs,{className:`h-5 w-5 text-green-500`}):e.status===`in_progress`?(0,B.jsx)(dc,{className:`h-5 w-5 text-blue-500`}):(0,B.jsx)(Vs,{className:`h-5 w-5 text-gray-300`})}),(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsx)(`div`,{className:`font-medium text-gray-900`,children:e.title}),e.description&&(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:e.description}),e.output&&(0,B.jsx)(`p`,{className:`text-xs text-green-600 mt-1 font-mono`,children:e.output})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Vb,{size:`sm`,variant:e.status===`completed`?`success`:e.status===`in_progress`?`info`:`default`,children:e.status}),e.status!==`completed`&&(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:zs,onClick:()=>f.mutate({taskId:e.id,status:`completed`}),children:`完成`}),e.status!==`in_progress`&&(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:dc,onClick:()=>f.mutate({taskId:e.id,status:`in_progress`}),children:`开始`})]})]},e.id))})},e)),l.tasks.length===0&&(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无任务`})})]}),i===`events`&&(0,B.jsx)(Y,{title:`工具调用时间线`,children:(0,B.jsxs)(`div`,{className:`space-y-1 max-h-[600px] overflow-y-auto`,children:[l.events.map((e,t)=>(0,B.jsxs)(zb.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,B.jsx)(`span`,{className:`text-gray-400 font-mono w-16 flex-shrink-0`,children:Y2(md(e.time),`HH:mm:ss`)}),(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full flex-shrink-0`,style:{backgroundColor:P4[e.hookType]||`#6b7280`}}),(0,B.jsx)(`span`,{className:`font-mono text-gray-700 w-20 flex-shrink-0`,children:e.toolName||e.hookType}),(0,B.jsx)(`span`,{className:`text-gray-500 truncate`,children:e.detail||``})]},t)),l.events.length===0&&(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无事件`})]})}),i===`artifacts`&&(0,B.jsx)(Y,{title:`产物文件`,children:(0,B.jsxs)(`div`,{className:`space-y-2`,children:[l.artifacts.map((e,t)=>(0,B.jsx)(zb.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,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Xs,{className:`h-5 w-5 text-green-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-mono text-sm text-gray-900`,children:e.filePath.split(`/`).slice(-2).join(`/`)}),(0,B.jsxs)(`div`,{className:`text-xs text-gray-400`,children:[e.tool,` · `,Y2(md(e.time),`HH:mm:ss`)]})]})]})},t)),l.artifacts.length===0&&(0,B.jsx)(`div`,{className:`text-center py-12 text-gray-400`,children:`暂无产物`})]})}),i===`quality`&&(0,B.jsx)(Y,{title:`质量问题`,children:(0,B.jsxs)(`div`,{className:`space-y-2`,children:[l.qualityIssues.map((e,t)=>(0,B.jsxs)(zb.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,B.jsxs)(`div`,{className:`flex items-start gap-3 flex-1`,children:[e.resolved?(0,B.jsx)(zs,{className:`h-5 w-5 text-green-500 mt-0.5`}):(0,B.jsx)(Tc,{className:`h-5 w-5 text-amber-500 mt-0.5`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Vb,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,B.jsx)(Vb,{size:`sm`,children:e.category})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-700 mt-1`,children:e.message}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1`,children:Y2(md(e.createdAt),`MM-dd HH:mm`)})]})]}),(0,B.jsx)(Vb,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`})]},t)),l.qualityIssues.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(yc,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`暂无质量问题`]})]})}),(0,B.jsx)(Q2,{open:o.open,title:o.title,description:o.description,variant:`danger`,onConfirm:o.onConfirm,onCancel:()=>s({...o,open:!1})})]})}function I4(){let e=qe(),[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(1),[p,m]=(0,z.useState)(20),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)({}),[y,b]=(0,z.useState)(new Set),[x,S]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:C,isError:w,refetch:T}=ct({queryKey:[`quality-unresolved`],queryFn:()=>Xc().then(e=>e.data),refetchInterval:1e4}),{data:E}=ct({queryKey:[`quality-history`],queryFn:()=>Yc({limit:1e3}).then(e=>e.data)}),D=lt({mutationFn:e=>El(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),O=lt({mutationFn:e=>Dl(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),k=lt({mutationFn:()=>Ol(),onSuccess:()=>{e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),A=lt({mutationFn:e=>kl(e),onSuccess:(t,n)=>{let{needsFix:r,reason:i,fixSuggestion:a}=t.data;v(e=>({...e,[n]:{needsFix:r,reason:i,fixSuggestion:a}})),r||(e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]}))}}),j=lt({mutationFn:async e=>{await Promise.all(e.map(e=>Dl(e)))},onSuccess:()=>{b(new Set),e.invalidateQueries({queryKey:[`quality-unresolved`]}),e.invalidateQueries({queryKey:[`quality-history`]})}}),M=E?.items.filter(e=>!(t&&!e.message.toLowerCase().includes(t.toLowerCase())||r&&e.level!==r||a&&e.category!==a||s===`resolved`&&!e.resolved||s===`unresolved`&&e.resolved||l&&!e.project_path?.includes(l)))||[],N=Math.ceil(M.length/p),ee=M.slice((d-1)*p,d*p),P=E?.total||0,F=E?.items.filter(e=>e.resolved).length||0,I=C?.total||0,L=Array.from(new Set(E?.items.map(e=>e.level)||[])),te=Array.from(new Set(E?.items.map(e=>e.category)||[])),ne=Array.from(new Set(E?.items.map(e=>e.project_path?.split(`/`).pop()||``).filter(Boolean)||[])),re=()=>{let e=[`级别`,`类别`,`消息`,`项目`,`状态`,`创建时间`,`解决时间`],t=M.map(e=>[e.level,e.category,e.message,e.project_path?.split(`/`).pop()||``,e.resolved?`已解决`:`未解决`,e.created_at?Y2(md(e.created_at),`yyyy-MM-dd HH:mm:ss`):``,e.resolved_at?Y2(md(e.resolved_at),`yyyy-MM-dd HH:mm:ss`):``]);n4(`quality-issues-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},R=(()=>{if(!E?.items.length)return[];let e=new Map;return E.items.forEach(t=>{if(!t.created_at)return;let n=Y2(md(t.created_at),`MM-dd`);e.has(n)||e.set(n,{date:n,total:0,error:0,warn:0,info:0});let r=e.get(n);r.total++,t.level===`error`?r.error++:t.level===`warn`?r.warn++:r.info++}),Array.from(e.values()).sort((e,t)=>e.date.localeCompare(t.date)).slice(-14)})();return w?(0,B.jsx)(r4,{message:`质量数据加载失败`,onRetry:()=>T()}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Tc,{className:`h-6 w-6 text-amber-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-amber-600`,children:I}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`未解决`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(zs,{className:`h-6 w-6 text-green-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-green-600`,children:F}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`已解决`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Bs,{className:`h-6 w-6 text-blue-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-blue-600`,children:P}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`总计`})]})]}),R.length>0&&(0,B.jsx)(Y,{title:`质量趋势(最近14天)`,icon:wc,children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(v0,{data:R,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`,stroke:`#e5e7eb`}),(0,B.jsx)(C$,{dataKey:`date`,stroke:`#6b7280`,style:{fontSize:12}}),(0,B.jsx)(R$,{stroke:`#6b7280`,style:{fontSize:12}}),(0,B.jsx)(hW,{contentStyle:{backgroundColor:`#fff`,border:`1px solid #e5e7eb`,borderRadius:`8px`},labelStyle:{fontWeight:600,marginBottom:4}}),(0,B.jsx)(LA,{wrapperStyle:{fontSize:12}}),(0,B.jsx)(_Z,{type:`monotone`,dataKey:`error`,stroke:`#ef4444`,strokeWidth:2,name:`错误`}),(0,B.jsx)(_Z,{type:`monotone`,dataKey:`warn`,stroke:`#f59e0b`,strokeWidth:2,name:`警告`}),(0,B.jsx)(_Z,{type:`monotone`,dataKey:`info`,stroke:`#3b82f6`,strokeWidth:2,name:`信息`})]})})}),(0,B.jsxs)(Y,{title:`未解决问题 (${I})`,action:I>0?(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[y.size>0&&(0,B.jsxs)(J,{variant:`secondary`,size:`sm`,icon:kc,onClick:()=>{S({open:!0,title:`批量忽略问题`,description:`确认忽略选中的 ${y.size} 个问题?`,onConfirm:()=>{j.mutate(Array.from(y)),S(e=>({...e,open:!1}))}})},loading:j.isPending,children:[`批量忽略 (`,y.size,`)`]}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:Ps,onClick:()=>{S({open:!0,title:`全部标记已修复`,description:`确认将 ${I} 个问题全部标记为已修复?`,onConfirm:()=>{k.mutate(),S(e=>({...e,open:!1}))}})},loading:k.isPending,children:`全部标记已修复`})]}):void 0,children:[I>0&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 pb-3 border-b border-gray-100`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:y.size===I&&I>0,onChange:e=>{e.target.checked?b(new Set(C?.items.map(e=>String(e.id))||[])):b(new Set)},className:`h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500`}),(0,B.jsx)(`span`,{className:`text-sm text-gray-600`,children:y.size>0?`已选 ${y.size} 个`:`全选`})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[C?.items.map((e,t)=>(0,B.jsxs)(zb.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.03},className:`flex flex-col p-3 rounded-lg border border-gray-100 hover:border-gray-200`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3 flex-1 min-w-0`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:y.has(String(e.id)),onChange:()=>{b(t=>{let n=new Set(t);return n.has(String(e.id))?n.delete(String(e.id)):n.add(String(e.id)),n})},className:`h-4 w-4 mt-0.5 rounded border-gray-300 text-blue-600 focus:ring-blue-500 flex-shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,B.jsx)(Vb,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,B.jsx)(Vb,{size:`sm`,children:e.category})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-700`,children:e.message}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-400 mt-1`,children:[e.project_path?.split(`/`).pop(),` · `,e.created_at?Y2(md(e.created_at),`MM-dd HH:mm`):``]})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 ml-3 flex-shrink-0`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Dc,onClick:()=>A.mutate(String(e.id)),loading:A.isPending&&A.variables===String(e.id),children:`AI 修复`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ps,onClick:()=>D.mutate(String(e.id)),loading:D.isPending,children:`已修复`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>O.mutate(String(e.id)),loading:O.isPending,children:`忽略`})]})]}),_[String(e.id)]&&(0,B.jsxs)(`div`,{className:`mt-3 p-3 rounded-lg text-sm ${_[String(e.id)].needsFix?`bg-amber-50 border border-amber-200`:`bg-green-50 border border-green-200`}`,children:[(0,B.jsx)(`div`,{className:`font-medium mb-1`,children:_[String(e.id)].needsFix?`需要修复`:`无需修复`}),(0,B.jsx)(`div`,{className:`text-gray-700 mb-2`,children:_[String(e.id)].reason}),_[String(e.id)].fixSuggestion&&(0,B.jsxs)(`div`,{className:`bg-white p-2 rounded border border-amber-300`,children:[(0,B.jsx)(`div`,{className:`text-xs font-medium text-amber-700 mb-1`,children:`修复建议:`}),(0,B.jsx)(`div`,{className:`text-gray-800`,children:_[String(e.id)].fixSuggestion})]})]})]},e.id||t)),I===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(zs,{className:`h-12 w-12 mx-auto mb-3 text-green-300`}),`暂无未解决的质量问题`]})]})]}),(0,B.jsxs)(Y,{title:`历史记录 (${M.length})`,action:M.length>0?(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:re,children:`导出 CSV`}):void 0,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center mb-4 pb-4 border-b border-gray-100`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 min-w-[240px] max-w-sm`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索问题描述...`,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 text-sm`})]}),(0,B.jsxs)(`select`,{value:r,onChange:e=>i(e.target.value),className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,B.jsx)(`option`,{value:``,children:`全部级别`}),L.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.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,B.jsx)(`option`,{value:``,children:`全部类别`}),te.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.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,B.jsx)(`option`,{value:``,children:`全部状态`}),(0,B.jsx)(`option`,{value:`resolved`,children:`已解决`}),(0,B.jsx)(`option`,{value:`unresolved`,children:`未解决`})]}),(0,B.jsxs)(`select`,{value:l,onChange:e=>{u(e.target.value),f(1)},className:`px-3 py-2 border border-gray-200 rounded-lg text-sm`,children:[(0,B.jsx)(`option`,{value:``,children:`全部项目`}),ne.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]}),(0,B.jsx)(`div`,{className:`space-y-1`,children:ee.map((e,t)=>{let n=h===String(e.id||t);return(0,B.jsxs)(`div`,{className:`rounded-lg border border-gray-100 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 p-3 hover:bg-gray-50 cursor-pointer text-sm`,onClick:()=>g(n?null:String(e.id||t)),children:[n?(0,B.jsx)(Fs,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}):(0,B.jsx)(Ls,{className:`h-4 w-4 text-gray-400 flex-shrink-0`}),(0,B.jsx)(Vb,{size:`sm`,variant:e.level===`error`?`danger`:e.level===`warn`?`warning`:`info`,children:e.level}),(0,B.jsx)(Vb,{size:`sm`,children:e.category}),(0,B.jsx)(`span`,{className:`flex-1 truncate text-gray-600`,children:e.message}),(0,B.jsx)(Vb,{size:`sm`,variant:e.resolved?`success`:`warning`,children:e.resolved?`已解决`:`未解决`}),(0,B.jsx)(`span`,{className:`text-gray-400 flex-shrink-0`,children:e.created_at?Y2(md(e.created_at),`MM-dd HH:mm`):``})]}),(0,B.jsx)(My,{children:n&&(0,B.jsx)(zb.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:`overflow-hidden`,children:(0,B.jsxs)(`div`,{className:`border-t border-gray-100 bg-gray-50 p-4 space-y-2 text-sm`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`完整消息:`}),(0,B.jsx)(`p`,{className:`text-gray-700 mt-1 break-words`,children:e.message})]}),e.project_path&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`项目路径:`}),(0,B.jsx)(`span`,{className:`text-gray-700 ml-1 font-mono text-xs`,children:e.project_path})]}),(0,B.jsxs)(`div`,{className:`flex gap-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`创建时间:`}),(0,B.jsx)(`span`,{className:`text-gray-700 ml-1`,children:e.created_at?Y2(md(e.created_at),`yyyy-MM-dd HH:mm:ss`):`-`})]}),e.resolved_at&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-500 font-medium`,children:`解决时间:`}),(0,B.jsx)(`span`,{className:`text-gray-700 ml-1`,children:Y2(md(e.resolved_at),`yyyy-MM-dd HH:mm:ss`)})]})]}),!e.resolved&&(0,B.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ps,onClick:t=>{t.stopPropagation(),D.mutate(String(e.id))},loading:D.isPending,children:`标记已修复`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:t=>{t.stopPropagation(),O.mutate(String(e.id))},loading:O.isPending,children:`忽略`})]})]})})})]},e.id||t)})}),M.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(ec,{className:`h-12 w-12 mx-auto mb-3 text-gray-300`}),`没有符合条件的记录`]}),M.length>0&&(0,B.jsx)(t4,{currentPage:d,totalPages:N,onPageChange:f,pageSize:p,onPageSizeChange:e=>{m(e),f(1)},totalItems:M.length})]}),(0,B.jsx)(Q2,{open:x.open,title:x.title,description:x.description,variant:`warning`,onConfirm:x.onConfirm,onCancel:()=>S({...x,open:!1})})]})}var L4=[{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 R4(){let e=qe(),[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(`idle`),[a,o]=(0,z.useState)(`distill`),[s,c]=(0,z.useState)(new Set),l=s.size>0,[u,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(new Set),[m,h]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:g,isLoading:_}=ct({queryKey:[`config`],queryFn:()=>Rc().then(e=>e.data)}),{data:v,refetch:y}=ct({queryKey:[`daemon-diagnosis`],queryFn:()=>Ml().then(e=>e.data),enabled:a===`environment`}),{data:b,refetch:x}=ct({queryKey:[`backups`],queryFn:()=>Fl().then(e=>e.data),enabled:a===`backup_mgmt`}),{data:S}=ct({queryKey:[`config-history`],queryFn:()=>Bc().then(e=>e.data),enabled:a===`history`}),{data:C}=ct({queryKey:[`daemon-status`],queryFn:()=>Al().then(e=>e.data),enabled:a===`backup_mgmt`}),w=lt({mutationFn:()=>Pl(),onSuccess:()=>{x(),i(`success`),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),T=lt({mutationFn:()=>Nl(),onSuccess:e=>{d(e.data),y()}});(0,z.useEffect)(()=>{g&&!t&&n(g)},[g,t]);let E=lt({mutationFn:e=>zc(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),i(`success`),c(new Set),setTimeout(()=>i(`idle`),3e3)},onError:()=>{i(`error`),setTimeout(()=>i(`idle`),3e3)}}),D=lt({mutationFn:()=>W.post(`/config/reset`),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),n(null),i(`success`),setTimeout(()=>i(`idle`),3e3)}});if(_||!t)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let O=(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??``},k=(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}})},A=()=>{if(!t)return;let e={};s.forEach(n=>{e[n]=t[n]}),E.mutate(e)},j=()=>{n(g),c(new Set)},M=()=>{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)},N=()=>{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(L4.map(e=>e.key)))}catch{alert(`配置文件格式错误,请选择有效的 JSON 文件`)}},r.readAsText(t)},e.click()},ee=L4.find(e=>e.key===a);return(0,B.jsxs)(`div`,{className:`flex gap-6`,children:[(0,B.jsx)(`div`,{className:`w-56 flex-shrink-0`,children:(0,B.jsx)(Y,{className:`!p-2 sticky top-6`,children:(0,B.jsxs)(`nav`,{className:`space-y-1`,children:[L4.map(e=>(0,B.jsx)(`button`,{onClick:()=>o(e.key),className:ud(`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,B.jsx)(`div`,{className:`border-t border-gray-100 my-1`}),(0,B.jsxs)(`button`,{onClick:()=>o(`backup_mgmt`),className:ud(`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,B.jsx)(Gs,{className:`h-3.5 w-3.5`}),`数据备份`]}),(0,B.jsxs)(`button`,{onClick:()=>o(`environment`),className:ud(`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,B.jsx)(yc,{className:`h-3.5 w-3.5`}),`环境检测`]})]})})}),(0,B.jsxs)(`div`,{className:`flex-1 space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900`,children:a===`environment`?`环境检测`:a===`backup_mgmt`?`数据备份`:a===`history`?`配置历史`:ee?.title}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:a===`environment`?`Hook 脚本与 Claude settings.json 注入状态检测与修复`:a===`backup_mgmt`?`数据库备份与历史备份管理`:a===`history`?`查看最近 10 次配置变更记录`:ee?.description??``})]}),a!==`environment`&&a!==`backup_mgmt`&&a!==`history`&&(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(My,{children:[r===`success`&&(0,B.jsxs)(zb.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,B.jsx)(zs,{className:`h-4 w-4`}),`已保存`]}),r===`error`&&(0,B.jsxs)(zb.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,B.jsx)(Bs,{className:`h-4 w-4`}),`保存失败`]})]}),l&&(0,B.jsx)(Vb,{variant:`warning`,children:`未保存`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:qs,onClick:M,children:`导出`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ec,onClick:N,children:`导入`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:hc,onClick:j,disabled:!l,children:`撤销`}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:gc,onClick:A,loading:E.isPending,disabled:!l,children:`保存`})]})]}),a!==`environment`&&a!==`backup_mgmt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`space-y-6`,children:ee?.fields.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,B.jsxs)(`div`,{className:`w-48 flex-shrink-0 pt-2`,children:[(0,B.jsx)(`label`,{className:`text-sm font-medium text-gray-700`,children:e.label}),e.description&&(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-0.5`,children:e.description})]}),(0,B.jsx)(`div`,{className:`flex-1`,children:e.type===`boolean`?(0,B.jsx)(`button`,{onClick:()=>k(a,e.key,!O(a,e.key)),className:ud(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors`,O(a,e.key)?`bg-blue-600`:`bg-gray-300`),children:(0,B.jsx)(`span`,{className:ud(`inline-block h-4 w-4 transform rounded-full bg-white transition-transform`,O(a,e.key)?`translate-x-6`:`translate-x-1`)})}):e.type===`select`?(0,B.jsx)(`select`,{value:String(O(a,e.key)||``),onChange:t=>k(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,B.jsx)(`option`,{value:e.value,children:e.label},e.value))}):e.type===`number`?(0,B.jsx)(`input`,{type:`number`,value:Number(O(a,e.key))||0,onChange:t=>k(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,B.jsxs)(`div`,{className:`relative flex items-center max-w-xs`,children:[(0,B.jsx)(`input`,{type:e.sensitive&&!f.has(`${a}.${e.key}`)?`password`:`text`,value:String(O(a,e.key)||``),onChange:t=>k(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,B.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,B.jsx)(Js,{className:`h-4 w-4`}):(0,B.jsx)(Ys,{className:`h-4 w-4`})})]})})]},e.key))})}),(0,B.jsx)(Y,{className:`!border-red-200`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-red-600`,children:`重置配置`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-1`,children:`将所有配置恢复为默认值,此操作不可撤销`})]}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:Tc,onClick:()=>{h({open:!0,title:`重置配置`,description:`确定要重置所有配置为默认值吗?此操作不可撤销。`,onConfirm:()=>{D.mutate(),h({...m,open:!1})}})},loading:D.isPending,children:`重置`})]})})]}),a===`backup_mgmt`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`flex-shrink-0 w-10 h-10 rounded-full bg-blue-50 flex items-center justify-center`,children:(0,B.jsx)(nc,{className:`h-5 w-5 text-blue-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`当前数据库`}),(0,B.jsxs)(`p`,{className:`text-sm text-gray-500 mt-1`,children:[`大小:`,C?.memory?`${(C.memory.heapUsed/1024/1024).toFixed(2)} MB`:`加载中...`]})]})]}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:Gs,onClick:()=>w.mutate(),loading:w.isPending,children:`立即备份`})]})}),(0,B.jsxs)(Y,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`备份历史`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:mc,onClick:()=>x(),children:`刷新`})]}),b&&b.items.length>0?(0,B.jsx)(`div`,{className:`space-y-2`,children:b.items.map(e=>(0,B.jsx)(`div`,{className:`flex items-center justify-between py-3 px-4 bg-gray-50 rounded-lg`,children:(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900 truncate`,children:e.filename}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[Y2(new Date(e.createdAt),`yyyy-MM-dd HH:mm:ss`),` · `,e.sizeMb,` MB`]})]})},e.filename))}):(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无备份记录`})]})]}),a===`history`&&(0,B.jsxs)(Y,{children:[(0,B.jsx)(`div`,{className:`flex items-center justify-between mb-4`,children:(0,B.jsx)(`h3`,{className:`font-medium text-gray-900`,children:`最近 10 次配置变更`})}),S&&S.items.length>0?(0,B.jsx)(`div`,{className:`space-y-2`,children:S.items.map(e=>(0,B.jsxs)(`div`,{className:`py-3 px-4 bg-gray-50 rounded-lg`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(`span`,{className:`text-sm font-medium text-gray-900`,children:[`#`,e.id]}),(0,B.jsx)(`span`,{className:`text-xs text-gray-500`,children:Y2(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)})]}),(0,B.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>{h({open:!0,title:`确认恢复配置`,description:`确定要恢复到 ${Y2(new Date(e.savedAt),`yyyy-MM-dd HH:mm:ss`)} 的配置吗?当前配置将被覆盖。`,onConfirm:()=>{n(e.config),A(),h({...m,open:!1})}})},children:`恢复到此版本`})]}),(0,B.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,B.jsx)(`pre`,{className:`whitespace-pre-wrap break-all`,children:JSON.stringify(e.config,null,2)})})]},e.id))}):(0,B.jsx)(`div`,{className:`text-center py-8 text-gray-400 text-sm`,children:`暂无配置变更记录`})]}),a===`environment`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-medium text-gray-900 mb-1`,children:`Hook 环境诊断`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`检测 Forge hooks 脚本与 Claude settings.json 中 Forge 注入是否完整`})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:mc,onClick:()=>y(),children:`重新检测`}),(0,B.jsx)(J,{size:`sm`,icon:Oc,onClick:()=>T.mutate(),disabled:T.isPending||v?.hooksHealthy,children:T.isPending?`修复中...`:`一键修复`})]})]})}),u&&(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[u.hooksHealthy?(0,B.jsx)(zs,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(Tc,{className:`h-4 w-4 text-yellow-500 mt-0.5 flex-shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:ud(`text-sm font-medium`,u.hooksHealthy?`text-gray-900`:`text-yellow-600`),children:u.hooksHealthy?`Hooks 环境已恢复正常`:`修复后仍有未通过项,请根据下方列表排查`}),u.backupPath&&(0,B.jsxs)(`p`,{className:`text-xs text-gray-500 mt-0.5`,children:[`已备份 settings: `,u.backupPath.split(`/`).pop()]})]})]}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Bs,onClick:()=>d(null)})]})}),v&&(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`space-y-2`,children:v.items.map(e=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 py-2 border-b border-gray-50 last:border-0`,children:[(0,B.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,children:e.ok?(0,B.jsx)(zs,{className:`h-4 w-4 text-green-500`}):e.id===`daemon_process`?(0,B.jsx)(Tc,{className:`h-4 w-4 text-yellow-500`}):(0,B.jsx)(Bs,{className:`h-4 w-4 text-red-500`})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.label}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mt-0.5 break-all`,children:e.detail})]})]},e.id))})}),v&&(0,B.jsx)(Y,{className:v.hooksHealthy?`!border-green-200 !bg-green-50`:`!border-yellow-200 !bg-yellow-50`,children:(0,B.jsx)(`div`,{className:`flex items-center gap-2`,children:v.hooksHealthy?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(zs,{className:`h-5 w-5 text-green-600`}),(0,B.jsx)(`p`,{className:`text-sm font-medium text-green-700`,children:`Hooks 相关环境正常`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Tc,{className:`h-5 w-5 text-yellow-600`}),(0,B.jsx)(`p`,{className:`text-sm font-medium text-yellow-700`,children:`检测到 Hooks 环境不完整,请点击「一键修复」`})]})})})]})]}),(0,B.jsx)(Q2,{open:m.open,title:m.title,description:m.description,variant:`danger`,onConfirm:m.onConfirm,onCancel:()=>h({...m,open:!1})})]})}function z4({children:e,fallback:t,rootMargin:n=`200px`}){let[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(null);return(0,z.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,B.jsx)(`div`,{ref:a,style:{minHeight:r?`auto`:`400px`},children:r?e:t||(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96 text-gray-400`,children:`加载中...`})})}var B4=[`#667eea`,`#10b981`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#06b6d4`],V4={"7d":7,"30d":30,"90d":90,custom:0};function H4(){let[e,t]=(0,z.useState)(`30d`),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),o=V4[e],s=e===`custom`?n?`${n}T00:00:00`:void 0:Y2(Z2(new Date,o),`yyyy-MM-dd'T'HH:mm:ss`),c=e===`custom`&&i?`${i}T23:59:59`:void 0,{data:l,isLoading:u,isError:d,refetch:f}=ct({queryKey:[`sessions`,{limit:500,startTime:s,endTime:c}],queryFn:()=>Vc({limit:500,start_time:s}).then(e=>e.data)}),{data:p,isLoading:m,isError:h,refetch:g}=ct({queryKey:[`events`,{limit:1e3,startTime:s,endTime:c}],queryFn:()=>Gc({limit:1e3,start_time:s,end_time:c}).then(e=>e.data)}),{data:_,isLoading:v}=ct({queryKey:[`event-stats`],queryFn:()=>Kc().then(e=>e.data)}),{data:y}=ct({queryKey:[`api-usage-stats`,e],queryFn:()=>Ll(e===`custom`?90:o).then(e=>e.data),staleTime:6e4}),b=u||m||v,x=d||h,S=()=>{let e=[`日期`,`会话数`],t=C.map(e=>[e.date,e.count]);n4(`analytics-sessions-${Y2(new Date,`yyyyMMdd`)}.csv`,e,t)},C=(0,z.useMemo)(()=>{if(!l?.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=Y2(new Date(e.getTime()+n*24*60*60*1e3),`MM-dd`);return{date:r,count:l.items.filter(e=>Y2(md(e.start_time),`MM-dd`)===r).length}})}return Array.from({length:o},(e,t)=>{let n=Y2(Z2(new Date,o-1-t),`MM-dd`);return{date:n,count:l.items.filter(e=>Y2(md(e.start_time),`MM-dd`)===n).length}})},[l?.items,o,e,n,i]),w=(0,z.useMemo)(()=>p?.items?Array.from({length:24},(e,t)=>{let n=p.items.filter(e=>md(e.timestamp).getHours()===t).length;return{hour:`${t}:00`,count:n}}):[],[p?.items]),T=(0,z.useMemo)(()=>{if(!p?.items)return[];let e=p.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}))},[p?.items]),E=(0,z.useMemo)(()=>{if(!p?.items)return[];let e=p.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:e,value:t}))},[p?.items]),{sessionDurations:D,durationBuckets:O}=(0,z.useMemo)(()=>{if(!l?.items)return{sessionDurations:[],durationBuckets:[]};let e=l.items.filter(e=>e.end_time).map(e=>{let t=(md(e.end_time).getTime()-md(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}]}},[l?.items]),{avgSessionEvents:k,avgSessionDuration:A}=(0,z.useMemo)(()=>({avgSessionEvents:l?.items.reduce((e,t)=>e+t.event_count,0)/(l?.items.length||1)||0,avgSessionDuration:D.reduce((e,t)=>e+t,0)/(D.length||1)||0}),[l?.items,D]);return b?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})}):x?(0,B.jsx)(r4,{message:`分析数据加载失败`,onRetry:()=>{f(),g()}}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Ms,{className:`h-4 w-4 text-gray-400`}),(0,B.jsx)(`span`,{className:`text-sm text-gray-600`,children:`时间范围:`}),(0,B.jsx)(`div`,{className:`flex gap-1 border border-gray-200 rounded-lg overflow-hidden`,children:[`7d`,`30d`,`90d`,`custom`].map(n=>(0,B.jsx)(`button`,{onClick:()=>t(n),className:ud(`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,B.jsx)(J,{variant:`outline`,size:`sm`,icon:qs,onClick:S,children:`导出数据`})]}),e===`custom`&&(0,B.jsxs)(`div`,{className:`flex items-center gap-3 pl-6`,children:[(0,B.jsx)(`label`,{className:`text-sm text-gray-600`,children:`开始日期:`}),(0,B.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,B.jsx)(`label`,{className:`text-sm text-gray-600`,children:`结束日期:`}),(0,B.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,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Ts,{className:`h-7 w-7 text-indigo-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:k.toFixed(1)}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话事件数`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Hs,{className:`h-7 w-7 text-green-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:A.toFixed(1)}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`平均会话时长(分钟)`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(Ac,{className:`h-7 w-7 text-amber-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:p?.total||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总事件数`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsx)(wc,{className:`h-7 w-7 text-purple-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-2xl font-bold text-gray-900`,children:l?.total||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总会话数`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,B.jsx)(Y,{title:`最近 ${o} 天会话趋势`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(V0,{data:C,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`date`}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`count`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3})]})})})}),(0,B.jsx)(Y,{title:`24 小时事件分布`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(v0,{data:w,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`hour`}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{}),(0,B.jsx)(_Z,{type:`monotone`,dataKey:`count`,stroke:`#10b981`,strokeWidth:2})]})})})}),(0,B.jsx)(Y,{title:`项目活跃度 Top 10`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(b0,{data:T,layout:`vertical`,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{type:`number`}),(0,B.jsx)(R$,{dataKey:`name`,type:`category`,width:100}),(0,B.jsx)(hW,{}),(0,B.jsx)(n$,{dataKey:`value`,fill:`#667eea`})]})})})}),(0,B.jsx)(Y,{title:`工具使用排行 Top 15`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(b0,{data:E,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`name`,angle:-45,textAnchor:`end`,height:80}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{}),(0,B.jsx)(n$,{dataKey:`value`,fill:`#10b981`})]})})})}),(0,B.jsx)(Y,{title:`会话时长分布`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(z0,{children:[(0,B.jsx)(pJ,{data:O,cx:`50%`,cy:`50%`,labelLine:!1,label:({range:e,count:t})=>`${e}: ${t}`,outerRadius:80,fill:`#8884d8`,dataKey:`count`,children:O.map((e,t)=>(0,B.jsx)(gW,{fill:B4[t%B4.length]},`cell-${t}`))}),(0,B.jsx)(hW,{})]})})})}),(0,B.jsx)(Y,{title:`事件类型趋势`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(V0,{data:_?.stats.slice(0,30)||[],children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`date`}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{}),(0,B.jsx)(LA,{}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`count`,stackId:`1`,stroke:`#667eea`,fill:`#667eea`})]})})})})]}),y&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,B.jsx)(Ks,{className:`h-5 w-5 text-gray-500`}),(0,B.jsx)(`h2`,{className:`text-base font-semibold text-gray-800`,children:`Token 与费用统计`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[`$`,y.summary.totalCost.toFixed(4)]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总费用(USD)`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(y.summary.totalTokens/1e3).toFixed(1),`K`]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`总 Token 数`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(y.summary.totalTokensIn/1e3).toFixed(1),`K`]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`输入 Token`})]}),(0,B.jsxs)(Y,{className:`text-center !p-4`,children:[(0,B.jsxs)(`div`,{className:`text-2xl font-bold text-gray-900`,children:[(y.summary.totalTokensOut/1e3).toFixed(1),`K`]}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500`,children:`输出 Token`})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-2 gap-6`,children:[(0,B.jsx)(Y,{title:`每日 Token 趋势`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(V0,{data:y.dailyTrend,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`date`}),(0,B.jsx)(R$,{}),(0,B.jsx)(hW,{formatter:e=>`${(e/1e3).toFixed(1)}K`}),(0,B.jsx)(LA,{}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`tokens_in`,name:`输入`,stroke:`#667eea`,fill:`#667eea`,fillOpacity:.3,stackId:`1`}),(0,B.jsx)(nQ,{type:`monotone`,dataKey:`tokens_out`,name:`输出`,stroke:`#10b981`,fill:`#10b981`,fillOpacity:.3,stackId:`1`})]})})})}),(0,B.jsx)(Y,{title:`每日费用趋势(USD)`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(b0,{data:y.dailyTrend,children:[(0,B.jsx)(wX,{strokeDasharray:`3 3`}),(0,B.jsx)(C$,{dataKey:`date`}),(0,B.jsx)(R$,{tickFormatter:e=>`$${e.toFixed(3)}`}),(0,B.jsx)(hW,{formatter:e=>`$${e.toFixed(4)}`}),(0,B.jsx)(n$,{dataKey:`cost_usd`,name:`费用`,fill:`#f59e0b`})]})})})}),y.byModel.length>0&&(0,B.jsx)(Y,{title:`按模型费用分布`,children:(0,B.jsx)(z4,{children:(0,B.jsx)(RO,{width:`100%`,height:250,children:(0,B.jsxs)(z0,{children:[(0,B.jsx)(pJ,{data:y.byModel,dataKey:`cost`,nameKey:`model`,cx:`50%`,cy:`50%`,outerRadius:80,label:({model:e,cost:t})=>`${e}: $${t.toFixed(4)}`,children:y.byModel.map((e,t)=>(0,B.jsx)(gW,{fill:B4[t%B4.length]},t))}),(0,B.jsx)(hW,{formatter:e=>`$${e.toFixed(4)}`})]})})})})]})]})]})}function U4(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=U4(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var W4={value:()=>{}};function G4(){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 K4(n)}function K4(e){this._=e}function q4(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}})}K4.prototype=G4.prototype={constructor:K4,on:function(e,t){var n=this._,r=q4(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=J4(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]=Y4(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Y4(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 K4(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 J4(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Y4(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=W4,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var X4={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 Z4(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),X4.hasOwnProperty(t)?{space:X4[t],local:e}:e}function Q4(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 $4(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function e3(e){var t=Z4(e);return(t.local?$4:Q4)(t)}function t3(){}function n3(e){return e==null?t3:function(){return this.querySelector(e)}}function r3(e){typeof e!=`function`&&(e=n3(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 V6(r,this._parents)}function i3(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function a3(){return[]}function o3(e){return e==null?a3:function(){return this.querySelectorAll(e)}}function s3(e){return function(){return i3(e.apply(this,arguments))}}function c3(e){e=typeof e==`function`?s3(e):o3(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 V6(r,i)}function l3(e){return function(){return this.matches(e)}}function u3(e){return function(t){return t.matches(e)}}var d3=Array.prototype.find;function f3(e){return function(){return d3.call(this.children,e)}}function p3(){return this.firstElementChild}function m3(e){return this.select(e==null?p3:f3(typeof e==`function`?e:u3(e)))}var h3=Array.prototype.filter;function g3(){return Array.from(this.children)}function _3(e){return function(){return h3.call(this.children,e)}}function v3(e){return this.selectAll(e==null?g3:_3(typeof e==`function`?e:u3(e)))}function y3(e){typeof e!=`function`&&(e=l3(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 V6(r,this._parents)}function b3(e){return Array(e.length)}function x3(){return new V6(this._enter||this._groups.map(b3),this._parents)}function S3(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}S3.prototype={constructor:S3,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 C3(e){return function(){return e}}function w3(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 S3(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function T3(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 S3(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function E3(e){return e.__data__}function D3(e,t){if(!arguments.length)return Array.from(this,E3);var n=t?T3:w3,r=this._parents,i=this._groups;typeof e!=`function`&&(e=C3(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=O3(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 V6(o,r),o._enter=s,o._exit=c,o}function O3(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function k3(){return new V6(this._exit||this._groups.map(b3),this._parents)}function A3(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 j3(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 V6(s,this._parents)}function M3(){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 N3(e){e||=P3;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 V6(i,this._parents).order()}function P3(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function F3(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function I3(){return Array.from(this)}function L3(){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 R3(){let e=0;for(let t of this)++e;return e}function z3(){return!this.node()}function B3(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 V3(e){return function(){this.removeAttribute(e)}}function H3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function U3(e,t){return function(){this.setAttribute(e,t)}}function W3(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function G3(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function K3(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 q3(e,t){var n=Z4(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?H3:V3:typeof t==`function`?n.local?K3:G3:n.local?W3:U3)(n,t))}function J3(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Y3(e){return function(){this.style.removeProperty(e)}}function X3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Z3(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Q3(e,t,n){return arguments.length>1?this.each((t==null?Y3:typeof t==`function`?Z3:X3)(e,t,n??``)):$3(this.node(),e)}function $3(e,t){return e.style.getPropertyValue(t)||J3(e).getComputedStyle(e,null).getPropertyValue(t)}function e6(e){return function(){delete this[e]}}function t6(e,t){return function(){this[e]=t}}function n6(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function r6(e,t){return arguments.length>1?this.each((t==null?e6:typeof t==`function`?n6:t6)(e,t)):this.node()[e]}function i6(e){return e.trim().split(/^|\s+/)}function a6(e){return e.classList||new o6(e)}function o6(e){this._node=e,this._names=i6(e.getAttribute(`class`)||``)}o6.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 s6(e,t){for(var n=a6(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function c6(e,t){for(var n=a6(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function l6(e){return function(){s6(this,e)}}function u6(e){return function(){c6(this,e)}}function d6(e,t){return function(){(t.apply(this,arguments)?s6:c6)(this,e)}}function f6(e,t){var n=i6(e+``);if(arguments.length<2){for(var r=a6(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?d6:t?l6:u6)(n,t))}function p6(){this.textContent=``}function m6(e){return function(){this.textContent=e}}function h6(e){return function(){this.textContent=e.apply(this,arguments)??``}}function g6(e){return arguments.length?this.each(e==null?p6:(typeof e==`function`?h6:m6)(e)):this.node().textContent}function _6(){this.innerHTML=``}function v6(e){return function(){this.innerHTML=e}}function y6(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function b6(e){return arguments.length?this.each(e==null?_6:(typeof e==`function`?y6:v6)(e)):this.node().innerHTML}function x6(){this.nextSibling&&this.parentNode.appendChild(this)}function S6(){return this.each(x6)}function C6(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function w6(){return this.each(C6)}function T6(e){var t=typeof e==`function`?e:e3(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function E6(){return null}function D6(e,t){var n=typeof e==`function`?e:e3(e),r=t==null?E6:typeof t==`function`?t:n3(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function O6(){var e=this.parentNode;e&&e.removeChild(this)}function k6(){return this.each(O6)}function A6(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function j6(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function M6(e){return this.select(e?j6:A6)}function N6(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function P6(e){return function(t){e.call(this,t,this.__data__)}}function F6(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 I6(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 L6(e,t,n){return function(){var r=this.__on,i,a=P6(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 R6(e,t,n){var r=F6(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?L6:I6,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function z6(e,t,n){var r=J3(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 Fie(e,t){return function(){return z6(this,e,t)}}function Iie(e,t){return function(){return z6(this,e,t.apply(this,arguments))}}function Lie(e,t){return this.each((typeof t==`function`?Iie:Fie)(e,t))}function*Rie(){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 B6=[null];function V6(e,t){this._groups=e,this._parents=t}function H6(){return new V6([[document.documentElement]],B6)}function zie(){return this}V6.prototype=H6.prototype={constructor:V6,select:r3,selectAll:c3,selectChild:m3,selectChildren:v3,filter:y3,data:D3,enter:x3,exit:k3,join:A3,merge:j3,selection:zie,order:M3,sort:N3,call:F3,nodes:I3,node:L3,size:R3,empty:z3,each:B3,attr:q3,style:Q3,property:r6,classed:f6,text:g6,html:b6,raise:S6,lower:w6,append:T6,insert:D6,remove:k6,clone:M6,datum:N6,on:R6,dispatch:Lie,[Symbol.iterator]:Rie};function U6(e){return typeof e==`string`?new V6([[document.querySelector(e)]],[document.documentElement]):new V6([[e]],B6)}function Bie(e){let t;for(;t=e.sourceEvent;)e=t;return e}function W6(e,t){if(e=Bie(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 Vie={passive:!1},G6={capture:!0,passive:!1};function K6(e){e.stopImmediatePropagation()}function q6(e){e.preventDefault(),e.stopImmediatePropagation()}function J6(e){var t=e.document.documentElement,n=U6(e).on(`dragstart.drag`,q6,G6);`onselectstart`in t?n.on(`selectstart.drag`,q6,G6):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Y6(e,t){var n=e.document.documentElement,r=U6(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,q6,G6),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 X6=e=>()=>e;function Z6(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}})}Z6.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hie(e){return!e.ctrlKey&&!e.button}function Uie(){return this.parentNode}function Wie(e,t){return t??{x:e.x,y:e.y}}function Gie(){return navigator.maxTouchPoints||`ontouchstart`in this}function Q6(){var e=Hie,t=Uie,n=Wie,r=Gie,i={},a=G4(`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`,_,Vie).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&&(U6(n.view).on(`mousemove.drag`,m,G6).on(`mouseup.drag`,h,G6),J6(n.view),K6(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(q6(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){U6(e.view).on(`mousemove.drag mouseup.drag`,null),Y6(e.view,l),q6(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]))&&(K6(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])&&(q6(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])&&(K6(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=W6(l||r,t),p,m,h;if((h=n.call(e,new Z6(`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=W6(l||a,t),_=o;break}u.call(r,e,new Z6(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:X6(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:X6(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:X6(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:X6(!!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 $6=0,e8=0,t8=0,n8=1e3,r8,i8,a8=0,o8=0,s8=0,c8=typeof performance==`object`&&performance.now?performance:Date,l8=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function u8(){return o8||=(l8(Kie),c8.now()+s8)}function Kie(){o8=0}function d8(){this._call=this._time=this._next=null}d8.prototype=f8.prototype={constructor:d8,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?u8():+n)+(t==null?0:+t),!this._next&&i8!==this&&(i8?i8._next=this:r8=this,i8=this),this._call=e,this._time=n,m8()},stop:function(){this._call&&(this._call=null,this._time=1/0,m8())}};function f8(e,t,n){var r=new d8;return r.restart(e,t,n),r}function qie(){u8(),++$6;for(var e=r8,t;e;)(t=o8-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$6}function p8(){o8=(a8=c8.now())+s8,$6=e8=0;try{qie()}finally{$6=0,Yie(),o8=0}}function Jie(){var e=c8.now(),t=e-a8;t>n8&&(s8-=t,a8=e)}function Yie(){for(var e,t=r8,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:r8=n);i8=e,m8(r)}function m8(e){$6||(e8&&=clearTimeout(e8),e-o8>24?(e<1/0&&(e8=setTimeout(p8,e-c8.now()-s8)),t8&&=clearInterval(t8)):(t8||=(a8=c8.now(),setInterval(Jie,n8)),$6=1,l8(p8)))}function h8(e,t,n){var r=new d8;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Xie=G4(`start`,`end`,`cancel`,`interrupt`),Zie=[];function g8(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Qie(e,n,{name:t,index:r,group:i,on:Xie,tween:Zie,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function _8(e,t){var n=y8(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function v8(e,t){var n=y8(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function y8(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Qie(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=f8(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 h8(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(h8(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 b8(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 $ie(e){return this.each(function(){b8(this,e)})}function eae(e,t){var n,r;return function(){var i=v8(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 tae(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=v8(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 nae(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=y8(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?eae:tae)(n,e,t))}function x8(e,t,n){var r=e._id;return e.each(function(){var e=v8(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return y8(e,r).value[t]}}function S8(e,t){var n;return(typeof t==`number`?cI:t instanceof HF?sI:(n=HF(t))?(t=n,sI):dI)(e,t)}function rae(e){return function(){this.removeAttribute(e)}}function iae(e){return function(){this.removeAttributeNS(e.space,e.local)}}function aae(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 oae(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 sae(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 cae(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 lae(e,t){var n=Z4(e),r=n===`transform`?kne:S8;return this.attrTween(e,typeof t==`function`?(n.local?cae:sae)(n,r,x8(this,`attr.`+e,t)):t==null?(n.local?iae:rae)(n):(n.local?oae:aae)(n,r,t))}function uae(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function dae(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fae(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&dae(e,i)),n}return i._value=t,i}function pae(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&uae(e,i)),n}return i._value=t,i}function mae(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=Z4(e);return this.tween(n,(r.local?fae:pae)(r,t))}function hae(e,t){return function(){_8(this,e).delay=+t.apply(this,arguments)}}function gae(e,t){return t=+t,function(){_8(this,e).delay=t}}function _ae(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?hae:gae)(t,e)):y8(this.node(),t).delay}function vae(e,t){return function(){v8(this,e).duration=+t.apply(this,arguments)}}function yae(e,t){return t=+t,function(){v8(this,e).duration=t}}function bae(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?vae:yae)(t,e)):y8(this.node(),t).duration}function xae(e,t){if(typeof t!=`function`)throw Error();return function(){v8(this,e).ease=t}}function Sae(e){var t=this._id;return arguments.length?this.each(xae(t,e)):y8(this.node(),t).ease}function Cae(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();v8(this,e).ease=n}}function wae(e){if(typeof e!=`function`)throw Error();return this.each(Cae(this._id,e))}function Tae(e){typeof e!=`function`&&(e=l3(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 w8(r,this._parents,this._name,this._id)}function Eae(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 w8(o,this._parents,this._name,this._id)}function Dae(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 Oae(e,t,n){var r,i,a=Dae(t)?_8:v8;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function kae(e,t){var n=this._id;return arguments.length<2?y8(this.node(),n).on.on(e):this.each(Oae(n,e,t))}function Aae(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function jae(){return this.on(`end.remove`,Aae(this._id))}function Mae(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=n3(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,g8(l[f],t,n,f,l,y8(u,n)));return new w8(a,this._parents,t,n)}function Nae(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=o3(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=y8(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&g8(p,t,n,h,f,m);a.push(f),o.push(u)}return new w8(a,o,t,n)}var Pae=H6.prototype.constructor;function Fae(){return new Pae(this._groups,this._parents)}function Iae(e,t){var n,r,i;return function(){var a=$3(this,e),o=(this.style.removeProperty(e),$3(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function C8(e){return function(){this.style.removeProperty(e)}}function Lae(e,t,n){var r,i=n+``,a;return function(){var o=$3(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Rae(e,t,n){var r,i,a;return function(){var o=$3(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),$3(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function zae(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=v8(this,e),l=c.on,u=c.value[a]==null?s||=C8(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Bae(e,t,n){var r=(e+=``)==`transform`?One:S8;return t==null?this.styleTween(e,Iae(e,r)).on(`end.style.`+e,C8(e)):typeof t==`function`?this.styleTween(e,Rae(e,r,x8(this,`style.`+e,t))).each(zae(this._id,e)):this.styleTween(e,Lae(e,r,t),n).on(`end.style.`+e,null)}function Vae(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Hae(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Vae(e,a,n)),r}return a._value=t,a}function Uae(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,Hae(e,t,n??``))}function Wae(e){return function(){this.textContent=e}}function Gae(e){return function(){this.textContent=e(this)??``}}function Kae(e){return this.tween(`text`,typeof e==`function`?Gae(x8(this,`text`,e)):Wae(e==null?``:e+``))}function qae(e){return function(t){this.textContent=e.call(this,t)}}function Jae(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&qae(r)),t}return r._value=e,r}function Yae(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,Jae(e))}function Xae(){for(var e=this._name,t=this._id,n=T8(),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=y8(c,t);g8(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new w8(r,this._parents,e,n)}function Zae(){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=v8(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 Qae=0;function w8(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function $ae(e){return H6().transition(e)}function T8(){return++Qae}var E8=H6.prototype;w8.prototype=$ae.prototype={constructor:w8,select:Mae,selectAll:Nae,selectChild:E8.selectChild,selectChildren:E8.selectChildren,filter:Tae,merge:Eae,selection:Fae,transition:Xae,call:E8.call,nodes:E8.nodes,node:E8.node,size:E8.size,empty:E8.empty,each:E8.each,on:kae,attr:lae,attrTween:mae,style:Bae,styleTween:Uae,text:Kae,textTween:Yae,remove:jae,tween:nae,delay:_ae,duration:bae,ease:Sae,easeVarying:wae,end:Zae,[Symbol.iterator]:E8[Symbol.iterator]};function eoe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var toe={time:null,delay:0,duration:250,ease:eoe};function noe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function roe(e){var t,n;e instanceof w8?(t=e._id,e=e._name):(t=T8(),(n=toe).time=u8(),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])&&g8(c,e,t,l,o,n||noe(c,t));return new w8(r,this._parents,e,t)}H6.prototype.interrupt=$ie,H6.prototype.transition=roe;var D8=e=>()=>e;function ioe(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 O8(e,t,n){this.k=e,this.x=t,this.y=n}O8.prototype={constructor:O8,scale:function(e){return e===1?this:new O8(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new O8(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 k8=new O8(1,0,0);A8.prototype=O8.prototype;function A8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return k8;return e.__zoom}function j8(e){e.stopImmediatePropagation()}function M8(e){e.preventDefault(),e.stopImmediatePropagation()}function aoe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function ooe(){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 N8(){return this.__zoom||k8}function soe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function coe(){return navigator.maxTouchPoints||`ontouchstart`in this}function loe(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 P8(){var e=aoe,t=ooe,n=loe,r=soe,i=coe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=bI,l=G4(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,N8).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`,N8),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(k8.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 O8(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 O8(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 O8(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=U6(this.that).datum();l.call(e,this.that,new ioe(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=W6(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)],b8(this),s.start();M8(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=U6(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=W6(t,i),l=t.clientX,u=t.clientY;J6(t.view),j8(t),a.mouse=[c,this.__zoom.invert(c)],b8(this),a.start();function d(e){if(M8(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]=W6(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Y6(e.view,a.moved),M8(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=W6(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);M8(r),s>0?U6(this).transition().duration(s).call(x,d,c,r):U6(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(j8(t),s=0;s<i;++s)c=r[s],l=W6(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)),b8(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(M8(e),s=0;s<a;++s)c=i[s],l=W6(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(j8(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=W6(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=U6(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:D8(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:D8(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:D8(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:D8([[+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 F8={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]],L8=[`Enter`,` `,`Escape`],R8={"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`},z8;(function(e){e.Strict=`strict`,e.Loose=`loose`})(z8||={});var B8;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(B8||={});var V8;(function(e){e.Partial=`partial`,e.Full=`full`})(V8||={});var H8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},U8;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(U8||={});var W8;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(W8||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var G8={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function K8(e){return e===null?null:e?`valid`:`invalid`}var q8=e=>`id`in e&&`source`in e&&`target`in e,uoe=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),J8=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Y8=(e,t=[0,0])=>{let{width:n,height:r}=b5(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},doe=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:o5(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):J8(n)?n:t.nodeLookup.get(n.id)),i5(e,i?c5(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),X8=(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=i5(n,c5(e)),r=!0)}),r?o5(n):{x:0,y:0,width:0,height:0}},Z8=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...m5(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=u5(s,s5(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},foe=(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 poe(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 moe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=_5(X8(poe(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 Q8({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`,F8.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&y5(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=y5(d)?e5(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,F8.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 hoe({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=foe(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 $8=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),e5=(e={x:0,y:0},t,n)=>({x:$8(e.x,t[0][0],t[1][0]-(n?.width??0)),y:$8(e.y,t[0][1],t[1][1]-(n?.height??0))});function t5(e,t,n){let{width:r,height:i}=b5(n),{x:a,y:o}=n.internals.positionAbsolute;return e5(e,[[a,o],[a+r,o+i]],t)}var n5=(e,t,n)=>e<t?$8(Math.abs(e-t),1,t)/t:e>n?-$8(Math.abs(e-n),1,t)/t:0,r5=(e,t,n=15,r=40)=>[n5(e.x,r,t.width-r)*n,n5(e.y,r,t.height-r)*n],i5=(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)}),a5=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),o5=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),s5=(e,t=[0,0])=>{let{x:n,y:r}=J8(e)?e.internals.positionAbsolute:Y8(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}},c5=(e,t=[0,0])=>{let{x:n,y:r}=J8(e)?e.internals.positionAbsolute:Y8(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)}},l5=(e,t)=>o5(i5(a5(e),a5(t))),u5=(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)},d5=e=>f5(e.width)&&f5(e.height)&&f5(e.x)&&f5(e.y),f5=e=>!isNaN(e)&&isFinite(e),goe=(e,t)=>{},p5=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),m5=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?p5(s,o):s},h5=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function g5(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 _oe(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=g5(e,n),i=g5(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=g5(e.top??e.y??0,n),i=g5(e.bottom??e.y??0,n),a=g5(e.left??e.x??0,t),o=g5(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 voe(e,t,n,r,i,a){let{x:o,y:s}=h5(e,[t,n,r]),{x:c,y:l}=h5({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 _5=(e,t,n,r,i,a)=>{let o=_oe(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=$8(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=voe(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}},v5=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function y5(e){return e!=null&&e!==`parent`}function b5(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function x5(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function S5(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 C5(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function yoe(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function boe(e){return{...R8,...e||{}}}function w5(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=k5(e),s=m5({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?p5(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var T5=e=>({width:e.offsetWidth,height:e.offsetHeight}),E5=e=>e?.getRootNode?.()||window?.document,xoe=[`INPUT`,`SELECT`,`TEXTAREA`];function D5(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?xoe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var O5=e=>`clientX`in e,k5=(e,t)=>{let n=O5(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)}},A5=(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,...T5(t)}})};function j5({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 M5(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 $.Left:return[t-M5(t-r,a),n];case $.Right:return[t+M5(r-t,a),n];case $.Top:return[t,n-M5(n-i,a)];case $.Bottom:return[t,n+M5(i-n,a)]}}function P5({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.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]=j5({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 F5({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 Soe({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 Coe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=i5(c5(e),c5(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),u5({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},o5(a))>0}var woe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Toe=(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)),Eoe=(e,t,n={})=>{if(!e.source||!e.target)return F8.error006(),t;let r=n.getEdgeId||woe,i;return i=q8(e)?{...e}:{...e,id:r(e)},Toe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function I5({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=F5({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var L5={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},Doe=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.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},R5=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Ooe({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=L5[t],c=L5[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=Doe({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]=F5({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 koe(e,t,n,r){let i=Math.min(R5(e,t)/2,R5(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 z5({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=Ooe({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+=koe(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 B5(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Aoe(e){let{sourceNode:t,targetNode:n}=e;if(!B5(t)||!B5(n))return null;let r=t.internals.handleBounds||V5(t.handles),i=n.internals.handleBounds||V5(n.handles),a=U5(r?.source??[],e.sourceHandle),o=U5(e.connectionMode===z8.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,F8.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=H5(t,a,s),u=H5(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function V5(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 H5(e,t,n=$.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??b5(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function U5(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function W5(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function joe(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=W5(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 G5=1e3,Moe=10,K5={nodeOrigin:[0,0],nodeExtent:I8,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Noe={...K5,checkEquality:!0};function q5(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function Poe(e,t,n){let r=q5(K5,n);for(let n of e.values())if(n.parentId)X5(n,e,t,r);else{let e=e5(Y8(n,r.nodeOrigin),y5(n.extent)?n.extent:r.nodeExtent,b5(n));n.internals.positionAbsolute=e}}function Foe(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 J5(e){return e===`manual`}function Y5(e,t,n,r={}){let i=q5(Noe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!J5(i.zIndexMode)?G5: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=e5(Y8(u,i.nodeOrigin),y5(u.extent)?u.extent:i.nodeExtent,b5(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Foe(u,e),z:Z5(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&&X5(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Ioe(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 X5(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=q5(K5,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}Ioe(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*Moe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=Loe(e,u,o,s,a&&!J5(c)?G5: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 Z5(e,t,n){let r=f5(e.zIndex)?e.zIndex:0;return J5(n)?r:r+(e.selected?t:0)}function Loe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=b5(e),l=Y8(e,n),u=y5(e.extent)?e5(l,e.extent,c):l,d=e5({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=t5(d,c,t));let f=Z5(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Q5(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=l5(a.get(n.parentId)?.expandedRect??s5(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=b5(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 Roe(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=T5(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=y5(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=t5(h,s,t.get(e.parentId)):m&&(h=e5(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:A5(`source`,r.nodeElement,p,d,e.id),target:A5(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&X5(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:s5(g,i)}))}}if(f.length>0){let e=Q5(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function zoe({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 $5(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 e7(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}`;$5(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),$5(`target`,s,c,e,i,o),t.set(r.id,r)}}function t7(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:t7(n,t):!1}function n7(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 Boe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!t7(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 r7({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 Voe({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=p5(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Hoe({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=U6(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?a5(X8(s)):null,x=v&&l?Voe({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)}:p5(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}=Q8({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]=r7({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]=r5(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=w5(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Boe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=r7({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Q6().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=w5(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=k5(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=w5(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=k5(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=k5(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]=r7({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||!n7(t,`.${g}`,v))&&(!_||n7(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Uoe(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())u5(i,s5(e))>0&&r.push(e);return r}var Woe=250;function Goe(e,t,n,r){let i=[],a=1/0,o=Uoe(e,n,t+Woe);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}=H5(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 i7(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,...H5(o,c,c.position,!0)}:c}function a7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Koe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var o7=()=>!0;function qoe(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:_=o7,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=E5(e.target),E=0,D,{x:O,y:k}=k5(e),A=a7(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=i7(i,A,r,c,t);if(!N)return;let ee=k5(e,j),P=!1,F=null,I=!1,L=null;function te(){if(!u||!j)return;let[e,t]=r5(ee,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let ne={...N,nodeId:i,type:A,position:N.position},re=c.get(i),R={inProgress:!0,isValid:null,from:H5(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:ee,toHandle:null,toPosition:G8[ne.position],toNode:null,pointer:ee};function ie(){M=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ie();function ae(e){if(!M){let{x:t,y:n}=k5(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!ne){oe(e);return}let a=b();ee=k5(e,j),D=Goe(m5(ee,a,!1,[1,1]),n,c,ne),P||=(te(),!0);let s=s7(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,F=s.connection,I=Koe(!!D,s.isValid);let u=c.get(i),f=u?H5(u,ne,$.Left,!0):R.from,p={...R,from:f,isValid:I,to:s.toHandle&&I?h5({x:s.toHandle.x,y:s.toHandle.y},a):ee,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:G8[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:ee};y(p),R=p}function oe(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&F&&I&&h?.(F);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),P=!1,I=!1,F=null,L=null,T.removeEventListener(`mousemove`,ae),T.removeEventListener(`mouseup`,oe),T.removeEventListener(`touchmove`,ae),T.removeEventListener(`touchend`,oe)}}T.addEventListener(`mousemove`,ae),T.addEventListener(`mouseup`,oe),T.addEventListener(`touchmove`,ae),T.addEventListener(`touchend`,oe)}function s7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=o7,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}=k5(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=a7(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===z8.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=i7(t,e,a,u,n,!0)}return _}var c7={onPointerDown:qoe,isValid:s7};function Joe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=U6(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&&v5()?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=P8().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:W6}}var l7=e=>({x:e.x,y:e.y,zoom:e.k}),u7=({x:e,y:t,zoom:n})=>k8.translate(e,t).scale(n),d7=(e,t)=>e.target.closest(`.${t}`),f7=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Yoe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,p7=(e,t=0,n=Yoe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},m7=e=>{let t=e.ctrlKey&&v5()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Xoe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(d7(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=W6(u),t=d*2**m7(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===B8.Vertical?0:u.deltaX*f,m=i===B8.Horizontal?0:u.deltaY*f;!v5()&&u.shiftKey&&i!==B8.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=l7(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 Zoe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=d7(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Qoe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=l7(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 $oe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&f7(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,l7(a.transform))}}function ese({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&f7(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=l7(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function tse({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`&&(d7(d,`${l}-flow__node`)||d7(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||d7(d,s)&&m||d7(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 nse({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=P8().scaleExtent([t,n]).translateExtent(r),f=U6(e).call(d);v({x:i.x,y:i.y,zoom:$8(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(m7);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?fI:bI).transform(p7(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:!f5(E)||E<0?0:E);let k=O?Xoe({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Zoe({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=Qoe({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=$oe({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=ese({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=tse({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=u7(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=u7(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=u7(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?A8(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`?fI:bI).scaleTo(p7(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`?fI:bI).scaleBy(p7(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=!f5(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 h7;(function(e){e.Line=`line`,e.Handle=`handle`})(h7||={});function rse({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 g7(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 _7(e,t){return Math.max(0,t-e)}function v7(e,t){return Math.max(0,e-t)}function y7(e,t,n){return Math.max(0,t-e,e-n)}function b7(e,t){return e?!t:t}function ise(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=y7(E,h,g),j=y7(D,_,v);if(o){let e=0,t=0;c&&w<0?e=_7(y+w+O,o[0][0]):!c&&w>0&&(e=v7(y+E+O,o[1][0])),l&&T<0?t=_7(b+T+k,o[0][1]):!l&&T>0&&(t=v7(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=v7(y+w,s[0][0]):!c&&w<0&&(e=_7(y+E,s[1][0])),l&&T>0?t=v7(b+T,s[0][1]):!l&&T<0&&(t=_7(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=y7(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?v7(b+k+E/C,o[1][1])*C:_7(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?_7(b+E/C,s[1][1])*C:v7(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=y7(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?v7(y+D*C+O,o[1][0])/C:_7(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?_7(y+D*C,s[1][0])/C:v7(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=(b7(c,l)?-w:w)/C:w=(b7(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 x7={width:0,height:0,x:0,y:0},ase={...x7,pointerX:0,pointerY:0,aspectRatio:1};function ose(e){return[[0,0],[e.measured.width,e.measured.height]]}function sse(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 cse({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=U6(e),o={controlDirection:g7(`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={...x7},h={...ase};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:g7(e)};let g,_=null,v=[],y,b,x,S=!1,C=Q6().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}=w5(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`?ose(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=sse(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=w5(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}=ise(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 P=rse({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),F={...m,direction:P};p?.(e,F)!==!1&&(S=!0,d?.(e,F),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 S7=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},lse=e=>e?S7(e):S7,{useDebugValue:use}=z.default,{useSyncExternalStoreWithSelector:dse}=bw.default,fse=e=>e;function C7(e,t=fse,n){let r=dse(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return use(r),r}var w7=(e,t)=>{let n=lse(e),r=(e,r=t)=>C7(n,e,r);return Object.assign(r,n),r},pse=(e,t)=>e?w7(e,t):w7;function T7(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 E7=(0,z.createContext)(null),D7=E7.Provider,O7=F8.error001();function k7(e,t){let n=(0,z.useContext)(E7);if(n===null)throw Error(O7);return C7(n,e,t)}function A7(){let e=(0,z.useContext)(E7);if(e===null)throw Error(O7);return(0,z.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var j7={display:`none`},mse={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},M7=`react-flow__node-desc`,N7=`react-flow__edge-desc`,hse=`react-flow__aria-live`,gse=e=>e.ariaLiveMessage,_se=e=>e.ariaLabelConfig;function vse({rfId:e}){let t=k7(gse);return(0,B.jsx)(`div`,{id:`${hse}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:mse,children:t})}function yse({rfId:e,disableKeyboardA11y:t}){let n=k7(_se);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{id:`${M7}-${e}`,style:j7,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,B.jsx)(`div`,{id:`${N7}-${e}`,style:j7,children:n[`edge.a11yDescription.default`]}),!t&&(0,B.jsx)(vse,{rfId:e})]})}var P7=(0,z.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,B.jsx)(`div`,{className:U4([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));P7.displayName=`Panel`;function bse({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,B.jsx)(P7,{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,B.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var xse=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}},F7=e=>e.id;function Sse(e,t){return T7(e.selectedNodes.map(F7),t.selectedNodes.map(F7))&&T7(e.selectedEdges.map(F7),t.selectedEdges.map(F7))}function Cse({onSelectionChange:e}){let t=A7(),{selectedNodes:n,selectedEdges:r}=k7(xse,Sse);return(0,z.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var wse=e=>!!e.onSelectionChangeHandlers;function Tse({onSelectionChange:e}){let t=k7(wse);return e||t?(0,B.jsx)(Cse,{onSelectionChange:e}):null}var I7=typeof window<`u`?z.useLayoutEffect:z.useEffect,L7=[0,0],Ese={x:0,y:0,zoom:1},R7=[...`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`],Dse=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}),z7={translateExtent:I8,nodeOrigin:L7,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Ose(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=k7(Dse,T7),l=A7();I7(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=z7,s()}),[]);let u=(0,z.useRef)(z7);return I7(()=>{for(let s of R7){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:boe(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},R7.map(t=>e[t])),null}function B7(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function kse(e){let[t,n]=(0,z.useState)(e===`system`?null:e);return(0,z.useEffect)(()=>{if(e!==`system`){n(e);return}let t=B7(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?B7()?.matches?`dark`:`light`:t}var V7=typeof document<`u`?document:null;function H7(e=null,t={target:V7,actInsideInputWithModifier:!0}){let[n,r]=(0,z.useState)(!1),i=(0,z.useRef)(!1),a=(0,z.useRef)(new Set([])),[o,s]=(0,z.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
68
68
|
`).replace(`
|
|
69
69
|
|
|
70
70
|
`,`
|
|
71
71
|
+`).split(`
|
|
72
72
|
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,z.useEffect)(()=>{let n=t?.target??V7,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&D5(e))return!1;let n=W7(e.code,s);if(a.current.add(e[n]),U7(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=W7(e.code,s);U7(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function U7(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function W7(e,t){return t.includes(e)?`code`:`key`}var Ase=()=>{let e=A7();return(0,z.useMemo)(()=>({zoomIn:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=_5(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return m5(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=h5(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function G7(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)jse(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function jse(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function K7(e,t){return G7(e,t)}function q7(e,t){return G7(e,t)}function J7(e,t){return{id:e,type:`select`,selected:t}}function Y7(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(J7(a.id,e)))}return r}function X7({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function Z7(e){return{id:e.id,type:`remove`}}var Q7=e=>uoe(e),Mse=e=>q8(e);function $7(e){return(0,z.forwardRef)(e)}function e9(e){let[t,n]=(0,z.useState)(BigInt(0)),[r]=(0,z.useState)(()=>Nse(()=>n(e=>e+BigInt(1))));return I7(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Nse(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var t9=(0,z.createContext)(null);function Pse({children:e}){let t=A7(),n=e9((0,z.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=X7({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=e9((0,z.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(X7({items:s,lookup:o}))},[])),i=(0,z.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,B.jsx)(t9.Provider,{value:i,children:e})}function Fse(){let e=(0,z.useContext)(t9);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Ise=e=>!!e.panZoom;function n9(){let e=Ase(),t=A7(),n=Fse(),r=k7(Ise),i=(0,z.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=Q7(e)?e:n.get(e.id),a=i.parentId?S5(i.position,i.measured,i.parentId,n,r):i.position;return s5({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Q7(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Mse(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await hoe({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Z7);o?.(f),c(e)}if(m){let e=d.map(Z7);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=d5(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=s5(s?r:a),l=u5(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=d5(e)?e:a(e);if(!r)return!1;let i=u5(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return doe(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??yoe();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,z.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var r9=e=>e.selected,Lse=typeof window<`u`?window:void 0;function Rse({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=A7(),{deleteElements:r}=n9(),i=H7(e,{actInsideInputWithModifier:!1}),a=H7(t,{target:Lse});(0,z.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(r9),edges:e.filter(r9)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,z.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function zse(e){let t=A7();(0,z.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=T5(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,F8.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var i9={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Bse=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Vse({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=B8.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=A7(),S=(0,z.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=k7(Bse,T7),E=H7(f),D=(0,z.useRef)();zse(S);let O=(0,z.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,z.useEffect)(()=>{if(S.current){D.current=nse({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,z.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,B.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:i9,children:m})}var Hse=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Use(){let{userSelectionActive:e,userSelectionRect:t}=k7(Hse,T7);return e&&t?(0,B.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var a9=(e,t)=>n=>{n.target===t.current&&e?.(n)},Wse=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Gse({isSelecting:e,selectionKeyPressed:t,selectionMode:n=V8.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:s,onPaneClick:c,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:p,children:m}){let h=A7(),{userSelectionActive:g,elementsSelectable:_,dragging:v,connectionInProgress:y}=k7(Wse,T7),b=_&&(e||g),x=(0,z.useRef)(null),S=(0,z.useRef)(),C=(0,z.useRef)(new Set),w=(0,z.useRef)(new Set),T=(0,z.useRef)(!1),E=e=>{if(T.current||y){T.current=!1;return}c?.(e),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},D=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}l?.(e)},O=u?e=>u(e):void 0;return(0,B.jsxs)(`div`,{className:U4([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:v,selection:e}]),onClick:b?void 0:a9(E,x),onContextMenu:a9(D,x),onWheel:a9(O,x),onPointerEnter:b?void 0:d,onPointerMove:b?e=>{let{userSelectionRect:r,transform:a,nodeLookup:s,edgeLookup:c,connectionLookup:l,triggerNodeChanges:u,triggerEdgeChanges:d,defaultEdgeOptions:f,resetSelectedElements:p}=h.getState();if(!S.current||!r)return;let{x:m,y:g}=k5(e.nativeEvent,S.current),{startX:_,startY:v}=r;if(!T.current){let n=t?0:i;if(Math.hypot(m-_,g-v)<=n)return;p(),o?.(e)}T.current=!0;let y={startX:_,startY:v,x:m<_?m:_,y:g<v?g:v,width:Math.abs(m-_),height:Math.abs(g-v)},b=C.current,x=w.current;C.current=new Set(Z8(s,y,a,n===V8.Partial,!0).map(e=>e.id)),w.current=new Set;let E=f?.selectable??!0;for(let e of C.current){let t=l.get(e);if(t)for(let{edgeId:e}of t.values()){let t=c.get(e);t&&(t.selectable??E)&&w.current.add(e)}}C5(b,C.current)||u(Y7(s,C.current,!0)),C5(x,w.current)||d(Y7(c,w.current)),h.setState({userSelectionRect:y,userSelectionActive:!0,nodesSelectionActive:!1})}:f,onPointerUp:b?e=>{e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!g&&e.target===x.current&&h.getState().userSelectionRect&&E?.(e),h.setState({userSelectionActive:!1,userSelectionRect:null}),T.current&&(s?.(e),h.setState({nodesSelectionActive:C.current.size>0})))}:void 0,onPointerDownCapture:b?n=>{let{domNode:r}=h.getState();if(S.current=r?.getBoundingClientRect(),!S.current)return;let i=n.target===x.current;if(!i&&n.target.closest(`.nokey`)||!e||!(a&&i||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),T.current=!1;let{x:o,y:s}=k5(n.nativeEvent,S.current);h.setState({userSelectionRect:{width:0,height:0,startX:o,startY:s,x:o,y:s}}),i||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:b?e=>{T.current&&=(e.stopPropagation(),!1)}:void 0,onPointerLeave:p,ref:x,style:i9,children:[m,(0,B.jsx)(Use,{})]})}function o9({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,F8.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function s9({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=A7(),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)();return(0,z.useEffect)(()=>{u.current=Hoe({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{o9({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,z.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var Kse=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function c9(){let e=A7();return(0,z.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Kse(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=p5(t,i));let{position:a,positionAbsolute:s}=Q8({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var l9=(0,z.createContext)(null),qse=l9.Provider;l9.Consumer;var u9=()=>(0,z.useContext)(l9),Jse=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Yse=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o,u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===z8.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Xse({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=A7(),_=u9(),{connectOnClick:v,noPanClassName:y,rfId:b}=k7(Jse,T7),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=k7(Yse(_,m,e),T7);_||g.getState().onError?.(`010`,F8.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t}=g.getState();t(Eoe(i,e))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=O5(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();c7.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,B.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:U4([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=E5(t.target),h=n||c,{connection:v,isValid:y}=c7.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var d9=(0,z.memo)($7(Xse));function Zse({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,B.jsxs)(B.Fragment,{children:[e?.label,(0,B.jsx)(d9,{type:`source`,position:n,isConnectable:t})]})}function Qse({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(d9,{type:`target`,position:n,isConnectable:t}),e?.label,(0,B.jsx)(d9,{type:`source`,position:r,isConnectable:t})]})}function $se(){return null}function ece({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(d9,{type:`target`,position:n,isConnectable:t}),e?.label]})}var f9={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},p9={input:Zse,default:Qse,output:ece,group:$se};function tce(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var nce=e=>{let{width:t,height:n,x:r,y:i}=X8(e.nodeLookup,{filter:e=>!!e.selected});return{width:f5(t)?t:null,height:f5(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function rce({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=A7(),{width:i,height:a,transformString:o,userSelectionActive:s}=k7(nce,T7),c=c9(),l=(0,z.useRef)(null);(0,z.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(s9({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,B.jsx)(`div`,{className:U4([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,B.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(f9,e.key)&&(e.preventDefault(),c({direction:f9[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var m9=typeof window<`u`?window:void 0,ice=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function h9({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,defaultViewport:T,translateExtent:E,minZoom:D,maxZoom:O,preventScrolling:k,onSelectionContextMenu:A,noWheelClassName:j,noPanClassName:M,disableKeyboardA11y:N,onViewportChange:ee,isControlledViewport:P}){let{nodesSelectionActive:F,userSelectionActive:I}=k7(ice,T7),L=H7(l,{target:m9}),te=H7(h,{target:m9}),ne=te||w,re=te||b,R=u&&ne!==!0,ie=L||I||R;return Rse({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,B.jsx)(Vse,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:re,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!L&&ne,defaultViewport:T,translateExtent:E,minZoom:D,maxZoom:O,zoomActivationKeyCode:g,preventScrolling:k,noWheelClassName:j,noPanClassName:M,onViewportChange:ee,isControlledViewport:P,paneClickDistance:s,selectionOnDrag:R,children:(0,B.jsxs)(Gse,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ne,isSelecting:!!ie,selectionMode:d,selectionKeyPressed:L,paneClickDistance:s,selectionOnDrag:R,children:[e,F&&(0,B.jsx)(rce,{onSelectionContextMenu:A,noPanClassName:M,disableKeyboardA11y:N})]})})}h9.displayName=`FlowRenderer`;var ace=(0,z.memo)(h9),oce=e=>t=>e?Z8(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function sce(e){return k7((0,z.useCallback)(oce(e),[e]),T7)}var cce=e=>e.updateNodeInternals;function lce(){let e=k7(cce),[t]=(0,z.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,z.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function uce({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=A7(),a=(0,z.useRef)(null),o=(0,z.useRef)(null),s=(0,z.useRef)(e.sourcePosition),c=(0,z.useRef)(e.targetPosition),l=(0,z.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,z.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,z.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,z.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function dce({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=k7(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},T7),S=y.type||`default`,C=g?.[S]||p9[S];C===void 0&&(v?.(`003`,F8.error003(S)),S=`default`,C=g?.default||p9.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=A7(),k=x5(y),A=uce({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=s9({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=c9();if(y.hidden)return null;let N=b5(y),ee=tce(y),P=T||w||t||n||r||i,F=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,ne=o?e=>o(e,{...b.userNode}):void 0,re=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&o9({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},R=t=>{if(!(D5(t.nativeEvent)||m)){if(L8.includes(t.key)&&T)o9({id:e,store:O,unselect:t.key===`Escape`,nodeRef:A});else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(f9,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:f9[t.key],factor:t.shiftKey?4:1})}}},ie=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Z8(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,B.jsx)(`div`,{className:U4([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:P?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...ee},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:I,onMouseLeave:L,onContextMenu:te,onClick:re,onDoubleClick:ne,onKeyDown:D?R:void 0,tabIndex:D?0:void 0,onFocus:D?ie:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${M7}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,B.jsx)(qse,{value:e,children:(0,B.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var fce=(0,z.memo)(dce),pce=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function g9(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=k7(pce,T7),o=sce(e.onlyRenderVisibleElements),s=lce();return(0,B.jsx)(`div`,{className:`react-flow__nodes`,style:i9,children:o.map(o=>(0,B.jsx)(fce,{id:o,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}g9.displayName=`NodeRenderer`;var mce=(0,z.memo)(g9);function hce(e){return k7((0,z.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Coe({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),T7)}var gce=({color:e=`none`,strokeWidth:t=1})=>(0,B.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),_ce=({color:e=`none`,strokeWidth:t=1})=>(0,B.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),_9={[W8.Arrow]:gce,[W8.ArrowClosed]:_ce};function vce(e){let t=A7();return(0,z.useMemo)(()=>Object.prototype.hasOwnProperty.call(_9,e)?_9[e]:(t.getState().onError?.(`009`,F8.error009(e)),null),[e])}var yce=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=vce(t);return c?(0,B.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,B.jsx)(c,{color:n,strokeWidth:o})}):null},v9=({defaultColor:e,rfId:t})=>{let n=k7(e=>e.edges),r=k7(e=>e.defaultEdgeOptions),i=(0,z.useMemo)(()=>joe(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,B.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,B.jsx)(`defs`,{children:i.map(e=>(0,B.jsx)(yce,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};v9.displayName=`MarkerDefinitions`;var bce=(0,z.memo)(v9);function y9({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,z.useState)({x:1,y:0,width:0,height:0}),p=U4([`react-flow__edge-textwrapper`,l]),m=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,B.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,B.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,B.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}y9.displayName=`EdgeText`;var xce=(0,z.memo)(y9);function b9({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{...u,d:e,fill:`none`,className:U4([`react-flow__edge-path`,u.className])}),l?(0,B.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&f5(t)&&f5(n)?(0,B.jsx)(xce,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function x9({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function S9({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=x9({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=x9({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=j5({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function C9(e){return(0,z.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=S9({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,B.jsx)(b9,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Sce=C9({isInternal:!1}),w9=C9({isInternal:!0});Sce.displayName=`SimpleBezierEdge`,w9.displayName=`SimpleBezierEdgeInternal`;function T9(e){return(0,z.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=z5({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,B.jsx)(b9,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var E9=T9({isInternal:!1}),D9=T9({isInternal:!0});E9.displayName=`SmoothStepEdge`,D9.displayName=`SmoothStepEdgeInternal`;function O9(e){return(0,z.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,B.jsx)(E9,{...n,id:r,pathOptions:(0,z.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Cce=O9({isInternal:!1}),k9=O9({isInternal:!0});Cce.displayName=`StepEdge`,k9.displayName=`StepEdgeInternal`;function A9(e){return(0,z.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=I5({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,B.jsx)(b9,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var wce=A9({isInternal:!1}),j9=A9({isInternal:!0});wce.displayName=`StraightEdge`,j9.displayName=`StraightEdgeInternal`;function M9(e){return(0,z.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=P5({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,B.jsx)(b9,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var Tce=M9({isInternal:!1}),N9=M9({isInternal:!0});Tce.displayName=`BezierEdge`,N9.displayName=`BezierEdgeInternal`;var P9={default:N9,straight:j9,step:k9,smoothstep:D9,simplebezier:w9},F9={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Ece=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,Dce=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,I9=`react-flow__edgeupdater`;function L9({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,B.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:U4([I9,`${I9}-${s}`]),cx:Ece(t,r,e),cy:Dce(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Oce({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=A7(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;c7.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,B.jsxs)(B.Fragment,{children:[(e===!0||e===`source`)&&(0,B.jsx)(L9,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,B.jsx)(L9,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function kce({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=k7(t=>t.edgeLookup.get(e)),b=k7(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||P9[x];S===void 0&&(_?.(`011`,F8.error011(x)),x=`default`,S=h?.default||P9.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,z.useRef)(null),[D,O]=(0,z.useState)(!1),[k,A]=(0,z.useState)(!1),j=A7(),{zIndex:M,sourceX:N,sourceY:ee,targetX:P,targetY:F,sourcePosition:I,targetPosition:L}=k7((0,z.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return{zIndex:y.zIndex,...F9};let i=Aoe({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_});return{zIndex:Soe({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode}),...i||F9}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),T7),te=(0,z.useMemo)(()=>y.markerStart?`url('#${W5(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,z.useMemo)(()=>y.markerEnd?`url('#${W5(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||ee===null||P===null||F===null)return null;let re=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},R=a?e=>{a(e,{...y})}:void 0,ie=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return(0,B.jsx)(`svg`,{style:{zIndex:M},children:(0,B.jsxs)(`g`,{className:U4([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:re,onDoubleClick:R,onContextMenu:ie,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&L8.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${N7}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,B.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:ee,targetX:P,targetY:F,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:te,markerEnd:ne,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,B.jsx)(Oce,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:ee,targetX:P,targetY:F,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var Ace=(0,z.memo)(kce),jce=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function R9({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=k7(jce,T7),b=hce(t);return(0,B.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,B.jsx)(bce,{defaultColor:e,rfId:n}),b.map(e=>(0,B.jsx)(Ace,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}R9.displayName=`EdgeRenderer`;var Mce=(0,z.memo)(R9),Nce=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Pce({children:e}){return(0,B.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:k7(Nce)},children:e})}function Fce(e){let t=n9(),n=(0,z.useRef)(!1);(0,z.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var Ice=e=>e.panZoom?.syncViewport;function Lce(e){let t=k7(Ice),n=A7();return(0,z.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function z9(e){return e.connection.inProgress?{...e.connection,to:m5(e.connection.to,e.transform)}:{...e.connection}}function Rce(e){return e?t=>e(z9(t)):z9}function zce(e){return k7(Rce(e),T7)}var Bce=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Vce({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=k7(Bce,T7);return a&&i&&c?(0,B.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,B.jsx)(`g`,{className:U4([`react-flow__connection`,K8(s)]),children:(0,B.jsx)(B9,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var B9=({style:e,type:t=U8.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=zce();if(!i)return;if(n)return(0,B.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:K8(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case U8.Bezier:[m]=P5(h);break;case U8.SimpleBezier:[m]=S9(h);break;case U8.Step:[m]=z5({...h,borderRadius:0});break;case U8.SmoothStep:[m]=z5(h);break;default:[m]=I5(h)}return(0,B.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};B9.displayName=`ConnectionLine`;var Hce={};function V9(e=Hce){(0,z.useRef)(e),A7(),(0,z.useEffect)(()=>{},[e])}function Uce(){A7(),(0,z.useRef)(!1),(0,z.useEffect)(()=>{},[])}function H9({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:ee,panOnScroll:P,panOnScrollSpeed:F,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:te,onPaneClick:ne,onPaneMouseEnter:re,onPaneMouseMove:R,onPaneMouseLeave:ie,onPaneScroll:ae,onPaneContextMenu:oe,paneClickDistance:se,nodeClickDistance:ce,onEdgeContextMenu:le,onEdgeMouseEnter:ue,onEdgeMouseMove:de,onEdgeMouseLeave:fe,reconnectRadius:pe,onReconnect:me,onReconnectStart:he,onReconnectEnd:ge,noDragClassName:_e,noWheelClassName:ve,noPanClassName:ye,disableKeyboardA11y:be,nodeExtent:xe,rfId:Se,viewport:Ce,onViewportChange:we}){return V9(e),V9(t),Uce(),Fce(n),Lce(Ce),(0,B.jsx)(ace,{onPaneClick:ne,onPaneMouseEnter:re,onPaneMouseMove:R,onPaneMouseLeave:ie,onPaneContextMenu:oe,onPaneScroll:ae,paneClickDistance:se,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:ee,zoomOnDoubleClick:L,panOnScroll:P,panOnScrollSpeed:F,panOnScrollMode:I,panOnDrag:te,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:_e,noWheelClassName:ve,noPanClassName:ye,disableKeyboardA11y:be,onViewportChange:we,isControlledViewport:!!Ce,children:(0,B.jsxs)(Pce,{children:[(0,B.jsx)(Mce,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:me,onReconnectStart:he,onReconnectEnd:ge,onlyRenderVisibleElements:T,onEdgeContextMenu:le,onEdgeMouseEnter:ue,onEdgeMouseMove:de,onEdgeMouseLeave:fe,reconnectRadius:pe,defaultMarkerColor:M,noPanClassName:ye,disableKeyboardA11y:be,rfId:Se}),(0,B.jsx)(Vce,{style:h,type:m,component:g,containerStyle:_}),(0,B.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,B.jsx)(mce,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ce,onlyRenderVisibleElements:T,noPanClassName:ye,noDragClassName:_e,disableKeyboardA11y:be,nodeExtent:xe,rfId:Se}),(0,B.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}H9.displayName=`GraphView`;var Wce=(0,z.memo)(H9),U9=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??I8;e7(h,g,_);let{nodesInitialized:x}=Y5(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=_5(X8(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:I8,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:z8.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...H8},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:goe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:R8,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Gce=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>pse((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await moe({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...U9({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=Y5(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();e7(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=Roe(e,n,r,i,a,o,l);d&&(Poe(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=H5(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Q5(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(K7(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(q7(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>J7(e,!0)));return}i(Y7(r,new Set([...e]),!0)),a(Y7(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>J7(e,!0)));return}a(Y7(n,new Set([...e]))),i(Y7(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(J7(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(J7(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,J7(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,J7(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(Y5(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return zoe({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return Promise.resolve(!1);let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...H8}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...U9()})}},Object.is);function Kce({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,z.useState)(()=>Gce({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,B.jsx)(D7,{value:m,children:(0,B.jsx)(Pse,{children:p})})}function qce({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,z.useContext)(E7)?(0,B.jsx)(B.Fragment,{children:e}):(0,B.jsx)(Kce,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var Jce={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Yce({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:ee,onSelectionEnd:P,onBeforeDelete:F,connectionMode:I,connectionLineType:L=U8.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:R=`Backspace`,selectionKeyCode:ie=`Shift`,selectionOnDrag:ae=!1,selectionMode:oe=V8.Full,panActivationKeyCode:se=`Space`,multiSelectionKeyCode:ce=v5()?`Meta`:`Control`,zoomActivationKeyCode:le=v5()?`Meta`:`Control`,snapToGrid:ue,snapGrid:de,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:pe,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,nodeOrigin:ve=L7,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe=!0,defaultViewport:Se=Ese,minZoom:Ce=.5,maxZoom:we=2,translateExtent:Te=I8,preventScrolling:Ee=!0,nodeExtent:De,defaultMarkerColor:Oe=`#b1b1b7`,zoomOnScroll:ke=!0,zoomOnPinch:Ae=!0,panOnScroll:je=!1,panOnScrollSpeed:Me=.5,panOnScrollMode:Ne=B8.Free,zoomOnDoubleClick:Pe=!0,panOnDrag:Fe=!0,onPaneClick:Ie,onPaneMouseEnter:Le,onPaneMouseMove:Re,onPaneMouseLeave:ze,onPaneScroll:Be,onPaneContextMenu:Ve,paneClickDistance:He=1,nodeClickDistance:Ue=0,children:We,onReconnect:Ge,onReconnectStart:Ke,onReconnectEnd:qe,onEdgeContextMenu:Je,onEdgeDoubleClick:Ye,onEdgeMouseEnter:Xe,onEdgeMouseMove:Ze,onEdgeMouseLeave:Qe,reconnectRadius:$e=10,onNodesChange:et,onEdgesChange:tt,noDragClassName:nt=`nodrag`,noWheelClassName:rt=`nowheel`,noPanClassName:it=`nopan`,fitView:at,fitViewOptions:ot,connectOnClick:st,attributionPosition:ct,proOptions:lt,defaultEdgeOptions:ut,elevateNodesOnSelect:dt=!0,elevateEdgesOnSelect:ft=!1,disableKeyboardA11y:pt=!1,autoPanOnConnect:mt,autoPanOnNodeDrag:ht,autoPanSpeed:gt,connectionRadius:_t,isValidConnection:vt,onError:yt,style:bt,id:xt,nodeDragThreshold:St,connectionDragThreshold:Ct,viewport:wt,onViewportChange:Tt,width:Et,height:Dt,colorMode:Ot=`light`,debug:kt,onScroll:At,ariaLabelConfig:jt,zIndexMode:Mt=`basic`,...Nt},Pt){let Ft=xt||`1`,It=kse(Ot),Lt=(0,z.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),At?.(e)},[At]);return(0,B.jsx)(`div`,{"data-testid":`rf__wrapper`,...Nt,onScroll:Lt,style:{...bt,...Jce},ref:Pt,className:U4([`react-flow`,i,It]),id:xt,role:`application`,children:(0,B.jsxs)(qce,{nodes:e,edges:t,width:Et,height:Dt,fitView:at,fitViewOptions:ot,minZoom:Ce,maxZoom:we,nodeOrigin:ve,nodeExtent:De,zIndexMode:Mt,children:[(0,B.jsx)(Ose,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe,elevateNodesOnSelect:dt,elevateEdgesOnSelect:ft,minZoom:Ce,maxZoom:we,nodeExtent:De,onNodesChange:et,onEdgesChange:tt,snapToGrid:ue,snapGrid:de,connectionMode:I,translateExtent:Te,connectOnClick:st,defaultEdgeOptions:ut,fitView:at,fitViewOptions:ot,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:it,nodeOrigin:ve,rfId:Ft,autoPanOnConnect:mt,autoPanOnNodeDrag:ht,autoPanSpeed:gt,onError:yt,connectionRadius:_t,isValidConnection:vt,selectNodesOnDrag:pe,nodeDragThreshold:St,connectionDragThreshold:Ct,onBeforeDelete:F,debug:kt,ariaLabelConfig:jt,zIndexMode:Mt}),(0,B.jsx)(Wce,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:ie,selectionOnDrag:ae,selectionMode:oe,deleteKeyCode:R,multiSelectionKeyCode:ce,panActivationKeyCode:se,zoomActivationKeyCode:le,onlyRenderVisibleElements:fe,defaultViewport:Se,translateExtent:Te,minZoom:Ce,maxZoom:we,preventScrolling:Ee,zoomOnScroll:ke,zoomOnPinch:Ae,zoomOnDoubleClick:Pe,panOnScroll:je,panOnScrollSpeed:Me,panOnScrollMode:Ne,panOnDrag:Fe,onPaneClick:Ie,onPaneMouseEnter:Le,onPaneMouseMove:Re,onPaneMouseLeave:ze,onPaneScroll:Be,onPaneContextMenu:Ve,paneClickDistance:He,nodeClickDistance:Ue,onSelectionContextMenu:N,onSelectionStart:ee,onSelectionEnd:P,onReconnect:Ge,onReconnectStart:Ke,onReconnectEnd:qe,onEdgeContextMenu:Je,onEdgeDoubleClick:Ye,onEdgeMouseEnter:Xe,onEdgeMouseMove:Ze,onEdgeMouseLeave:Qe,reconnectRadius:$e,defaultMarkerColor:Oe,noDragClassName:nt,noWheelClassName:rt,noPanClassName:it,rfId:Ft,disableKeyboardA11y:pt,nodeExtent:De,viewport:wt,onViewportChange:Tt}),(0,B.jsx)(Tse,{onSelectionChange:k}),We,(0,B.jsx)(bse,{proOptions:lt,position:ct}),(0,B.jsx)(yse,{rfId:Ft,disableKeyboardA11y:pt})]})})}var Xce=$7(Yce);function Zce(e){let[t,n]=(0,z.useState)(e);return[t,n,(0,z.useCallback)(e=>n(t=>K7(e,t)),[])]}function Qce(e){let[t,n]=(0,z.useState)(e);return[t,n,(0,z.useCallback)(e=>n(t=>q7(e,t)),[])]}F8.error014();function $ce({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,B.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:U4([`react-flow__background-pattern`,n,r])})}function ele({radius:e,className:t}){return(0,B.jsx)(`circle`,{cx:e,cy:e,r:e,className:U4([`react-flow__background-pattern`,`dots`,t])})}var W9;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(W9||={});var tle={[W9.Dots]:1,[W9.Lines]:1,[W9.Cross]:6},nle=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function G9({id:e,variant:t=W9.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,z.useRef)(null),{transform:f,patternId:p}=k7(nle,T7),m=r||tle[t],h=t===W9.Dots,g=t===W9.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,B.jsxs)(`svg`,{className:U4([`react-flow__background`,l]),style:{...c,...i9,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,B.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,B.jsx)(ele,{radius:y/2,className:u}):(0,B.jsx)($ce,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,B.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}G9.displayName=`Background`;var rle=(0,z.memo)(G9);function ile(){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,B.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function ale(){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,B.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function ole(){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,B.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function sle(){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,B.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function cle(){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,B.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function K9({children:e,className:t,...n}){return(0,B.jsx)(`button`,{type:`button`,className:U4([`react-flow__controls-button`,t]),...n,children:e})}var lle=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function q9({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=A7(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=k7(lle,T7),{zoomIn:y,zoomOut:b,fitView:x}=n9();return(0,B.jsxs)(P7,{className:U4([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(K9,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,B.jsx)(ile,{})}),(0,B.jsx)(K9,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,B.jsx)(ale,{})})]}),n&&(0,B.jsx)(K9,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,B.jsx)(ole,{})}),r&&(0,B.jsx)(K9,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,B.jsx)(cle,{}):(0,B.jsx)(sle,{})}),u]})}q9.displayName=`Controls`;var ule=(0,z.memo)(q9);function dle({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,B.jsx)(`rect`,{className:U4([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var fle=(0,z.memo)(dle),ple=e=>e.nodes.map(e=>e.id),J9=e=>e instanceof Function?e:()=>e;function mle({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=fle,onClick:o}){let s=k7(ple,T7),c=J9(t),l=J9(e),u=J9(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,B.jsx)(B.Fragment,{children:s.map(e=>(0,B.jsx)(gle,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function hle({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=k7(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=b5(r);return{node:r,x:i,y:a,width:o,height:s}},T7);return!l||l.hidden||!x5(l)?null:(0,B.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var gle=(0,z.memo)(hle),_le=(0,z.memo)(mle),vle=200,yle=150,ble=e=>!e.hidden,xle=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?l5(X8(e.nodeLookup,{filter:ble}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Sle=`react-flow__minimap-desc`;function Y9({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=A7(),S=(0,z.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=k7(xle,T7),j=e?.width??vle,M=e?.height??yle,N=C.width/j,ee=C.height/M,P=Math.max(N,ee),F=P*j,I=P*M,L=b*P,te=C.x-(F-C.width)/2-L,ne=C.y-(I-C.height)/2-L,re=F+L*2,R=I+L*2,ie=`${Sle}-${T}`,ae=(0,z.useRef)(0),oe=(0,z.useRef)();ae.current=P,(0,z.useEffect)(()=>{if(S.current&&E)return oe.current=Joe({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{oe.current?.destroy()}},[E]),(0,z.useEffect)(()=>{oe.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let se=p?e=>{let[t,n]=oe.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ce=m?(0,z.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,le=_??A[`minimap.ariaLabel`];return(0,B.jsx)(P7,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*P:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:U4([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,B.jsxs)(`svg`,{width:j,height:M,viewBox:`${te} ${ne} ${re} ${R}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ie,ref:S,onClick:se,children:[le&&(0,B.jsx)(`title`,{id:ie,children:le}),(0,B.jsx)(_le,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,B.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-L},${ne-L}h${re+L*2}v${R+L*2}h${-re-L*2}z
|
|
73
|
-
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Y9.displayName=`MiniMap`;var Cle=(0,z.memo)(Y9),wle=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Tle={[h7.Line]:`right`,[h7.Handle]:`bottom-right`};function Ele({nodeId:e,position:t,variant:n=h7.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=u9(),y=typeof e==`string`?e:v,b=A7(),x=(0,z.useRef)(null),S=n===h7.Handle,C=k7((0,z.useCallback)(wle(S&&p),[S,p]),T7),w=(0,z.useRef)(null),T=t??Tle[n];return(0,z.useEffect)(()=>{if(!(!x.current||!y))return w.current||=cse({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Q5([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...S5({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,B.jsx)(`div`,{className:U4([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,z.memo)(Ele);var X9={requirement:`#3b82f6`,decision:`#8b5cf6`,code_change:`#10b981`,outcome:`#f59e0b`};function Dle({nodes:e,edges:t,onNodeClick:n}){let r=(0,z.useMemo)(()=>e.map((e,t)=>({id:e.id,type:`default`,data:{label:(0,B.jsxs)(`div`,{className:`text-xs`,children:[(0,B.jsx)(`div`,{className:`font-semibold truncate max-w-[120px]`,children:e.title}),(0,B.jsx)(`div`,{className:`text-gray-500 text-[10px]`,children:e.node_type})]})},position:{x:t%5*200+Math.sin(t)*30,y:Math.floor(t/5)*150+Math.cos(t)*20},style:{background:X9[e.node_type]||`#6b7280`,color:`#fff`,border:`none`,borderRadius:`8px`,padding:`8px 12px`,minWidth:`140px`}})),[e]),i=(0,z.useMemo)(()=>t.map(e=>({id:e.id,source:e.from_node_id,target:e.to_node_id,label:e.edge_type,labelStyle:{fontSize:10,fill:`#6b7280`},style:{stroke:`#d1d5db`,strokeWidth:Math.max(1,e.weight)},markerEnd:{type:W8.ArrowClosed,color:`#d1d5db`}})),[t]),[a,,o]=Zce(r),[s,,c]=Qce(i),l=(0,z.useCallback)((e,t)=>{n?.(t.id)},[n]);return e.length===0?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full text-gray-400 text-sm`,children:`暂无知识节点`}):(0,B.jsxs)(Xce,{nodes:a,edges:s,onNodesChange:o,onEdgesChange:c,onNodeClick:l,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[(0,B.jsx)(rle,{color:`#f3f4f6`,gap:20}),(0,B.jsx)(ule,{}),(0,B.jsx)(Cle,{nodeColor:t=>X9[e.find(e=>e.id===t.id)?.node_type||``]||`#6b7280`,style:{background:`#f9fafb`}})]})}var Z9={requirement:Qs,decision:ac,code_change:Us,outcome:zs},Q9={requirement:`#3b82f6`,decision:`#8b5cf6`,code_change:`#10b981`,outcome:`#f59e0b`},$9=[`#3b82f6`,`#8b5cf6`,`#10b981`,`#f59e0b`,`#ef4444`,`#06b6d4`];function Ole(){let e=qe(),[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(1),[l,u]=(0,z.useState)(20),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(`list`),[x,S]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:C}=ct({queryKey:[`knowledge-overview`],queryFn:()=>el().then(e=>e.data)}),{data:w}=ct({queryKey:[`knowledge-search`,t],queryFn:()=>$c(t).then(e=>e.data),enabled:t.length>0}),{data:T}=ct({queryKey:[`knowledge-all`],queryFn:()=>$c(``).then(e=>e.data)}),{data:E}=ct({queryKey:[`knowledge-neighbors`,a],queryFn:()=>tl(a).then(e=>e.data),enabled:!!a}),{data:D}=ct({queryKey:[`knowledge-graph`,_],queryFn:()=>nl(_||void 0).then(e=>e.data),enabled:y===`graph`}),O=lt({mutationFn:rl,onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),f(!1)}}),k=lt({mutationFn:({id:e,data:t})=>il(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),m(!1),g(null)}}),A=lt({mutationFn:al,onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),o(null)}}),j=(t?w?.items:T?.items)?.filter(e=>(!r||e.node_type===r)&&(!_||e.project_path===_)),M=Array.from(new Set(T?.items.map(e=>e.node_type)||[])),N=Array.from(new Set(T?.items.map(e=>e.project_path||``).filter(Boolean)||[])),ee=C?.byType?Object.entries(C.byType).map(([e,t])=>({name:e,value:t})):[],P=Math.ceil((j?.length||0)/l),F=j?.slice((s-1)*l,s*l),I=e=>{e.preventDefault();let t=new FormData(e.currentTarget);O.mutate({title:t.get(`title`),content:t.get(`content`),node_type:t.get(`node_type`),project_path:t.get(`project_path`),tags:t.get(`tags`)})},L=e=>{if(e.preventDefault(),!h)return;let t=new FormData(e.currentTarget);k.mutate({id:h.id,data:{title:t.get(`title`),content:t.get(`content`),tags:t.get(`tags`)}})},te=e=>{S({open:!0,title:`删除知识节点`,description:`确认删除此知识节点?关联的边也会被删除。`,onConfirm:()=>{A.mutate(e),S(e=>({...e,open:!1}))}})};return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索知识节点(需求、决策、代码变更、结果)...`,value:t,onChange:e=>{n(e.target.value),c(1)},className:`w-full pl-10 pr-4 py-3 border border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 text-lg`})]}),(0,B.jsxs)(`select`,{value:r,onChange:e=>{i(e.target.value),c(1)},className:`px-3 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,B.jsx)(`option`,{value:``,children:`全部类型`}),M.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`select`,{value:_,onChange:e=>{v(e.target.value),c(1)},className:`px-3 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,B.jsx)(`option`,{value:``,children:`全部项目`}),N.map(e=>(0,B.jsx)(`option`,{value:e,children:e.split(`/`).pop()},e))]}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:fc,onClick:()=>f(!0),children:`创建节点`}),(0,B.jsxs)(`div`,{className:`flex border border-gray-200 rounded-lg overflow-hidden`,children:[(0,B.jsx)(`button`,{onClick:()=>b(`list`),className:`px-3 py-2 text-sm transition-colors ${y===`list`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`}`,children:`列表`}),(0,B.jsxs)(`button`,{onClick:()=>b(`graph`),className:`px-3 py-2 text-sm transition-colors flex items-center gap-1 ${y===`graph`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`}`,children:[(0,B.jsx)(cc,{className:`h-4 w-4`}),`图谱`]})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,B.jsx)(Y,{title:`知识图谱概览`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 mb-4`,children:[(0,B.jsxs)(`div`,{className:`text-center p-4 bg-blue-50 rounded-xl`,children:[(0,B.jsx)(js,{className:`h-8 w-8 text-blue-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:C?.totalNodes||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`知识节点`})]}),(0,B.jsxs)(`div`,{className:`text-center p-4 bg-purple-50 rounded-xl`,children:[(0,B.jsx)(tc,{className:`h-8 w-8 text-purple-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-3xl font-bold text-purple-600`,children:ee.length}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`节点类型`})]})]})}),(0,B.jsx)(Y,{title:`节点类型分布`,children:ee.length>0?(0,B.jsx)(RO,{width:`100%`,height:200,children:(0,B.jsxs)(z0,{children:[(0,B.jsx)(pJ,{data:ee,cx:`50%`,cy:`50%`,innerRadius:50,outerRadius:80,dataKey:`value`,label:({name:e,percent:t})=>`${e} ${(t*100).toFixed(0)}%`,children:ee.map((e,t)=>(0,B.jsx)(gW,{fill:$9[t%$9.length]},t))}),(0,B.jsx)(hW,{})]})}):(0,B.jsx)(`div`,{className:`flex items-center justify-center h-48 text-gray-400`,children:`暂无数据`})})]}),y===`graph`&&(0,B.jsx)(Y,{title:`知识图谱`,children:(0,B.jsx)(`div`,{className:`h-[600px] border border-gray-200 rounded-lg overflow-hidden`,children:D?(0,B.jsx)(Dle,{nodes:D.nodes,edges:D.edges,onNodeClick:o}):(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})})})}),y===`list`&&(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-6`,children:[(0,B.jsx)(`div`,{className:`lg:col-span-2`,children:(0,B.jsxs)(Y,{title:`知识节点 (${j?.length||0})`,action:j&&j.length>0?(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:()=>{if(!j||j.length===0)return;let e=[`ID`,`标题`,`类型`,`内容`,`标签`,`项目路径`],t=j.map(e=>[e.id,e.title,e.node_type,e.content,e.tags||``,e.project_path||``]);n4(`knowledge-nodes-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出 CSV`}):void 0,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[F?.map((e,t)=>{let n=Z9[e.node_type]||js,r=Q9[e.node_type]||`#6b7280`;return(0,B.jsx)(zb.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.03},className:`p-4 rounded-lg border cursor-pointer transition-all group ${a===e.id?`border-blue-300 bg-blue-50 shadow-sm`:`border-gray-100 hover:border-gray-200 hover:bg-gray-50`}`,onClick:()=>o(e.id),children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`p-2 rounded-lg`,style:{backgroundColor:`${r}15`},children:(0,B.jsx)(n,{className:`h-5 w-5`,style:{color:r}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`font-semibold text-gray-900 truncate`,children:e.title}),(0,B.jsx)(Vb,{size:`sm`,variant:e.node_type===`outcome`?`success`:e.node_type===`decision`?`info`:`default`,children:e.node_type})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mt-1 line-clamp-2`,children:e.content}),e.tags&&e.tags.trim()&&(0,B.jsx)(`div`,{className:`flex gap-1 mt-2`,children:e.tags.split(`,`).filter(e=>e.trim()).slice(0,3).map(e=>(0,B.jsx)(`span`,{className:`text-xs px-2 py-0.5 bg-gray-100 rounded-full text-gray-600`,children:e.trim()},e))})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),g({id:e.id,title:e.title,content:e.content,tags:e.tags||``}),m(!0)},className:`p-1.5 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600`,children:(0,B.jsx)(bc,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),te(e.id)},className:`p-1.5 rounded hover:bg-red-100 text-gray-400 hover:text-red-600`,children:(0,B.jsx)(Cc,{className:`h-3.5 w-3.5`})})]})]})},e.id)}),(!F||F.length===0)&&(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,B.jsx)(js,{className:`h-12 w-12 mb-4`}),(0,B.jsx)(`p`,{children:`暂无知识节点`}),(0,B.jsx)(`p`,{className:`text-sm mt-1`,children:`使用 Claude Code 进行开发后,知识会自动沉淀`})]})]}),j&&j.length>0&&(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsx)(t4,{currentPage:s,totalPages:P,onPageChange:c,pageSize:l,onPageSizeChange:e=>{u(e),c(1)},totalItems:j.length})})]})}),(0,B.jsx)(`div`,{children:(0,B.jsx)(Y,{title:`节点详情`,children:a&&j?(()=>{let e=j.find(e=>e.id===a);if(!e)return(0,B.jsx)(`div`,{className:`text-gray-400 text-center py-8`,children:`节点未找到`});let t=Z9[e.node_type]||js,n=Q9[e.node_type]||`#6b7280`;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`p-3 rounded-xl`,style:{backgroundColor:`${n}15`},children:(0,B.jsx)(t,{className:`h-6 w-6`,style:{color:n}})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-bold text-gray-900`,children:e.title}),(0,B.jsx)(Vb,{size:`sm`,children:e.node_type})]})]}),(0,B.jsx)(`div`,{className:`p-3 bg-gray-50 rounded-lg text-sm text-gray-700 whitespace-pre-wrap`,children:e.content}),e.tags&&e.tags.trim()&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-xs font-semibold text-gray-500 mb-2`,children:`标签`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tags.split(`,`).filter(e=>e.trim()).map(e=>(0,B.jsx)(`span`,{className:`text-xs px-2 py-1 bg-blue-50 text-blue-600 rounded-full`,children:e.trim()},e))})]}),E&&E.items.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-xs font-semibold text-gray-500 mb-2`,children:[`关联节点 (`,E.total,`)`]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:E.items.map((e,t)=>(0,B.jsxs)(`div`,{className:`p-2 bg-gray-50 rounded-lg text-sm cursor-pointer hover:bg-gray-100`,onClick:()=>o(e.id),children:[(0,B.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,B.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[e.edge_type,` · `,e.node_type]})]},t))})]})]})})():(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,B.jsx)(_c,{className:`h-8 w-8 mb-3`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`点击左侧节点查看详情`})]})})})]}),d&&(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:()=>f(!1),children:(0,B.jsxs)(`div`,{className:`bg-white rounded-xl p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`h3`,{className:`text-xl font-bold mb-4`,children:`创建知识节点`}),(0,B.jsxs)(`form`,{onSubmit:I,className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标题 *`}),(0,B.jsx)(`input`,{type:`text`,name:`title`,required:!0,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`内容 *`}),(0,B.jsx)(`textarea`,{name:`content`,required:!0,rows:6,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`类型 *`}),(0,B.jsxs)(`select`,{name:`node_type`,required:!0,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,B.jsx)(`option`,{value:`requirement`,children:`需求 (requirement)`}),(0,B.jsx)(`option`,{value:`decision`,children:`决策 (decision)`}),(0,B.jsx)(`option`,{value:`code_change`,children:`代码变更 (code_change)`}),(0,B.jsx)(`option`,{value:`outcome`,children:`结果 (outcome)`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`项目路径 *`}),(0,B.jsx)(`input`,{type:`text`,name:`project_path`,required:!0,placeholder:`/path/to/project`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标签(逗号分隔)`}),(0,B.jsx)(`input`,{type:`text`,name:`tags`,placeholder:`tag1, tag2, tag3`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end pt-2`,children:[(0,B.jsx)(J,{type:`button`,variant:`secondary`,onClick:()=>f(!1),children:`取消`}),(0,B.jsx)(J,{type:`submit`,variant:`primary`,loading:O.isPending,children:`创建`})]})]})]})}),p&&h&&(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:()=>m(!1),children:(0,B.jsxs)(`div`,{className:`bg-white rounded-xl p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`h3`,{className:`text-xl font-bold mb-4`,children:`编辑知识节点`}),(0,B.jsxs)(`form`,{onSubmit:L,className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标题`}),(0,B.jsx)(`input`,{type:`text`,name:`title`,defaultValue:h.title,required:!0,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`内容`}),(0,B.jsx)(`textarea`,{name:`content`,defaultValue:h.content,required:!0,rows:6,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标签(逗号分隔)`}),(0,B.jsx)(`input`,{type:`text`,name:`tags`,defaultValue:h.tags,placeholder:`tag1, tag2, tag3`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end pt-2`,children:[(0,B.jsx)(J,{type:`button`,variant:`secondary`,onClick:()=>m(!1),children:`取消`}),(0,B.jsx)(J,{type:`submit`,variant:`primary`,loading:k.isPending,children:`保存`})]})]})]})}),(0,B.jsx)(Q2,{open:x.open,title:x.title,description:x.description,variant:`danger`,onConfirm:x.onConfirm,onCancel:()=>S({...x,open:!1})})]})}function kle(){let e=Pn(),t=qe(),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(1),[o,s]=(0,z.useState)(12),[c,l]=(0,z.useState)(`lastActivity`),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(``),[v,y]=(0,z.useState)(``),{data:b}=ct({queryKey:[`project-meta-all`],queryFn:()=>W.get(`/api/projects/meta/all`).then(e=>e.data),staleTime:3e4}),x=b||{},S=lt({mutationFn:({projectPath:e,meta:t})=>W.put(`/api/projects/${encodeURIComponent(e)}/meta`,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`project-meta-all`]})}}),C=(e,t)=>{t.stopPropagation();let n=x[e]||{notes:``,tags:[],archived:!1};_(n.notes),y(n.tags.join(`, `)),h(e)},w=()=>{if(!m)return;let e=x[m]||{notes:``,tags:[],archived:!1};S.mutate({projectPath:m,meta:{notes:g.trim(),tags:v.split(`,`).map(e=>e.trim()).filter(Boolean),archived:e.archived}}),h(null)},T=(e,t)=>{t.stopPropagation();let n=x[e]||{notes:``,tags:[],archived:!1};S.mutate({projectPath:e,meta:{...n,archived:!n.archived}})},{data:E,isLoading:D}=ct({queryKey:[`projects`],queryFn:()=>fl({limit:1e3}).then(e=>e.data),refetchInterval:3e4});if(D)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let O=E?.items||[],k=e=>{c===e?d(e=>!e):(l(e),d(!1)),a(1)},A=O.filter(e=>{if(x[e.projectPath]?.archived&&!f)return!1;if(!n)return!0;let t=n.toLowerCase();return e.projectName.toLowerCase().includes(t)||e.projectPath.toLowerCase().includes(t)}).sort((e,t)=>{let n=0;return c===`name`?n=e.projectName.localeCompare(t.projectName):c===`lastActivity`?n=(e.lastActivity||``).localeCompare(t.lastActivity||``):c===`sessionCount`?n=e.sessionCount-t.sessionCount:c===`totalEvents`&&(n=e.totalEvents-t.totalEvents),u?n:-n}),j=Math.ceil(A.length/o),M=A.slice((i-1)*o,i*o);return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900`,children:`项目管理`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:`查看所有被 Forge 管理的项目`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(Vb,{variant:`info`,children:[A.length,` 个项目`]}),(0,B.jsxs)(`button`,{onClick:()=>p(!f),className:ud(`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg transition-colors`,f?`bg-blue-50 text-blue-600`:`text-gray-600 hover:bg-gray-50`),children:[(0,B.jsx)(Es,{className:`h-4 w-4`}),f?`隐藏归档`:`显示归档`]}),(0,B.jsxs)(`button`,{onClick:()=>{let e=[`项目名称`,`项目路径`,`会话数`,`Pipeline 数`,`质量问题数`,`总事件数`,`最近活动`],t=A.map(e=>[e.projectName,e.projectPath,e.sessionCount,e.pipelineCount,e.qualityIssueCount,e.totalEvents,e.lastActivity||``]);n4(`projects-${new Date().toISOString().slice(0,10)}.csv`,e,t)},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm text-gray-600 hover:bg-gray-50 rounded-lg transition-colors`,children:[(0,B.jsx)(qs,{className:`h-4 w-4`}),`导出 CSV`]})]})]}),(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索项目名称或路径...`,value:n,onChange:e=>{r(e.target.value),a(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,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`排序:`}),[{key:`name`,label:`名称`},{key:`lastActivity`,label:`活动时间`},{key:`sessionCount`,label:`会话数`},{key:`totalEvents`,label:`事件数`}].map(({key:e,label:t})=>(0,B.jsxs)(`button`,{onClick:()=>k(e),className:ud(`px-3 py-1.5 rounded-lg transition-colors flex items-center gap-1`,c===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:[t,c===e&&(0,B.jsx)(ks,{className:ud(`h-3 w-3`,u&&`rotate-180`)})]},e))]})]})}),(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:M.map((t,n)=>{let r=t.projectPath,i=x[r]||{notes:``,tags:[],archived:!1};return(0,B.jsx)(zb.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.03},children:(0,B.jsx)(Y,{className:ud(`!p-0 overflow-hidden cursor-pointer hover:shadow-md transition-shadow h-full flex flex-col`,i.archived&&`opacity-60`),onClick:()=>e(`/projects/${encodeURIComponent(r)}`),children:(0,B.jsxs)(`div`,{className:`p-4 flex-1 flex flex-col`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3 mb-3`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-blue-50 flex-shrink-0`,children:(0,B.jsx)($s,{className:`h-5 w-5 text-blue-600`})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900 truncate`,children:t.projectName}),i.archived&&(0,B.jsx)(Es,{className:`h-3.5 w-3.5 text-gray-400 flex-shrink-0`})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 truncate`,children:r}),i.tags.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:i.tags.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 bg-blue-50 text-blue-600 text-xs rounded`,children:[(0,B.jsx)(xc,{className:`h-2.5 w-2.5`}),e]},e))}),i.notes&&(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1 truncate`,children:i.notes})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[(0,B.jsx)(`button`,{onClick:e=>T(r,e),className:`p-1 text-gray-400 hover:text-gray-600 rounded`,title:i.archived?`取消归档`:`归档`,children:(0,B.jsx)(Es,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:e=>C(r,e),className:`p-1 text-gray-400 hover:text-gray-600 rounded`,title:`项目设置`,children:(0,B.jsx)(vc,{className:`h-3.5 w-3.5`})})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-600`,children:[(0,B.jsx)(Ts,{className:`h-4 w-4 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[t.sessionCount,` 会话`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-600`,children:[(0,B.jsx)(tc,{className:`h-4 w-4 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[t.pipelineCount,` Pipeline`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-600`,children:[(0,B.jsx)(yc,{className:`h-4 w-4 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[t.qualityIssueCount,` 质量`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-600`,children:[(0,B.jsx)(js,{className:`h-4 w-4 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[t.totalEvents,` 事件`]})]})]}),t.lastActivity&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-gray-400 mt-3 pt-3 border-t border-gray-100`,children:[(0,B.jsx)(Hs,{className:`h-3 w-3 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[`最近活动:`,Y2(md(t.lastActivity),`MM-dd HH:mm`)]})]})]})})},r)})}),A.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)($s,{className:`h-12 w-12 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无项目`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-400 mt-1`,children:`在任意目录使用 Claude Code 后,项目将自动出现在这里`})]}),A.length>0&&(0,B.jsx)(t4,{currentPage:i,totalPages:j,onPageChange:a,pageSize:o,onPageSizeChange:e=>{s(e),a(1)},totalItems:A.length}),m&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,onClick:()=>h(null),children:(0,B.jsxs)(`div`,{className:`bg-white rounded-xl shadow-xl w-full max-w-md p-6`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:`项目设置`}),(0,B.jsx)(`button`,{onClick:()=>h(null),className:`text-gray-400 hover:text-gray-600`,children:(0,B.jsx)(kc,{className:`h-5 w-5`})})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mb-4 truncate`,children:m}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标签(逗号分隔)`}),(0,B.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`前端, 工具, 实验...`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`备注`}),(0,B.jsx)(`textarea`,{value:g,onChange:e=>_(e.target.value),rows:3,placeholder:`项目说明、注意事项...`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none`})]})]}),(0,B.jsxs)(`div`,{className:`flex justify-end gap-2 mt-5`,children:[(0,B.jsx)(`button`,{onClick:()=>h(null),className:`px-4 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg`,children:`取消`}),(0,B.jsx)(`button`,{onClick:w,className:`px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700`,children:`保存`})]})]})})]})}function Ale(){let{encodedPath:e}=In(),t=Pn(),n=qe(),[r,i]=(0,z.useState)(`sessions`),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(new Set),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(null),[C,w]=(0,z.useState)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(!1),[k,A]=(0,z.useState)(null),[j,M]=(0,z.useState)(1),[N,ee]=(0,z.useState)(20),{data:P,isLoading:F}=ct({queryKey:[`project`,e],queryFn:()=>pl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e}),{data:I}=ct({queryKey:[`conventions`,e],queryFn:()=>hl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`convention`}),{data:L}=ct({queryKey:[`claudemd`,e],queryFn:()=>bl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`claudemd`}),{data:te}=ct({queryKey:[`claudemd-modules`,e],queryFn:()=>Cl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`claudemd`}),ne=lt({mutationFn:()=>ml(encodeURIComponent(decodeURIComponent(e))),onSuccess:()=>{n.invalidateQueries({queryKey:[`projects`]}),t(`/projects`)}}),re=lt({mutationFn:({id:t,name:n,content:r})=>gl(encodeURIComponent(decodeURIComponent(e)),t,n,r),onSuccess:()=>{n.invalidateQueries({queryKey:[`conventions`,e]}),c(null),u(null)}}),R=lt({mutationFn:t=>_l(encodeURIComponent(decodeURIComponent(e)),t),onSuccess:()=>{n.invalidateQueries({queryKey:[`conventions`,e]})}}),ie=lt({mutationFn:t=>xl(encodeURIComponent(decodeURIComponent(e)),t),onSuccess:()=>{n.invalidateQueries({queryKey:[`claudemd`,e]}),f(!1)}}),ae=lt({mutationFn:()=>wl(encodeURIComponent(decodeURIComponent(e))),onSuccess:t=>{n.invalidateQueries({queryKey:[`claudemd`,e]}),b({success:!0,message:t.data.distilled?`蒸馏完成,压缩 ${t.data.reduction}%(${t.data.before} → ${t.data.after} 字符):${t.data.summary}`:t.data.message??`无需蒸馏`})},onError:e=>{b({success:!1,message:e.message})}}),[oe,se]=(0,z.useState)(null),[ce,le]=(0,z.useState)(null),[ue,de]=(0,z.useState)(!1),[fe,pe]=(0,z.useState)(!1),[me,he]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1),[ve,ye]=(0,z.useState)(null),be=async()=>{de(!0),le(null);try{le((await Sl(encodeURIComponent(decodeURIComponent(e)))).data.profile)}catch(e){le({error:String(e)})}finally{de(!1)}},xe=async()=>{pe(!0),he(null);try{let t=await Tl(encodeURIComponent(decodeURIComponent(e)));he({success:t.data.success,message:t.data.message,claudeMdGenerated:t.data.claudeMdGenerated}),le(t.data.profile),n.invalidateQueries({queryKey:[`claudemd`,e]}),n.invalidateQueries({queryKey:[`project`,e]})}catch(e){he({success:!1,message:String(e)})}finally{pe(!1)}},Se=async()=>{_e(!0),ye(null);try{let t=await yl(encodeURIComponent(decodeURIComponent(e)));ye({success:t.data.success,message:t.data.message}),t.data.skipped||(n.invalidateQueries({queryKey:[`conventions`,e]}),n.invalidateQueries({queryKey:[`claudemd`,e]}))}catch(e){ye({success:!1,message:String(e)})}finally{_e(!1)}},Ce=lt({mutationFn:t=>vl(encodeURIComponent(decodeURIComponent(e)),t),onSuccess:t=>{n.invalidateQueries({queryKey:[`conventions`,e]}),se({evolved:t.data.evolved,message:t.data.message,changes:t.data.changes??t.data.results?.flatMap(e=>e.changes),count:t.data.count})}}),we=async t=>{S(t),w(null),E({step:`init`,message:`连接中...`});try{let r=await fetch(`/api/quality/${t}/auto-fix`,{method:`POST`});if(!r.body)throw Error(`响应无数据流`);let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:t,value:r}=await i.read();if(t)break;o+=a.decode(r,{stream:!0});let s=o.split(`
|
|
73
|
+
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Y9.displayName=`MiniMap`;var Cle=(0,z.memo)(Y9),wle=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Tle={[h7.Line]:`right`,[h7.Handle]:`bottom-right`};function Ele({nodeId:e,position:t,variant:n=h7.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=u9(),y=typeof e==`string`?e:v,b=A7(),x=(0,z.useRef)(null),S=n===h7.Handle,C=k7((0,z.useCallback)(wle(S&&p),[S,p]),T7),w=(0,z.useRef)(null),T=t??Tle[n];return(0,z.useEffect)(()=>{if(!(!x.current||!y))return w.current||=cse({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Q5([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...S5({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,B.jsx)(`div`,{className:U4([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,z.memo)(Ele);var X9={requirement:`#3b82f6`,decision:`#8b5cf6`,code_change:`#10b981`,outcome:`#f59e0b`};function Dle({nodes:e,edges:t,onNodeClick:n}){let r=(0,z.useMemo)(()=>e.map((e,t)=>({id:e.id,type:`default`,data:{label:(0,B.jsxs)(`div`,{className:`text-xs`,children:[(0,B.jsx)(`div`,{className:`font-semibold truncate max-w-[120px]`,children:e.title}),(0,B.jsx)(`div`,{className:`text-gray-500 text-[10px]`,children:e.node_type})]})},position:{x:t%5*200+Math.sin(t)*30,y:Math.floor(t/5)*150+Math.cos(t)*20},style:{background:X9[e.node_type]||`#6b7280`,color:`#fff`,border:`none`,borderRadius:`8px`,padding:`8px 12px`,minWidth:`140px`}})),[e]),i=(0,z.useMemo)(()=>t.map(e=>({id:e.id,source:e.from_node_id,target:e.to_node_id,label:e.edge_type,labelStyle:{fontSize:10,fill:`#6b7280`},style:{stroke:`#d1d5db`,strokeWidth:Math.max(1,e.weight)},markerEnd:{type:W8.ArrowClosed,color:`#d1d5db`}})),[t]),[a,,o]=Zce(r),[s,,c]=Qce(i),l=(0,z.useCallback)((e,t)=>{n?.(t.id)},[n]);return e.length===0?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full text-gray-400 text-sm`,children:`暂无知识节点`}):(0,B.jsxs)(Xce,{nodes:a,edges:s,onNodesChange:o,onEdgesChange:c,onNodeClick:l,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[(0,B.jsx)(rle,{color:`#f3f4f6`,gap:20}),(0,B.jsx)(ule,{}),(0,B.jsx)(Cle,{nodeColor:t=>X9[e.find(e=>e.id===t.id)?.node_type||``]||`#6b7280`,style:{background:`#f9fafb`}})]})}var Z9={requirement:Qs,decision:ac,code_change:Us,outcome:zs},Q9={requirement:`#3b82f6`,decision:`#8b5cf6`,code_change:`#10b981`,outcome:`#f59e0b`},$9=[`#3b82f6`,`#8b5cf6`,`#10b981`,`#f59e0b`,`#ef4444`,`#06b6d4`];function Ole(){let e=qe(),[t,n]=(0,z.useState)(``),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(1),[l,u]=(0,z.useState)(20),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(`list`),[x,S]=(0,z.useState)({open:!1,title:``,description:``,onConfirm:()=>{}}),{data:C}=ct({queryKey:[`knowledge-overview`],queryFn:()=>el().then(e=>e.data)}),{data:w}=ct({queryKey:[`knowledge-search`,t],queryFn:()=>$c(t).then(e=>e.data),enabled:t.length>0}),{data:T}=ct({queryKey:[`knowledge-all`],queryFn:()=>$c(``).then(e=>e.data)}),{data:E}=ct({queryKey:[`knowledge-neighbors`,a],queryFn:()=>tl(a).then(e=>e.data),enabled:!!a}),{data:D}=ct({queryKey:[`knowledge-graph`,_],queryFn:()=>nl(_||void 0).then(e=>e.data),enabled:y===`graph`}),O=lt({mutationFn:rl,onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),f(!1)}}),k=lt({mutationFn:({id:e,data:t})=>il(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),m(!1),g(null)}}),A=lt({mutationFn:al,onSuccess:()=>{e.invalidateQueries({queryKey:[`knowledge-all`]}),e.invalidateQueries({queryKey:[`knowledge-overview`]}),o(null)}}),j=(t?w?.items:T?.items)?.filter(e=>(!r||e.node_type===r)&&(!_||e.project_path===_)),M=Array.from(new Set(T?.items.map(e=>e.node_type)||[])),N=Array.from(new Set(T?.items.map(e=>e.project_path||``).filter(Boolean)||[])),ee=C?.byType?Object.entries(C.byType).map(([e,t])=>({name:e,value:t})):[],P=Math.ceil((j?.length||0)/l),F=j?.slice((s-1)*l,s*l),I=e=>{e.preventDefault();let t=new FormData(e.currentTarget);O.mutate({title:t.get(`title`),content:t.get(`content`),node_type:t.get(`node_type`),project_path:t.get(`project_path`),tags:t.get(`tags`)})},L=e=>{if(e.preventDefault(),!h)return;let t=new FormData(e.currentTarget);k.mutate({id:h.id,data:{title:t.get(`title`),content:t.get(`content`),tags:t.get(`tags`)}})},te=e=>{S({open:!0,title:`删除知识节点`,description:`确认删除此知识节点?关联的边也会被删除。`,onConfirm:()=>{A.mutate(e),S(e=>({...e,open:!1}))}})};return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索知识节点(需求、决策、代码变更、结果)...`,value:t,onChange:e=>{n(e.target.value),c(1)},className:`w-full pl-10 pr-4 py-3 border border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 text-lg`})]}),(0,B.jsxs)(`select`,{value:r,onChange:e=>{i(e.target.value),c(1)},className:`px-3 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,B.jsx)(`option`,{value:``,children:`全部类型`}),M.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsxs)(`select`,{value:_,onChange:e=>{v(e.target.value),c(1)},className:`px-3 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,B.jsx)(`option`,{value:``,children:`全部项目`}),N.map(e=>(0,B.jsx)(`option`,{value:e,children:e.split(`/`).pop()},e))]}),(0,B.jsx)(J,{variant:`primary`,size:`sm`,icon:fc,onClick:()=>f(!0),children:`创建节点`}),(0,B.jsxs)(`div`,{className:`flex border border-gray-200 rounded-lg overflow-hidden`,children:[(0,B.jsx)(`button`,{onClick:()=>b(`list`),className:`px-3 py-2 text-sm transition-colors ${y===`list`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`}`,children:`列表`}),(0,B.jsxs)(`button`,{onClick:()=>b(`graph`),className:`px-3 py-2 text-sm transition-colors flex items-center gap-1 ${y===`graph`?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`}`,children:[(0,B.jsx)(cc,{className:`h-4 w-4`}),`图谱`]})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,B.jsx)(Y,{title:`知识图谱概览`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 mb-4`,children:[(0,B.jsxs)(`div`,{className:`text-center p-4 bg-blue-50 rounded-xl`,children:[(0,B.jsx)(js,{className:`h-8 w-8 text-blue-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-3xl font-bold text-blue-600`,children:C?.totalNodes||0}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`知识节点`})]}),(0,B.jsxs)(`div`,{className:`text-center p-4 bg-purple-50 rounded-xl`,children:[(0,B.jsx)(tc,{className:`h-8 w-8 text-purple-500 mx-auto mb-2`}),(0,B.jsx)(`div`,{className:`text-3xl font-bold text-purple-600`,children:ee.length}),(0,B.jsx)(`div`,{className:`text-sm text-gray-600`,children:`节点类型`})]})]})}),(0,B.jsx)(Y,{title:`节点类型分布`,children:ee.length>0?(0,B.jsx)(RO,{width:`100%`,height:200,children:(0,B.jsxs)(z0,{children:[(0,B.jsx)(pJ,{data:ee,cx:`50%`,cy:`50%`,innerRadius:50,outerRadius:80,dataKey:`value`,label:({name:e,percent:t})=>`${e} ${(t*100).toFixed(0)}%`,children:ee.map((e,t)=>(0,B.jsx)(gW,{fill:$9[t%$9.length]},t))}),(0,B.jsx)(hW,{})]})}):(0,B.jsx)(`div`,{className:`flex items-center justify-center h-48 text-gray-400`,children:`暂无数据`})})]}),y===`graph`&&(0,B.jsx)(Y,{title:`知识图谱`,children:(0,B.jsx)(`div`,{className:`h-[600px] border border-gray-200 rounded-lg overflow-hidden`,children:D?(0,B.jsx)(Dle,{nodes:D.nodes,edges:D.edges,onNodeClick:o}):(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})})})}),y===`list`&&(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-6`,children:[(0,B.jsx)(`div`,{className:`lg:col-span-2`,children:(0,B.jsxs)(Y,{title:`知识节点 (${j?.length||0})`,action:j&&j.length>0?(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:qs,onClick:()=>{if(!j||j.length===0)return;let e=[`ID`,`标题`,`类型`,`内容`,`标签`,`项目路径`],t=j.map(e=>[e.id,e.title,e.node_type,e.content,e.tags||``,e.project_path||``]);n4(`knowledge-nodes-${Y2(new Date,`yyyyMMdd-HHmmss`)}.csv`,e,t)},children:`导出 CSV`}):void 0,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[F?.map((e,t)=>{let n=Z9[e.node_type]||js,r=Q9[e.node_type]||`#6b7280`;return(0,B.jsx)(zb.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:t*.03},className:`p-4 rounded-lg border cursor-pointer transition-all group ${a===e.id?`border-blue-300 bg-blue-50 shadow-sm`:`border-gray-100 hover:border-gray-200 hover:bg-gray-50`}`,onClick:()=>o(e.id),children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`p-2 rounded-lg`,style:{backgroundColor:`${r}15`},children:(0,B.jsx)(n,{className:`h-5 w-5`,style:{color:r}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`font-semibold text-gray-900 truncate`,children:e.title}),(0,B.jsx)(Vb,{size:`sm`,variant:e.node_type===`outcome`?`success`:e.node_type===`decision`?`info`:`default`,children:e.node_type})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mt-1 line-clamp-2`,children:e.content}),e.tags&&e.tags.trim()&&(0,B.jsx)(`div`,{className:`flex gap-1 mt-2`,children:e.tags.split(`,`).filter(e=>e.trim()).slice(0,3).map(e=>(0,B.jsx)(`span`,{className:`text-xs px-2 py-0.5 bg-gray-100 rounded-full text-gray-600`,children:e.trim()},e))})]}),(0,B.jsxs)(`div`,{className:`flex gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),g({id:e.id,title:e.title,content:e.content,tags:e.tags||``}),m(!0)},className:`p-1.5 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600`,children:(0,B.jsx)(bc,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),te(e.id)},className:`p-1.5 rounded hover:bg-red-100 text-gray-400 hover:text-red-600`,children:(0,B.jsx)(Cc,{className:`h-3.5 w-3.5`})})]})]})},e.id)}),(!F||F.length===0)&&(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,B.jsx)(js,{className:`h-12 w-12 mb-4`}),(0,B.jsx)(`p`,{children:`暂无知识节点`}),(0,B.jsx)(`p`,{className:`text-sm mt-1`,children:`使用 Claude Code 进行开发后,知识会自动沉淀`})]})]}),j&&j.length>0&&(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsx)(t4,{currentPage:s,totalPages:P,onPageChange:c,pageSize:l,onPageSizeChange:e=>{u(e),c(1)},totalItems:j.length})})]})}),(0,B.jsx)(`div`,{children:(0,B.jsx)(Y,{title:`节点详情`,children:a&&j?(()=>{let e=j.find(e=>e.id===a);if(!e)return(0,B.jsx)(`div`,{className:`text-gray-400 text-center py-8`,children:`节点未找到`});let t=Z9[e.node_type]||js,n=Q9[e.node_type]||`#6b7280`;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`p-3 rounded-xl`,style:{backgroundColor:`${n}15`},children:(0,B.jsx)(t,{className:`h-6 w-6`,style:{color:n}})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-bold text-gray-900`,children:e.title}),(0,B.jsx)(Vb,{size:`sm`,children:e.node_type})]})]}),(0,B.jsx)(`div`,{className:`p-3 bg-gray-50 rounded-lg text-sm text-gray-700 whitespace-pre-wrap`,children:e.content}),e.tags&&e.tags.trim()&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-xs font-semibold text-gray-500 mb-2`,children:`标签`}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tags.split(`,`).filter(e=>e.trim()).map(e=>(0,B.jsx)(`span`,{className:`text-xs px-2 py-1 bg-blue-50 text-blue-600 rounded-full`,children:e.trim()},e))})]}),E&&E.items.length>0&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-xs font-semibold text-gray-500 mb-2`,children:[`关联节点 (`,E.total,`)`]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:E.items.map((e,t)=>(0,B.jsxs)(`div`,{className:`p-2 bg-gray-50 rounded-lg text-sm cursor-pointer hover:bg-gray-100`,onClick:()=>o(e.id),children:[(0,B.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,B.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[e.edge_type,` · `,e.node_type]})]},t))})]})]})})():(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,B.jsx)(_c,{className:`h-8 w-8 mb-3`}),(0,B.jsx)(`p`,{className:`text-sm`,children:`点击左侧节点查看详情`})]})})})]}),d&&(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:()=>f(!1),children:(0,B.jsxs)(`div`,{className:`bg-white rounded-xl p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`h3`,{className:`text-xl font-bold mb-4`,children:`创建知识节点`}),(0,B.jsxs)(`form`,{onSubmit:I,className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标题 *`}),(0,B.jsx)(`input`,{type:`text`,name:`title`,required:!0,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`内容 *`}),(0,B.jsx)(`textarea`,{name:`content`,required:!0,rows:6,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`类型 *`}),(0,B.jsxs)(`select`,{name:`node_type`,required:!0,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,B.jsx)(`option`,{value:`requirement`,children:`需求 (requirement)`}),(0,B.jsx)(`option`,{value:`decision`,children:`决策 (decision)`}),(0,B.jsx)(`option`,{value:`code_change`,children:`代码变更 (code_change)`}),(0,B.jsx)(`option`,{value:`outcome`,children:`结果 (outcome)`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`项目路径 *`}),(0,B.jsx)(`input`,{type:`text`,name:`project_path`,required:!0,placeholder:`/path/to/project`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标签(逗号分隔)`}),(0,B.jsx)(`input`,{type:`text`,name:`tags`,placeholder:`tag1, tag2, tag3`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end pt-2`,children:[(0,B.jsx)(J,{type:`button`,variant:`secondary`,onClick:()=>f(!1),children:`取消`}),(0,B.jsx)(J,{type:`submit`,variant:`primary`,loading:O.isPending,children:`创建`})]})]})]})}),p&&h&&(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,onClick:()=>m(!1),children:(0,B.jsxs)(`div`,{className:`bg-white rounded-xl p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`h3`,{className:`text-xl font-bold mb-4`,children:`编辑知识节点`}),(0,B.jsxs)(`form`,{onSubmit:L,className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标题`}),(0,B.jsx)(`input`,{type:`text`,name:`title`,defaultValue:h.title,required:!0,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`内容`}),(0,B.jsx)(`textarea`,{name:`content`,defaultValue:h.content,required:!0,rows:6,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标签(逗号分隔)`}),(0,B.jsx)(`input`,{type:`text`,name:`tags`,defaultValue:h.tags,placeholder:`tag1, tag2, tag3`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end pt-2`,children:[(0,B.jsx)(J,{type:`button`,variant:`secondary`,onClick:()=>m(!1),children:`取消`}),(0,B.jsx)(J,{type:`submit`,variant:`primary`,loading:k.isPending,children:`保存`})]})]})]})}),(0,B.jsx)(Q2,{open:x.open,title:x.title,description:x.description,variant:`danger`,onConfirm:x.onConfirm,onCancel:()=>S({...x,open:!1})})]})}function kle(){let e=Pn(),t=qe(),[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(1),[o,s]=(0,z.useState)(12),[c,l]=(0,z.useState)(`lastActivity`),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(``),[v,y]=(0,z.useState)(``),{data:b}=ct({queryKey:[`project-meta-all`],queryFn:()=>W.get(`/projects/meta/all`).then(e=>e.data),staleTime:3e4}),x=b||{},S=lt({mutationFn:({projectPath:e,meta:t})=>W.put(`/projects/${encodeURIComponent(e)}/meta`,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`project-meta-all`]})}}),C=(e,t)=>{t.stopPropagation();let n=x[e]||{notes:``,tags:[],archived:!1};_(n.notes),y(n.tags.join(`, `)),h(e)},w=()=>{if(!m)return;let e=x[m]||{notes:``,tags:[],archived:!1};S.mutate({projectPath:m,meta:{notes:g.trim(),tags:v.split(`,`).map(e=>e.trim()).filter(Boolean),archived:e.archived}}),h(null)},T=(e,t)=>{t.stopPropagation();let n=x[e]||{notes:``,tags:[],archived:!1};S.mutate({projectPath:e,meta:{...n,archived:!n.archived}})},{data:E,isLoading:D}=ct({queryKey:[`projects`],queryFn:()=>fl({limit:1e3}).then(e=>e.data),refetchInterval:3e4});if(D)return(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})});let O=E?.items||[],k=e=>{c===e?d(e=>!e):(l(e),d(!1)),a(1)},A=O.filter(e=>{if(x[e.projectPath]?.archived&&!f)return!1;if(!n)return!0;let t=n.toLowerCase();return e.projectName.toLowerCase().includes(t)||e.projectPath.toLowerCase().includes(t)}).sort((e,t)=>{let n=0;return c===`name`?n=e.projectName.localeCompare(t.projectName):c===`lastActivity`?n=(e.lastActivity||``).localeCompare(t.lastActivity||``):c===`sessionCount`?n=e.sessionCount-t.sessionCount:c===`totalEvents`&&(n=e.totalEvents-t.totalEvents),u?n:-n}),j=Math.ceil(A.length/o),M=A.slice((i-1)*o,i*o);return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900`,children:`项目管理`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:`查看所有被 Forge 管理的项目`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(Vb,{variant:`info`,children:[A.length,` 个项目`]}),(0,B.jsxs)(`button`,{onClick:()=>p(!f),className:ud(`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg transition-colors`,f?`bg-blue-50 text-blue-600`:`text-gray-600 hover:bg-gray-50`),children:[(0,B.jsx)(Es,{className:`h-4 w-4`}),f?`隐藏归档`:`显示归档`]}),(0,B.jsxs)(`button`,{onClick:()=>{let e=[`项目名称`,`项目路径`,`会话数`,`Pipeline 数`,`质量问题数`,`总事件数`,`最近活动`],t=A.map(e=>[e.projectName,e.projectPath,e.sessionCount,e.pipelineCount,e.qualityIssueCount,e.totalEvents,e.lastActivity||``]);n4(`projects-${new Date().toISOString().slice(0,10)}.csv`,e,t)},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm text-gray-600 hover:bg-gray-50 rounded-lg transition-colors`,children:[(0,B.jsx)(qs,{className:`h-4 w-4`}),`导出 CSV`]})]})]}),(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1`,children:[(0,B.jsx)(_c,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`}),(0,B.jsx)(`input`,{type:`text`,placeholder:`搜索项目名称或路径...`,value:n,onChange:e=>{r(e.target.value),a(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,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`排序:`}),[{key:`name`,label:`名称`},{key:`lastActivity`,label:`活动时间`},{key:`sessionCount`,label:`会话数`},{key:`totalEvents`,label:`事件数`}].map(({key:e,label:t})=>(0,B.jsxs)(`button`,{onClick:()=>k(e),className:ud(`px-3 py-1.5 rounded-lg transition-colors flex items-center gap-1`,c===e?`bg-blue-50 text-blue-700 font-medium`:`text-gray-600 hover:bg-gray-50`),children:[t,c===e&&(0,B.jsx)(ks,{className:ud(`h-3 w-3`,u&&`rotate-180`)})]},e))]})]})}),(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:M.map((t,n)=>{let r=t.projectPath,i=x[r]||{notes:``,tags:[],archived:!1};return(0,B.jsx)(zb.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:n*.03},children:(0,B.jsx)(Y,{className:ud(`!p-0 overflow-hidden cursor-pointer hover:shadow-md transition-shadow h-full flex flex-col`,i.archived&&`opacity-60`),onClick:()=>e(`/projects/${encodeURIComponent(r)}`),children:(0,B.jsxs)(`div`,{className:`p-4 flex-1 flex flex-col`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3 mb-3`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-blue-50 flex-shrink-0`,children:(0,B.jsx)($s,{className:`h-5 w-5 text-blue-600`})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900 truncate`,children:t.projectName}),i.archived&&(0,B.jsx)(Es,{className:`h-3.5 w-3.5 text-gray-400 flex-shrink-0`})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 truncate`,children:r}),i.tags.length>0&&(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:i.tags.map(e=>(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 bg-blue-50 text-blue-600 text-xs rounded`,children:[(0,B.jsx)(xc,{className:`h-2.5 w-2.5`}),e]},e))}),i.notes&&(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mt-1 truncate`,children:i.notes})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[(0,B.jsx)(`button`,{onClick:e=>T(r,e),className:`p-1 text-gray-400 hover:text-gray-600 rounded`,title:i.archived?`取消归档`:`归档`,children:(0,B.jsx)(Es,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:e=>C(r,e),className:`p-1 text-gray-400 hover:text-gray-600 rounded`,title:`项目设置`,children:(0,B.jsx)(vc,{className:`h-3.5 w-3.5`})})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-600`,children:[(0,B.jsx)(Ts,{className:`h-4 w-4 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[t.sessionCount,` 会话`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-600`,children:[(0,B.jsx)(tc,{className:`h-4 w-4 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[t.pipelineCount,` Pipeline`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-600`,children:[(0,B.jsx)(yc,{className:`h-4 w-4 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[t.qualityIssueCount,` 质量`]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-gray-600`,children:[(0,B.jsx)(js,{className:`h-4 w-4 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[t.totalEvents,` 事件`]})]})]}),t.lastActivity&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-gray-400 mt-3 pt-3 border-t border-gray-100`,children:[(0,B.jsx)(Hs,{className:`h-3 w-3 flex-shrink-0`}),(0,B.jsxs)(`span`,{children:[`最近活动:`,Y2(md(t.lastActivity),`MM-dd HH:mm`)]})]})]})})},r)})}),A.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12`,children:[(0,B.jsx)($s,{className:`h-12 w-12 text-gray-300 mx-auto mb-3`}),(0,B.jsx)(`p`,{className:`text-gray-500`,children:`暂无项目`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-400 mt-1`,children:`在任意目录使用 Claude Code 后,项目将自动出现在这里`})]}),A.length>0&&(0,B.jsx)(t4,{currentPage:i,totalPages:j,onPageChange:a,pageSize:o,onPageSizeChange:e=>{s(e),a(1)},totalItems:A.length}),m&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,onClick:()=>h(null),children:(0,B.jsxs)(`div`,{className:`bg-white rounded-xl shadow-xl w-full max-w-md p-6`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-gray-900`,children:`项目设置`}),(0,B.jsx)(`button`,{onClick:()=>h(null),className:`text-gray-400 hover:text-gray-600`,children:(0,B.jsx)(kc,{className:`h-5 w-5`})})]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500 mb-4 truncate`,children:m}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`标签(逗号分隔)`}),(0,B.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`前端, 工具, 实验...`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 mb-1`,children:`备注`}),(0,B.jsx)(`textarea`,{value:g,onChange:e=>_(e.target.value),rows:3,placeholder:`项目说明、注意事项...`,className:`w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none`})]})]}),(0,B.jsxs)(`div`,{className:`flex justify-end gap-2 mt-5`,children:[(0,B.jsx)(`button`,{onClick:()=>h(null),className:`px-4 py-2 text-sm text-gray-600 hover:bg-gray-50 rounded-lg`,children:`取消`}),(0,B.jsx)(`button`,{onClick:w,className:`px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700`,children:`保存`})]})]})})]})}function Ale(){let{encodedPath:e}=In(),t=Pn(),n=qe(),[r,i]=(0,z.useState)(`sessions`),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(new Set),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(null),[C,w]=(0,z.useState)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(!1),[k,A]=(0,z.useState)(null),[j,M]=(0,z.useState)(1),[N,ee]=(0,z.useState)(20),{data:P,isLoading:F}=ct({queryKey:[`project`,e],queryFn:()=>pl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e}),{data:I}=ct({queryKey:[`conventions`,e],queryFn:()=>hl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`convention`}),{data:L}=ct({queryKey:[`claudemd`,e],queryFn:()=>bl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`claudemd`}),{data:te}=ct({queryKey:[`claudemd-modules`,e],queryFn:()=>Cl(encodeURIComponent(decodeURIComponent(e))).then(e=>e.data),enabled:!!e&&r===`claudemd`}),ne=lt({mutationFn:()=>ml(encodeURIComponent(decodeURIComponent(e))),onSuccess:()=>{n.invalidateQueries({queryKey:[`projects`]}),t(`/projects`)}}),re=lt({mutationFn:({id:t,name:n,content:r})=>gl(encodeURIComponent(decodeURIComponent(e)),t,n,r),onSuccess:()=>{n.invalidateQueries({queryKey:[`conventions`,e]}),c(null),u(null)}}),R=lt({mutationFn:t=>_l(encodeURIComponent(decodeURIComponent(e)),t),onSuccess:()=>{n.invalidateQueries({queryKey:[`conventions`,e]})}}),ie=lt({mutationFn:t=>xl(encodeURIComponent(decodeURIComponent(e)),t),onSuccess:()=>{n.invalidateQueries({queryKey:[`claudemd`,e]}),f(!1)}}),ae=lt({mutationFn:()=>wl(encodeURIComponent(decodeURIComponent(e))),onSuccess:t=>{n.invalidateQueries({queryKey:[`claudemd`,e]}),b({success:!0,message:t.data.distilled?`蒸馏完成,压缩 ${t.data.reduction}%(${t.data.before} → ${t.data.after} 字符):${t.data.summary}`:t.data.message??`无需蒸馏`})},onError:e=>{b({success:!1,message:e.message})}}),[oe,se]=(0,z.useState)(null),[ce,le]=(0,z.useState)(null),[ue,de]=(0,z.useState)(!1),[fe,pe]=(0,z.useState)(!1),[me,he]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1),[ve,ye]=(0,z.useState)(null),be=async()=>{de(!0),le(null);try{le((await Sl(encodeURIComponent(decodeURIComponent(e)))).data.profile)}catch(e){le({error:String(e)})}finally{de(!1)}},xe=async()=>{pe(!0),he(null);try{let t=await Tl(encodeURIComponent(decodeURIComponent(e)));he({success:t.data.success,message:t.data.message,claudeMdGenerated:t.data.claudeMdGenerated}),le(t.data.profile),n.invalidateQueries({queryKey:[`claudemd`,e]}),n.invalidateQueries({queryKey:[`project`,e]})}catch(e){he({success:!1,message:String(e)})}finally{pe(!1)}},Se=async()=>{_e(!0),ye(null);try{let t=await yl(encodeURIComponent(decodeURIComponent(e)));ye({success:t.data.success,message:t.data.message}),t.data.skipped||(n.invalidateQueries({queryKey:[`conventions`,e]}),n.invalidateQueries({queryKey:[`claudemd`,e]}))}catch(e){ye({success:!1,message:String(e)})}finally{_e(!1)}},Ce=lt({mutationFn:t=>vl(encodeURIComponent(decodeURIComponent(e)),t),onSuccess:t=>{n.invalidateQueries({queryKey:[`conventions`,e]}),se({evolved:t.data.evolved,message:t.data.message,changes:t.data.changes??t.data.results?.flatMap(e=>e.changes),count:t.data.count})}}),we=async t=>{S(t),w(null),E({step:`init`,message:`连接中...`});try{let r=await fetch(`/api/quality/${t}/auto-fix`,{method:`POST`});if(!r.body)throw Error(`响应无数据流`);let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:t,value:r}=await i.read();if(t)break;o+=a.decode(r,{stream:!0});let s=o.split(`
|
|
74
74
|
`);o=s.pop()??``;for(let t of s){if(!t.startsWith(`data: `))continue;let r=t.slice(6).trim();if(r)try{let t=JSON.parse(r);if(t.step===`error`){w({success:!1,message:t.message}),E(null),S(null);return}else if(t.step===`complete`){t.needsFix?w({success:!0,message:`需要修复:${t.reason}`,needsFix:!0,suggestion:t.fixSuggestion}):(w({success:!0,message:`无需修复:${t.reason}`,needsFix:!1}),n.invalidateQueries({queryKey:[`project`,e]})),E(null),S(null);return}else E({step:t.step,message:t.message})}catch(e){console.error(`解析 SSE 消息失败:`,e)}}}}catch(e){w({success:!1,message:String(e)}),E(null),S(null)}};return F||!P?(0,B.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600`})}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(a4,{items:[{label:`项目列表`,path:`/projects`},{label:P.projectName}]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ds,onClick:()=>t(`/projects`),children:`返回`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-blue-50`,children:(0,B.jsx)($s,{className:`h-5 w-5 text-blue-600`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-xl font-bold text-gray-900`,children:P.projectName}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:P.projectPath})]})]})]}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,icon:Cc,onClick:()=>o(!0),children:`删除项目`})]}),a&&(0,B.jsx)(`div`,{className:`fixed inset-0 bg-black/50 flex items-center justify-center z-50`,children:(0,B.jsxs)(Y,{className:`max-w-md`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-bold text-gray-900 mb-2`,children:`确认删除项目`}),(0,B.jsxs)(`p`,{className:`text-sm text-gray-600 mb-4`,children:[`此操作将删除项目 `,(0,B.jsx)(`strong`,{children:P.projectName}),` 的所有数据(会话、Pipeline、事件、质量记录、知识节点等),且无法恢复。`]}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>o(!1),children:`取消`}),(0,B.jsx)(J,{variant:`danger`,size:`sm`,onClick:()=>{ne.mutate(),o(!1)},children:`确认删除`})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-4`,children:[(0,B.jsx)(Y,{className:`!p-4 cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i(`sessions`),children:(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Ts,{className:`h-8 w-8 text-blue-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-2xl font-bold text-gray-900`,children:P.sessions.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`会话`})]})]})}),(0,B.jsx)(Y,{className:`!p-4 cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i(`pipelines`),children:(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(tc,{className:`h-8 w-8 text-green-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-2xl font-bold text-gray-900`,children:P.pipelines.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Pipeline`})]})]})}),(0,B.jsx)(Y,{className:`!p-4 cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i(`api`),children:(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Sc,{className:`h-8 w-8 text-purple-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-2xl font-bold text-gray-900`,children:P.events.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`事件`})]})]})}),(0,B.jsx)(Y,{className:`!p-4 cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i(`quality`),children:(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(yc,{className:`h-8 w-8 text-orange-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-2xl font-bold text-gray-900`,children:P.quality.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`质量`})]})]})}),(0,B.jsx)(Y,{className:`!p-4 cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>i(`knowledge`),children:(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(js,{className:`h-8 w-8 text-pink-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-2xl font-bold text-gray-900`,children:P.knowledge.total}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`知识`})]})]})})]}),(0,B.jsx)(`div`,{className:`flex gap-1 bg-gray-100 p-1 rounded-lg w-fit flex-wrap`,children:[{key:`sessions`,label:`会话`},{key:`pipelines`,label:`Pipeline`},{key:`quality`,label:`质量问题`},{key:`knowledge`,label:`知识文档`},{key:`rules`,label:`规则管理`},{key:`api`,label:`API 用量`},{key:`convention`,label:`自定义规范`},{key:`claudemd`,label:`CLAUDE.md`},{key:`environment`,label:`环境初始化`}].map(e=>(0,B.jsx)(`button`,{onClick:()=>i(e.key),className:`px-4 py-2 rounded-md text-sm font-medium transition-colors ${r===e.key?`bg-white text-gray-900 shadow-sm`:`text-gray-600 hover:text-gray-900`}`,children:e.label},e.key))}),r===`sessions`&&(0,B.jsxs)(Y,{children:[(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`会话 ID`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`首条对话`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`状态`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`开始时间`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:(()=>{let n=P.sessions.items;return Math.ceil(n.length/N),(0,B.jsxs)(B.Fragment,{children:[n.slice((j-1)*N,j*N).map(n=>(0,B.jsxs)(`tr`,{onClick:()=>t(`/sessions/${n.session_id}`,{state:{from:`/projects/${e}`}}),className:`border-t border-gray-50 hover:bg-blue-50 cursor-pointer transition-colors`,children:[(0,B.jsx)(`td`,{className:`py-3 font-mono text-xs`,children:n.session_id.slice(0,12)}),(0,B.jsx)(`td`,{className:`py-3 text-gray-700 max-w-md truncate`,title:n.first_requirement,children:n.first_requirement?n.first_requirement:`(无对话记录)`}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,className:pd(n.status),children:n.status})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:Y2(md(n.start_time),`MM-dd HH:mm`)})]},n.session_id)),n.length===0&&(0,B.jsx)(`tr`,{children:(0,B.jsx)(`td`,{colSpan:4,className:`py-8 text-center text-gray-400`,children:`暂无会话记录`})})]})})()})]})}),(()=>{let e=P.sessions.items,t=Math.ceil(e.length/N);return e.length>N?(0,B.jsx)(`div`,{className:`mt-4`,children:(0,B.jsx)(t4,{currentPage:j,totalPages:t,onPageChange:M,pageSize:N,onPageSizeChange:e=>{ee(e),M(1)},totalItems:e.length})}):null})()]}),r===`pipelines`&&(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`需求`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`阶段`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:P.pipelines.items.map(n=>(0,B.jsxs)(`tr`,{onClick:()=>t(`/pipelines/${n.id}`,{state:{from:`/projects/${e}`}}),className:`border-t border-gray-50 hover:bg-blue-50 cursor-pointer transition-colors`,children:[(0,B.jsx)(`td`,{className:`py-3 max-w-xs truncate`,children:n.requirement}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,children:n.phase})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:Y2(md(n.updated_at),`MM-dd HH:mm`)})]},n.id))})]})})}),r===`quality`&&(0,B.jsxs)(Y,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,B.jsxs)(`p`,{className:`text-sm text-gray-600`,children:[`共 `,P.quality.total,` 个质量问题`]}),P.quality.items.some(e=>!e.resolved)&&(0,B.jsx)(J,{size:`sm`,icon:Ac,onClick:async()=>{O(!0),A(null);try{let t=await fetch(`/api/quality/auto-fix-all`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project_path:P?.projectPath})}),r=await t.json();t.ok?(A({success:!0,message:r.message,total:r.total,fixed:r.fixed,skipped:r.skipped,results:r.results}),n.invalidateQueries({queryKey:[`project`,e]})):A({success:!1,message:r.error||`批量修复失败`})}catch(e){A({success:!1,message:String(e)})}finally{O(!1)}},disabled:D,children:D?`批量修复中...`:`一键修复所有`})]}),(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`问题`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`级别`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`状态`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`时间`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`操作`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:P.quality.items.map(e=>(0,B.jsxs)(`tr`,{className:`border-t border-gray-50 hover:bg-blue-50 transition-colors`,children:[(0,B.jsx)(`td`,{className:`py-3 max-w-xs truncate`,children:e.message}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,variant:e.level===`error`?`danger`:`warning`,children:e.level})}),(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,variant:e.resolved?`success`:`default`,children:e.resolved?`已解决`:`未解决`})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-500`,children:Y2(md(e.created_at),`MM-dd HH:mm`)}),(0,B.jsx)(`td`,{className:`py-3`,children:!e.resolved&&(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),we(e.id)},disabled:x===e.id,className:`px-3 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors disabled:bg-gray-400 disabled:cursor-not-allowed`,children:x===e.id?(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(mc,{className:`h-3 w-3 animate-spin`}),T?.message||`分析中...`]}):`修复`})})]},e.id))})]})}),T&&(0,B.jsx)(`div`,{className:`mt-4 p-4 rounded-lg bg-blue-50 border border-blue-200`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(mc,{className:`h-4 w-4 text-blue-600 animate-spin`}),(0,B.jsx)(`p`,{className:`text-sm text-blue-800 font-medium`,children:T.message})]})}),k&&(0,B.jsxs)(`div`,{className:`mt-4 p-4 rounded-lg ${k.success?`bg-green-50 border border-green-200`:`bg-red-50 border border-red-200`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium ${k.success?`text-green-800`:`text-red-800`}`,children:k.message}),(0,B.jsx)(`button`,{onClick:()=>A(null),className:`text-gray-400 hover:text-gray-600`,children:(0,B.jsx)(kc,{className:`h-4 w-4`})})]}),k.results&&k.results.length>0&&(0,B.jsx)(`div`,{className:`mt-3 space-y-2`,children:k.results.filter(e=>e.needsFix).map(e=>(0,B.jsxs)(`div`,{className:`p-3 bg-white rounded border border-gray-200`,children:[(0,B.jsxs)(`p`,{className:`text-xs font-medium text-gray-700 mb-1`,children:[`问题 #`,e.id]}),(0,B.jsx)(`p`,{className:`text-xs text-gray-600`,children:e.message}),(0,B.jsxs)(`p`,{className:`text-xs text-orange-600 mt-1`,children:[`需要手动处理:`,e.reason]})]},e.id))})]}),C&&(0,B.jsxs)(`div`,{className:`mt-4 p-4 rounded-lg ${C.success?`bg-green-50 border border-green-200`:`bg-red-50 border border-red-200`}`,children:[(0,B.jsx)(`p`,{className:`text-sm ${C.success?`text-green-800`:`text-red-800`}`,children:C.message}),C.needsFix&&C.suggestion&&(0,B.jsxs)(`div`,{className:`mt-2 p-3 bg-white rounded border border-gray-200`,children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-gray-700 mb-1`,children:`修复建议:`}),(0,B.jsx)(`pre`,{className:`text-xs text-gray-600 whitespace-pre-wrap`,children:C.suggestion})]}),(0,B.jsx)(`button`,{onClick:()=>w(null),className:`mt-2 text-xs text-gray-600 hover:text-gray-800`,children:`关闭`})]})]}),r===`knowledge`&&(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`space-y-3`,children:P.knowledge.items.map(e=>(0,B.jsx)(`div`,{className:`p-4 border border-gray-100 rounded-lg hover:bg-blue-50 cursor-pointer transition-colors`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(Qs,{className:`h-5 w-5 text-blue-500 flex-shrink-0 mt-0.5`}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`h4`,{className:`font-medium text-gray-900 mb-1`,children:e.title}),(0,B.jsxs)(`p`,{className:`text-sm text-gray-600 line-clamp-2`,children:[e.content?.substring(0,150),`...`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-gray-400`,children:[(0,B.jsx)(Vb,{size:`sm`,children:e.node_type}),(0,B.jsxs)(`span`,{children:[`更新于 `,Y2(md(e.updated_at),`MM-dd HH:mm`)]})]})]})]})},e.id))})}),r===`rules`&&(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(Y,{title:`意图识别规则`,children:(0,B.jsx)(`div`,{className:`space-y-2`,children:P.rules.intentRules.slice(0,10).map(e=>(0,B.jsx)(`div`,{className:`flex items-center justify-between p-3 border border-gray-100 rounded-lg`,children:(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Vb,{size:`sm`,children:e.rule_type}),(0,B.jsx)(`code`,{className:`text-xs text-gray-600`,children:e.pattern})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs text-gray-400`,children:[(0,B.jsxs)(`span`,{children:[`命中 `,e.hit_count,` 次`]}),(0,B.jsxs)(`span`,{children:[`置信度 `,(e.confidence*100).toFixed(0),`%`]})]})]})},e.id))})}),(0,B.jsx)(Y,{title:`任务模式`,children:(0,B.jsx)(`div`,{className:`space-y-2`,children:P.rules.taskPatterns.slice(0,10).map(e=>(0,B.jsxs)(`div`,{className:`p-3 border border-gray-100 rounded-lg`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsx)(Vb,{size:`sm`,children:e.task_type}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-gray-500`,children:[(0,B.jsx)(wc,{className:`h-3 w-3`}),(0,B.jsxs)(`span`,{children:[`效果 `,(e.effectiveness_score*100).toFixed(0),`%`]})]})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-600 mb-1`,children:e.failure_pattern}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`策略:`,e.prevention_strategy]})]},e.id))})})]}),r===`api`&&(0,B.jsx)(Y,{children:(0,B.jsx)(`div`,{className:`overflow-x-auto`,children:(0,B.jsxs)(`table`,{className:`w-full`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{className:`text-left text-sm text-gray-600`,children:[(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`提供商`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`模型`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`调用次数`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`Prompt Tokens`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`Completion Tokens`}),(0,B.jsx)(`th`,{className:`pb-3 font-medium`,children:`总 Tokens`})]})}),(0,B.jsx)(`tbody`,{className:`text-sm`,children:P.apiUsage.map((e,t)=>(0,B.jsxs)(`tr`,{className:`border-t border-gray-50`,children:[(0,B.jsx)(`td`,{className:`py-3`,children:(0,B.jsx)(Vb,{size:`sm`,children:e.provider})}),(0,B.jsx)(`td`,{className:`py-3 text-gray-600`,children:e.model}),(0,B.jsx)(`td`,{className:`py-3 text-gray-900`,children:e.call_count.toLocaleString()}),(0,B.jsx)(`td`,{className:`py-3 text-gray-600`,children:e.total_prompt_tokens.toLocaleString()}),(0,B.jsx)(`td`,{className:`py-3 text-gray-600`,children:e.total_completion_tokens.toLocaleString()}),(0,B.jsx)(`td`,{className:`py-3 font-medium text-gray-900`,children:e.total_tokens.toLocaleString()})]},t))})]})})}),r===`convention`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`管理写入项目 CLAUDE.md 的自定义规范约束块`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(J,{size:`sm`,icon:Ac,variant:`secondary`,onClick:()=>{se(null),Ce.mutate(void 0)},disabled:Ce.isPending,children:Ce.isPending?`进化中...`:`全部进化`}),(0,B.jsx)(J,{size:`sm`,icon:fc,onClick:()=>u({id:`rule-${Date.now()}`,name:``,content:``}),children:`新增规范`})]})]}),oe&&(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900 mb-1`,children:oe.evolved?`进化完成${oe.count===void 0?``:`(${oe.count} 个规范)`}`:oe.message??`无需优化`}),oe.changes&&oe.changes.length>0&&(0,B.jsx)(`ul`,{className:`text-xs text-gray-600 space-y-0.5`,children:oe.changes.map((e,t)=>(0,B.jsxs)(`li`,{children:[`• `,e]},t))})]}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>se(null)})]})}),l&&(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(`input`,{className:`flex-1 px-3 py-1.5 text-sm border border-gray-200 rounded-md`,placeholder:`规范 ID(英文,如 code-style)`,value:l.id,onChange:e=>u({...l,id:e.target.value})}),(0,B.jsx)(`input`,{className:`flex-1 px-3 py-1.5 text-sm border border-gray-200 rounded-md`,placeholder:`规范名称`,value:l.name,onChange:e=>u({...l,name:e.target.value})})]}),(0,B.jsx)(`textarea`,{className:`w-full px-3 py-2 text-sm border border-gray-200 rounded-md font-mono h-40 resize-y`,placeholder:`规范内容(Markdown 格式)`,value:l.content,onChange:e=>u({...l,content:e.target.value})}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>u(null),children:`取消`}),(0,B.jsx)(J,{size:`sm`,icon:Ps,onClick:()=>re.mutate(l),disabled:!l.id||!l.name||!l.content,children:`保存`})]})]})}),I?.items.map(e=>(0,B.jsx)(Y,{children:s?.id===e.id?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`input`,{className:`w-full px-3 py-1.5 text-sm border border-gray-200 rounded-md`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),(0,B.jsx)(`textarea`,{className:`w-full px-3 py-2 text-sm border border-gray-200 rounded-md font-mono h-48 resize-y`,value:s.content,onChange:e=>c({...s,content:e.target.value})}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>c(null),children:`取消`}),(0,B.jsx)(J,{size:`sm`,icon:Ps,onClick:()=>re.mutate(s),children:`保存`})]})]}):(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Vb,{size:`sm`,children:e.id}),(0,B.jsx)(`span`,{className:`font-medium text-gray-900`,children:e.name})]}),(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Ac,onClick:()=>{se(null),Ce.mutate(e.id)},title:`AI 进化`}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:uc,onClick:()=>c(e)}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:Cc,onClick:()=>R.mutate(e.id)})]})]}),(0,B.jsx)(`pre`,{className:`text-xs text-gray-600 bg-gray-50 p-3 rounded-md overflow-auto whitespace-pre-wrap ${h.has(e.id)?``:`max-h-32`}`,children:e.content}),e.content.length>300&&(0,B.jsx)(`button`,{className:`mt-1 text-xs text-blue-500 hover:text-blue-700`,onClick:()=>g(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),children:h.has(e.id)?`收起`:`展开全部(${e.content.length} 字符)`})]})},e.id)),I?.items.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-12 text-gray-400`,children:[(0,B.jsx)(Qs,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,B.jsx)(`p`,{children:`暂无自定义规范,点击"新增规范"添加`})]})]}),r===`claudemd`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(Qs,{className:`h-5 w-5 text-blue-500`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`font-medium text-gray-900`,children:`CLAUDE.md`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:L?.exists?`${(L.size/1024).toFixed(1)} KB · ${L.hasAutoSection?`含自动区块`:`纯用户内容`}`:`文件不存在`})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:mc,onClick:()=>n.invalidateQueries({queryKey:[`claudemd`,e]}),children:`刷新`}),L?.exists&&(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:Ac,onClick:()=>{b(null),ae.mutate()},disabled:ae.isPending,title:`AI 蒸馏:压缩冗余内容,保留核心规范`,children:ae.isPending?`蒸馏中...`:`蒸馏`}),L?.exists&&!d&&(0,B.jsx)(J,{size:`sm`,icon:uc,onClick:()=>{m(L.content||``),f(!0)},children:`编辑`})]})]})}),y&&(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsx)(`p`,{className:`text-sm ${y.success?`text-gray-900`:`text-red-600`}`,children:y.message}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>b(null)})]})}),d&&(0,B.jsxs)(Y,{children:[(0,B.jsx)(`textarea`,{className:`w-full px-3 py-2 text-sm border border-gray-200 rounded-md font-mono h-96 resize-y`,value:p,onChange:e=>m(e.target.value)}),(0,B.jsxs)(`div`,{className:`flex gap-2 justify-end mt-3`,children:[(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>f(!1),children:`取消`}),(0,B.jsx)(J,{size:`sm`,icon:Ps,onClick:()=>ie.mutate(p),children:`保存`})]})]}),!d&&L?.exists&&(0,B.jsx)(Y,{title:`内容预览`,children:(0,B.jsx)(`pre`,{className:`text-xs text-gray-700 bg-gray-50 p-4 rounded-md overflow-auto max-h-96 whitespace-pre-wrap font-mono`,children:L.content})}),(0,B.jsx)(Y,{title:`子模块 (${te?.total??0})`,children:te?.items.length===0?(0,B.jsx)(`p`,{className:`text-sm text-gray-400`,children:`未检测到子模块`}):(0,B.jsx)(`div`,{className:`space-y-2`,children:te?.items.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between p-3 border border-gray-100 rounded-lg`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)($s,{className:`h-4 w-4 text-gray-400`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:e.name}),(0,B.jsx)(`p`,{className:`text-xs text-gray-400`,children:e.relativePath})]})]}),(0,B.jsx)(Vb,{size:`sm`,variant:e.hasClaudeMd?`success`:`default`,children:e.hasClaudeMd?`已有 CLAUDE.md`:`未生成`})]},e.path))})})]}),r===`environment`&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`font-medium text-gray-900 mb-1`,children:`环境检测 & 项目初始化`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`检测项目技术栈、创建 .claude-forge 目录、自动生成 CLAUDE.md(如不存在)`})]}),(0,B.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,B.jsx)(J,{variant:`secondary`,size:`sm`,icon:vc,onClick:be,disabled:ue,children:ue?`检测中...`:`环境检测`}),(0,B.jsx)(J,{size:`sm`,icon:Ac,onClick:xe,disabled:fe,children:fe?`初始化中...`:`一键初始化`}),(0,B.jsx)(J,{size:`sm`,icon:Qs,onClick:Se,disabled:ge,children:ge?`生成中...`:`初始化规范`})]})]})}),me&&(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[me.success?(0,B.jsx)(Ps,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(kc,{className:`h-4 w-4 text-red-500 mt-0.5 flex-shrink-0`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium ${me.success?`text-gray-900`:`text-red-600`}`,children:me.message}),me.claudeMdGenerated&&(0,B.jsx)(`p`,{className:`text-xs text-green-600 mt-0.5`,children:`CLAUDE.md 已自动生成`})]})]}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>he(null)})]})}),ve&&(0,B.jsx)(Y,{children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[ve.success?(0,B.jsx)(Ps,{className:`h-4 w-4 text-green-500 mt-0.5 flex-shrink-0`}):(0,B.jsx)(kc,{className:`h-4 w-4 text-red-500 mt-0.5 flex-shrink-0`}),(0,B.jsx)(`p`,{className:ud(`text-sm font-medium`,ve.success?`text-gray-900`:`text-red-600`),children:ve.message})]}),(0,B.jsx)(J,{variant:`ghost`,size:`sm`,icon:kc,onClick:()=>ye(null)})]})}),ce&&!(`error`in ce)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Y,{title:`技术栈`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 text-sm`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mb-1`,children:`项目名称`}),(0,B.jsx)(`p`,{className:`font-medium text-gray-900`,children:ce.projectName})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mb-1`,children:`包管理器`}),(0,B.jsx)(`p`,{className:`font-medium text-gray-900`,children:ce.packageManager||`未检测到`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mb-1`,children:`测试框架`}),(0,B.jsx)(`p`,{className:`font-medium text-gray-900`,children:ce.testFramework||`未检测到`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mb-1`,children:`构建工具`}),(0,B.jsx)(`p`,{className:`font-medium text-gray-900`,children:ce.buildTool||`未检测到`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mb-1`,children:`Linter`}),(0,B.jsx)(`p`,{className:`font-medium text-gray-900`,children:ce.linter||`未检测到`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-xs text-gray-400 mb-1`,children:`Formatter`}),(0,B.jsx)(`p`,{className:`font-medium text-gray-900`,children:ce.formatter||`未检测到`})]})]})}),ce.languages.length>0&&(0,B.jsx)(Y,{title:`检测到的语言`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ce.languages.map((e,t)=>(0,B.jsxs)(Vb,{size:`sm`,children:[e.name,e.version?` ${e.version}`:``]},t))})}),ce.frameworks.length>0&&(0,B.jsx)(Y,{title:`检测到的框架`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ce.frameworks.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 bg-blue-50 rounded-md`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-blue-700`,children:e.name}),(0,B.jsx)(`span`,{className:`text-xs text-blue-400`,children:e.category})]},t))})}),Object.keys(ce.scripts).length>0&&(0,B.jsx)(Y,{title:`常用脚本`,children:(0,B.jsx)(`div`,{className:`space-y-1`,children:Object.entries(ce.scripts).map(([e,t])=>(0,B.jsxs)(`div`,{className:`flex items-start gap-3 text-sm py-1 border-b border-gray-50 last:border-0`,children:[(0,B.jsx)(`span`,{className:`font-mono text-blue-600 flex-shrink-0 w-24`,children:e}),(0,B.jsx)(`span`,{className:`text-gray-600 font-mono text-xs break-all`,children:t})]},e))})}),ce.keyDirectories.length>0&&(0,B.jsx)(Y,{title:`关键目录`,children:(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ce.keyDirectories.map((e,t)=>(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 bg-gray-50 rounded-md`,children:[(0,B.jsx)($s,{className:`h-3.5 w-3.5 text-gray-400`}),(0,B.jsx)(`span`,{className:`text-sm text-gray-700 font-mono`,children:e})]},t))})})]}),ce&&`error`in ce&&(0,B.jsx)(Y,{children:(0,B.jsxs)(`p`,{className:`text-sm text-red-600`,children:[`检测失败:`,ce.error]})})]})]})}function jle(){return(0,B.jsx)(Tte,{children:(0,B.jsxs)(Ic,{children:[(0,B.jsx)(wte,{}),(0,B.jsx)(gd,{children:(0,B.jsxs)(lr,{children:[(0,B.jsx)(sr,{path:`/`,element:(0,B.jsx)(or,{to:`/dashboard`,replace:!0})}),(0,B.jsx)(sr,{path:`/dashboard`,element:(0,B.jsx)(e4,{})}),(0,B.jsx)(sr,{path:`/sessions`,element:(0,B.jsx)(i4,{})}),(0,B.jsx)(sr,{path:`/sessions/:id`,element:(0,B.jsx)(o4,{})}),(0,B.jsx)(sr,{path:`/events`,element:(0,B.jsx)(k4,{})}),(0,B.jsx)(sr,{path:`/pipelines`,element:(0,B.jsx)(j4,{})}),(0,B.jsx)(sr,{path:`/pipelines/:id`,element:(0,B.jsx)(F4,{})}),(0,B.jsx)(sr,{path:`/projects`,element:(0,B.jsx)(kle,{})}),(0,B.jsx)(sr,{path:`/projects/:encodedPath`,element:(0,B.jsx)(Ale,{})}),(0,B.jsx)(sr,{path:`/quality`,element:(0,B.jsx)(I4,{})}),(0,B.jsx)(sr,{path:`/analytics`,element:(0,B.jsx)(H4,{})}),(0,B.jsx)(sr,{path:`/knowledge`,element:(0,B.jsx)(Ole,{})}),(0,B.jsx)(sr,{path:`/config`,element:(0,B.jsx)(R4,{})})]})})]})})}var Mle=new Ue({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});jc.createRoot(document.getElementById(`root`)).render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Je,{client:Mle,children:(0,B.jsx)(Xr,{children:(0,B.jsx)(jle,{})})})}));
|